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: tag 'script' to print out DISC 1, DISC 2.. etc (Read 2410 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

tag 'script' to print out DISC 1, DISC 2.. etc

hi, i had a look through the wiki at conditional tagging, and i tried looking on google, but i'm still stuck.
i make a lot of use out of foobar's 'file operations' menu, i use the 'move to' option, and use it to organize my music into folders that makes everything more managable.

at the moment i have something like this:

Code: [Select]
%album artist%/%album%[ '('%date%')']/%tracknumber% - %title%


i'm not sure why the date in enclosed in the square brackets, but it has been like that for months and it works
could anyone explain what the square brackets do?

i have a problem when i come across a release with multiple disks, it wants to put all of the tracks in the one release directory.

i want something like this:

album artist
    -album (date)
        --DISC 1
            ---01 - etc etc etc.flac
            ---02 - etc etc etc.flac
        --DISC 2
            ---01 - etc etc etc.flac
            ---02 - etc etc etc.flac

i was hoping that someone could help me with the syntax/code to make this possible
is it possible to ignore the disc folder if there is only 1 disc? as in, if the disk total tag, or whatever it is called, is 1, or empty, then to simply ignore making the disc subfolders?

thank you very much for this, i appreciate it!

p.s. also, what is the difference between using $meta(something..) and %something%? are they interchangeable?
thanks again

tag 'script' to print out DISC 1, DISC 2.. etc

Reply #1
Be sure to check out:
http://wiki.hydrogenaudio.org/index.php?ti...ormat_Reference

The contents of the '[]' brackets will only be shown if they return true after the evaluation. '[%date%]' will return the value of DATE if it exists, otherwise nothing at all. '%date%' without the brackets would leave a '?' mark indicating that the tag is missing, which is annoying from an aesthetic standpoint.

'$meta(artist)' always returns the exact value of the ARTIST tag. If it does not exist, returns nothing. '%artist%' on the other hand will look for ARTIST, ALBUM ARTIST, COMPOSER and PERFORMER tags in this order, and will show '?' if none of those tags returned anything along the way.

As for the folder structure, you can try something like this, but it will always depend on the way you tag your files:
Code: [Select]
%album artist%/%album%[ '('%date%')']/[DISC %discnumber%/]%tracknumber% - %title%

This is the simplest way in my opinion. It will only work if the DISCNUMBER tag is only filled when the album does have multiple discs, otherwise must be left empty.

It's doable in many other ways too, but might require a slightly more complicated code. If you tell me how your files are currently tagged, or how you plan tagging them, I can adjust it the way you want.

tag 'script' to print out DISC 1, DISC 2.. etc

Reply #2
oh wow! thank you so much!
ah, ok, i had a feeling it was something like that (the [ ] thing), thanks.
and ah, thanks for the $meta explanation!
so when it is not a special case like artist, or some thing else maybe (you said %artist% will check some tags in order, but $meta(artist) will only use artist), but if i were to use $meta(customtag) and %customtag%, there is no difference right? that is what i assume


hmm, things get a bit tricky, people say it is your own preference etc, but, of course, some people do not know all of the options available to them, so, in what other ways could i do it? you say it can be done with more complicated code, but, what would be the point, if that what you gave me does it?
don't get me wrong, i am not trying to be critical at all, i just want to understand how else it could be done
thank you for offering to help/adjust things!

so, my files are tagged quite simply i think, nothing rally out of the ordinary.
by that i mean, i use the artist, album artist, track, date, track/total track, disc/total disc tags, an extra custom tag or two but that is not in the file names at all.
i avoid genre, i personally really hate it, that is just me  i don't find that i can apply a 'genre' to some bands, some albums, .. etc.
i have about 250GB of flac files, i store them on my computer, and for use on my iPod (240gb hard drive)

the way you have me will work perfectly for my tags and for the layout i want!
i suppose i could change it to [DISC %discnumber% - %discsubtitle%/] or something, some discs have a 'name', but sure, i didn't realise it was as simple as that.

ah, wait, hmm... ok, so if i have this: [DISC %discnumber%/]  it will only show, and insert that folder if there is an entry in discnumber, but what if i have two tags, like that example i put above, with the subtitle. what if one existed, but one did not? would i have to change it to this?:
[DISC %discnumber%[ - %discsubtitle%]/]
thank you for all of your help!

-edit. and yeah, i store my files how i showed in the first post, firstly i have the album artist as a folder, then release with the year in brackets as a folder, then the file like 01 - title.flac.  i doubt that is so different to most people

tag 'script' to print out DISC 1, DISC 2.. etc

Reply #3
but if i were to use $meta(customtag) and %customtag%, there is no difference right?

If the tag is missing, the latter will return '?' instead of nothing. I suppose '$meta(test)' and '[%test%]' should be equal in that case, though.

people say it is your own preference etc, but, of course, some people do not know all of the options available to them, so, in what other ways could i do it?

The core of the problem is that foobar (at least as far as the titleformatting goes) evaluates each file independently. That means if the track('s metadata) from Disc 1 does not specifically states somewhere that there should be a second Disc (regardless if it actually exists), you can't decide whether you should nest your folder deeper (as you might create a '\Disc 1\' when there aren't multiple discs).

The way to store those informations is what might differ. Some prefer to keep both values in the single DISCNUMBER tag as 1/2 (discnumber/totaldiscs) or just use the second TOTALDISCS tag separately. The additional work would be to create a code that retrieves that data and decides whether a subfolder should be created. The code a gave you simply decides it based on whether the tag exists at all.

It is probably not the most conventional method, but it gets the job done. With that said though, you might have to keep retagging newly downloaded files (which you might do anyway). Also other media players (following whatever standards) might not be able to understand what your tags mean. Once you have do have a way to distinguish between your files though, you'll be able to easily re-tag them according to whatever naming standards freely.

i avoid genre, i personally really hate it, that is just me  i don't find that i can apply a 'genre' to some bands, some albums, .. etc.

You can use multi-value tags to define multiple genres. Although compability might be a concern. I have no idea whether an iPod supports that.

but what if i have two tags, like that example i put above, with the subtitle. what if one existed, but one did not? would i have to change it to this?: [DISC %discnumber%[ - %discsubtitle%]/]

If the latter exist, the second part will be shown regardless. You can use '$if(%discnumber%,%discnumber%[ - %discsubtitle%],)' if you want to make sure, although I suppose the latter shouldn't exist at all without the former if your files are properly tagged.

 

tag 'script' to print out DISC 1, DISC 2.. etc

Reply #4
thank you again

so you are saying, that tag script is not 'perfect' in the sense that it will make disc subfolders even if there is only 1 disk (but only if the tags for those tracks are tagged as discnumber = 1 and totaldiscs = 1), sure i understand that.
I will make sure that i only apply those tags to multi disc releases.
but, i nice way would be to make something that checks if there is only one TOTAL disc, and to ignore making subfolders if this is the case.
is that possible? i will have a go  (i am fine with c++ and java, but aha this is not the same!)

is it 'recommended' to leave some tags blank? so, where there is only one disc in a release, to leave the disc number and total disc number blank?
or, is it recommended to put 1 in both? at the moment i am just leaving them blank.

i have rockbox installed on my iPod, so, it is very customizable.
and sure i retag and double check everything i rip/acquire, it takes so much time but soon it will be over!
this disc subfolder thing was one of the things i had to do 'manually' but not anymore, thanks

tag 'script' to print out DISC 1, DISC 2.. etc

Reply #5
so you are saying, that tag script is not 'perfect' in the sense that it will make disc subfolders even if there is only 1 disk (but only if the tags for those tracks are tagged as discnumber = 1 and totaldiscs = 1), sure i understand that..

As long as TOTALDISC is defined (be that 1 even), you can always decide whether a subfolder should be created. The problem only rises when you have DISCNUMBER=1 but TOTALDISC is missing. Since each file is evaluated seperately, the script doesn't 'see' whether a Disc 2 exist while evaluating a file from Disc 1, unless that specifically 'says so'. It could lie even, doesn't matter.

My method basically says if DISCNUMBER is filled at all, there should be multiple Discs, so create a subfolder. But it is also possible to write a script that only creates a subfolder when TOTALDISC is greater than 1 (and exists).

is it 'recommended' to leave some tags blank? so, where there is only one disc in a release, to leave the disc number and total disc number blank?
or, is it recommended to put 1 in both? at the moment i am just leaving them blank.

Probably not, but I don't know which standard is the most widely accepted (since I don't even use DISC tags). If you were already using DISCNUMBER and TOTALDISC in whatever form, you should probably stick to that. What I suggested (only fill DISCNUMBER for multiple discs, don't use TOTALDISC at all) is just the simplest/laziest method (since you only have to fill a single tag when necessary and you can mass-wipe out everything else) that still works.

Using TOTALDISC gives you more information, but is also a hassle to tag all the files with it manually and isn't that necessary unless you make use of it (which goes as far as: 'Disc 1 of 2').

tag 'script' to print out DISC 1, DISC 2.. etc

Reply #6
just as i thought, thanks.
that's a really great help for me, thanks for it all!

-edit. actually, would it be possible to check if totaldisc is NOT 1, or is NOT blank? and make the subfolders dependent on that?

-edit 2. i'm not sure how 'powerful' the script tags can get, but from looking at the wiki page it does not seem like it is possible... i can see if something exists or not, but i can't see if it is equal to 1, or 8 (for example) right?

tag 'script' to print out DISC 1, DISC 2.. etc

Reply #7
would it be possible to check if totaldisc is NOT 1, or is NOT blank? and make the subfolders dependent on that?

Yes, but you might want to rephrase what you are asking: $ifgreater(n1,n2,then,else) => $ifgreater(%totaldisc%,1,[Disc %discnumber%/],)

This simply checks whether TOTALDISC is greater than 1. If the tag is missing, is 0 or 1, the validation is failed and the red part (in our case nothing) is returned. If the condition is true, the green part creates a subfolder.

i'm not sure how 'powerful' the script tags can get, but from looking at the wiki page it does not seem like it is possible... i can see if something exists or not, but i can't see if it is equal to 1, or 8 (for example) right?

You can do pretty much anything you could ask for. See above example for comparing numbers, $strcmp()/$stricmp() for strings etc.

http://wiki.hydrogenaudio.org/index.php?ti...ormat_Reference

tag 'script' to print out DISC 1, DISC 2.. etc

Reply #8
i appreciate all of this help, i am sure it will help others too
wow, ah i see that i can do it, wow, thank you for giving me a shove in the right direction!
until now i had two 'scripts' that i saved in the file operations, 'move to' area, and if a release was with multiple disks, i would select that one script, and if not, i would select the 'normal' script. it seems i should be able to put it into one now, thanks!