feat: add file name indicator at the top of the editor buffer

This commit is contained in:
2026-09-03 20:50:10 +02:00
parent 052c5bd1bc
commit 5fd47b445e
+7 -2
View File
@@ -1,5 +1,4 @@
use lofty::config::WriteOptions;
use lofty::prelude::ItemKey::AlbumTitle;
use lofty::tag::TagItem;
use lofty::tag::TagType::VorbisComments;
use lofty::tag::{ItemKey, ItemValue};
@@ -14,6 +13,11 @@ pub fn edit(file_path: PathBuf, mut tag: Tag) -> std::io::Result<()> {
let tmp_file = PathBuf::from("/tmp/keks-sort-metadata");
let editor = var("EDITOR").unwrap();
let mut file = File::create(&tmp_file)?;
writeln!(
file.try_clone()?,
"------------ {:?} ------------",
file_path
)?;
for item in tag.items() {
writeln!(
file,
@@ -35,7 +39,8 @@ pub fn edit(file_path: PathBuf, mut tag: Tag) -> std::io::Result<()> {
let parsed = parse(&editable);
for (key, value) in parsed {
let item_key = ItemKey::from_key(VorbisComments, &key).expect("Failed to get item key");
let item_key =
ItemKey::from_key(VorbisComments, &key).expect("ERROR: Failed to get item key");
let item = TagItem::new(item_key, ItemValue::Text(value));
tag.insert(item.clone());
}