luminescence-software / Metatogger-Support

The Metatogger support homepage
0 stars 0 forks source link

(mostly solved) How do I change filename? #1

Closed EmilyEmbers closed 3 months ago

EmilyEmbers commented 3 months ago

EDIT: I just found out that I could have just used the functions under Tidy Up. This is definitely partially on me, but I also cant fully blame myself for not seeing that ''tidy up'' would contain the function I need. However, the question still stands, as I'd love to have an answer for future use.

I'm not good with csharp, having been mostly a web dev in a school that taught me basically nothing about properly using an IDE, built apps like this are a nightmare for me.

I'm trying to append track number to filename. How am I supposed to find out how to reference the filename and change it? I can't find metatogger.data which if im not wrong is where files is coming from. From what I can tell this is part of the built app, meaning neither I nor visual studio code are able to see any info on it, let alone the possible tag types.

I did see the line // Dictionary<string, List<string>> AudioFile.GetAllTags() => returns all tags of an audio file at the bottom of the example, but I'm not sure how this is useful as I am unsure where I would even see where this is returned.

Thank you for the help, metatogger is a wonderful app.

CyberSinh commented 3 months ago

The easiest and most efficient way to rename files is to use the tool dedicated to this task: Rename and sort files according to their tags. To prepend a track number to the file name, simply use the <|tracknumber| - >|title| pattern. Find out more in the documentation here.

However, if you insist on using a C# script, here's an example code:

using Metatogger.Data;

foreach (var file in files)
{
   string trackNumber = file.GetFirstValue(TagName.TrackNumber);
   if (currentTrackNumber != null)
      file.OutputFilename = $"{trackNumber} - {file.InputFilename}";
}
EmilyEmbers commented 3 months ago

Thank you! I prefer using code in any app where its possible to learn more about this kind of stuff.