mirror of
https://github.com/johrpan/musicus.git
synced 2025-10-26 19:57:25 +01:00
import: Order files alphabetically
This commit is contained in:
parent
0abfad07f8
commit
bb33b30f6e
1 changed files with 4 additions and 2 deletions
|
|
@ -4,6 +4,7 @@ use gstreamer::ClockTime;
|
||||||
use gstreamer_pbutils::Discoverer;
|
use gstreamer_pbutils::Discoverer;
|
||||||
use log::{warn, info};
|
use log::{warn, info};
|
||||||
use sha2::{Sha256, Digest};
|
use sha2::{Sha256, Digest};
|
||||||
|
use std::fs::DirEntry;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::sync::Mutex;
|
use std::sync::Mutex;
|
||||||
use tokio::sync::watch;
|
use tokio::sync::watch;
|
||||||
|
|
@ -17,9 +18,10 @@ pub(super) fn new(path: PathBuf) -> Result<ImportSession> {
|
||||||
let mut hasher = Sha256::new();
|
let mut hasher = Sha256::new();
|
||||||
let discoverer = Discoverer::new(ClockTime::from_seconds(1))?;
|
let discoverer = Discoverer::new(ClockTime::from_seconds(1))?;
|
||||||
|
|
||||||
for entry in std::fs::read_dir(path)? {
|
let mut entries = std::fs::read_dir(path)?.collect::<std::result::Result<Vec<DirEntry>, std::io::Error>>()?;
|
||||||
let entry = entry?;
|
entries.sort_by(|entry1, entry2| entry1.file_name().cmp(&entry2.file_name()));
|
||||||
|
|
||||||
|
for entry in entries {
|
||||||
if entry.file_type()?.is_file() {
|
if entry.file_type()?.is_file() {
|
||||||
let path = entry.path();
|
let path = entry.path();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue