Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: How do I import metadata information from file/folder names? (Read 1764 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

How do I import metadata information from file/folder names?

So the topic title is a bit vague so here it is: I've been trying to figure out how to import information from the folder my physical files are located in.
I have all my files structure like so: artist -> [year released] album name -> # - song title
where each '->' represents a subfolder

So i want to import the year from the folder that the song is physically stored in since i have all the years included in there already
I know how to import from the string of the song file but that is it.

Anyone know a component to do this or default to do this?, I can't seem to find one.

Any help would be appreciated

Another thing to add is that even with the automatic fill values changing it to %path% it doesn't really seem to help much since everything is one string
or maybe i am just doing it wrong...

How do I import metadata information from file/folder names?

Reply #1
Oh man
just read some more syntax for fb2k
and realize there is a %directoryname%

heh

I'm an idiot

How do I import metadata information from file/folder names?

Reply #2
Okay well, though the source is the %directoryname%

i have some different structure for things, that is

if there are multiple cd's per album, i have two more folders under the album name labeld, CD I or CD II, etc.
as well as if I have the re-release, remastered or some sort of other version other then the original of an album, the folder name will contain the [original release year, re-release version] so
i want to be able to check to see what type of subdirectory it is in, that is
to check to see if the source string begins with a '[' character and the 5th index of the string is a ], to make the pattern, [%date%] if not, check to see if it starts with the '[' character and to see if the 11th index is a ] so as to make the pattern
[%date%,] or [%date%, ignorethispart]


i've tried looking at the syntax page and tried many things but i don't think i am doing it right...


How do I import metadata information from file/folder names?

Reply #4
Well, my question was if is there a third-party plugin that might do such a thing because of what I described...

I already stated that trying to use the auto-fill values method cannot grant the easiest possible way to retrieve the year from the name of the folder which the song is located in since i have different folder hieracrchy
which i did describe

My title could seem a bit vague but i did describe what i wanted to get done sufficiently enough to propose my question and relate it to a possible third-party plugin

How do I import metadata information from file/folder names?

Reply #5
Most of which is fair enough and poor reading on my part, so I apologise there, except for the title!

The dialog we’ve mentioned can’t accept conditional statements and/or multiple possible mappings, so the only way you could use it would be to run it multiple times, once for each group of files that follows one particular folder structure and thus naming template. Perhaps you could automatically isolate these groups into (auto)playlists using query syntax – $substr(%path%,11,11) IS ']' – or whatever… but it might not be worth the hassle.

Perhaps there is a third-party plugin, or a better way to (semi-)automate this; I leave those questions up to other users with more ideas.

In any case, though, I don’t see why you think %directoryname% is what you want: it only returns the name of the parent directory, not the entire path, and your metadata is stored across multiple directory names. You need %path%.

 

How do I import metadata information from file/folder names?

Reply #6
... to check to see if the source string begins with a '[' character and the 5th index of the string is a ], to make the pattern, [%date%] if not, check to see if it starts with the '[' character and to see if the 11th index is a ] so as to make the pattern
[%date%,] or [%date%, ignorethispart] ...


Hmmm... recreating the structure you described...

this will return the brackets along with the text contained within them:

$substr(%path%,$strchr(%path%,'['),$strrchr(%path%,']'))


and this will return only the text within the brackets:

$replace($substr(%path%,$strchr(%path%,'['),$strrchr(%path%,']')),'[',,']',)


and this will return only the year text within the brackets, as long as they are the first 4 characters:

$left($replace($substr(%path%,$strchr(%path%,'['),$strrchr(%path%,']')),'[',,']',),4)


Now, how you'd use one of these strings to automatically populate a metadata tag is beyond me. Personally I'd likely create a column with one of the strings, sort using that column and then manually batch edit those that returned the same information.

EDIT:

Alternatively, you could use these for the second and third strings, respectively:

$substr(%path%,$add($strchr(%path%,'['),1),$sub($strrchr(%path%,']'),1))

$left($substr(%path%,$add($strchr(%path%,'['),1),$sub($strrchr(%path%,']'),1)),4)

I'd most likely use these instead of those I originally posted.


Of course, all of these strings will only work if the path contains solely one of each bracket []. They could be modified to work, however, if the path contains a maximum of two of each bracket [][].