IPB

Welcome Guest ( Log In | Register )

> foobar2000 General Forum Rules

This is NOT a tech support forum.
Tech support questions go to foobar2000 Tech Support forum instead.

See also: Hydrogenaudio Terms of Service.

 
Reply to this topicStart new topic
tag 'script' to print out DISC 1, DISC 2.. etc
diypig
post Nov 17 2012, 16:24
Post #1





Group: Members
Posts: 95
Joined: 3-February 08
Member No.: 51013



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
%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 smile.gif
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 smile.gif
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 smile.gif
Go to the top of the page
+Quote Post
Daeron
post Nov 17 2012, 17:47
Post #2





Group: Members
Posts: 376
Joined: 9-October 08
Member No.: 59818



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
%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.

This post has been edited by Daeron: Nov 17 2012, 18:13
Go to the top of the page
+Quote Post
diypig
post Nov 17 2012, 18:45
Post #3





Group: Members
Posts: 95
Joined: 3-February 08
Member No.: 51013



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 smile.gif


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 smile.gif
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 smile.gif 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 smile.gif

This post has been edited by joshuatm: Nov 17 2012, 18:50
Go to the top of the page
+Quote Post
Daeron
post Nov 17 2012, 22:44
Post #4





Group: Members
Posts: 376
Joined: 9-October 08
Member No.: 59818



QUOTE (joshuatm @ Nov 17 2012, 12:45) *
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.

QUOTE (joshuatm @ Nov 17 2012, 12:45) *
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.

QUOTE (joshuatm @ Nov 17 2012, 12:45) *
i avoid genre, i personally really hate it, that is just me smile.gif 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.

QUOTE (joshuatm @ Nov 17 2012, 12:45) *
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.

This post has been edited by Daeron: Nov 17 2012, 22:47
Go to the top of the page
+Quote Post
diypig
post Nov 18 2012, 10:38
Post #5





Group: Members
Posts: 95
Joined: 3-February 08
Member No.: 51013



thank you again smile.gif

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 smile.gif (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 smile.gif
Go to the top of the page
+Quote Post
Daeron
post Nov 18 2012, 11:36
Post #6





Group: Members
Posts: 376
Joined: 9-October 08
Member No.: 59818



QUOTE (joshuatm @ Nov 18 2012, 03:38) *
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).

QUOTE (joshuatm @ Nov 18 2012, 03:38) *
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').

This post has been edited by Daeron: Nov 18 2012, 12:23
Go to the top of the page
+Quote Post
diypig
post Nov 18 2012, 11:54
Post #7





Group: Members
Posts: 95
Joined: 3-February 08
Member No.: 51013



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?

This post has been edited by joshuatm: Nov 18 2012, 12:09
Go to the top of the page
+Quote Post
Daeron
post Nov 18 2012, 16:39
Post #8





Group: Members
Posts: 376
Joined: 9-October 08
Member No.: 59818



QUOTE (joshuatm @ Nov 18 2012, 04:54) *
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.

QUOTE (joshuatm @ Nov 18 2012, 04:54) *
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

This post has been edited by Daeron: Nov 18 2012, 16:41
Go to the top of the page
+Quote Post
diypig
post Nov 19 2012, 11:41
Post #9





Group: Members
Posts: 95
Joined: 3-February 08
Member No.: 51013



i appreciate all of this help, i am sure it will help others too smile.gif
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!
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 27th August 2014 - 12:35