feat: sort tag items alphabetically
This commit is contained in:
+4
-2
@@ -8,7 +8,7 @@ use std::collections::HashMap;
|
|||||||
use std::env::var;
|
use std::env::var;
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::{fs::read_dir, fs::File, io::Read, process::Command};
|
use std::{fs::File, fs::read_dir, io::Read, process::Command};
|
||||||
|
|
||||||
pub fn edit(file_path: Vec<PathBuf>, extra_files: [String; 8]) -> std::io::Result<()> {
|
pub fn edit(file_path: Vec<PathBuf>, extra_files: [String; 8]) -> std::io::Result<()> {
|
||||||
let tmp_file_path = PathBuf::from("/tmp/keks-sort-metadata");
|
let tmp_file_path = PathBuf::from("/tmp/keks-sort-metadata");
|
||||||
@@ -47,12 +47,14 @@ pub fn edit(file_path: Vec<PathBuf>, extra_files: [String; 8]) -> std::io::Resul
|
|||||||
}
|
}
|
||||||
|
|
||||||
for file in &files {
|
for file in &files {
|
||||||
|
let mut items: Vec<_> = file.tag.items().collect();
|
||||||
|
items.sort_by_key(|item| item.key().map_key(VorbisComments).unwrap());
|
||||||
writeln!(
|
writeln!(
|
||||||
tmp_file.try_clone()?,
|
tmp_file.try_clone()?,
|
||||||
"------------ {:?} ------------",
|
"------------ {:?} ------------",
|
||||||
file.path
|
file.path
|
||||||
)?;
|
)?;
|
||||||
for item in file.tag.items() {
|
for item in items {
|
||||||
writeln!(
|
writeln!(
|
||||||
tmp_file,
|
tmp_file,
|
||||||
"{} = {}",
|
"{} = {}",
|
||||||
|
|||||||
Reference in New Issue
Block a user