You are not logged in.
I'm using beets to clean up my music library. The documentation says:
%if{condition,text} or %if{condition,truetext,falsetext}: If condition is nonempty (or nonzero, if it’s a number), then returns the second argument. Otherwise, returns the third argument if specified (or nothing if falsetext is left off).I'm try to append the bitdepth and samplerate only to FLAC albums. This is what I've got so far, but the if statement doesn't work correctly. It thinks everything is FLAC. Presumably because the condition syntax is incorrect.
[paths]
default: $format/$albumartist/$year - $album ($label) %if{$format==FLAC,[$bitdepth-$samplerate]}/$track $title
singleton: $format/Non-Album/$artist/$title
comp: $format/Compilations/$album%aunique{}/$track $title
albumtype_soundtrack: $format/Soundtracks/$album/$track $titleCan someone please help me out? I don't know Python so I'm not sure if this is specific to beets or not. How do I return a number for FLAC and zero for other formats?
Last edited by ioos (2012-06-14 21:44:08)
Offline
I just tried this:
default: $format/$albumartist/$year - $album ($label) %if{%right{$format,1},[$bitrate],[$bitdepth-$samplerate]}/$track $titleMy thought was that an MP3 should return "3" (nonzero number) and a FLAC would return "C" (not a number), making FLAC the falsetext. However, it still returns true for FLAC. Also the $bitrate setting only works for CBR MP3s. For VBR, each track ends up in its own album folder. Is there a way to detect VBR and mark them as such? (V0, V2, etc.)
Offline
There's an inline plugin that looks like it will do what I want, if I can get the Python right: http://beets.readthedocs.org/en/latest/ … inline.htm
This would change my default album line to something like:
default: $format/$albumartist/$year - $album ($label) $album_deets /$track $titleThen Python can be used to determine $album_deets. This is where I'm stuck.
[pathfields]
album_deets: In Python, how do I say "if format == FLAC, then append bitdepth and samplerate, else append average bitrate"?
Offline
Ok, got it. Using the examples for the inline plugin this is what I came up with:
[paths]
default: $format/$albumartist/$year - $album$if_label$album_deets/$disc_and_track $title
singleton: $format/Non-Album/$artist/$title
comp: $format/Compilations/$year - $album%aunique{}$if_label$album_deets/$disc_and_track $title
albumtype_soundtrack: $format/Soundtracks/$year - $album$if_label$album_deets/$disc_and_track $title
[pathfields]
album_deets: u' [%02i.%02i]' % (bitdepth, samplerate) if
format[0] == 'F' else (encoder)
disc_and_track: u'%02i.%02i' % (disc, track) if
disctotal > 1 else u'%02i' % (track)
if_label: (u' (' + label + u')') if
label != '' else u''It doesn't find the average bit rate for MP3s, that's still above my head.
Offline