Closed HackingPheasant closed 4 years ago
Hi! I think perhaps a simpler explanation here is that $track_alt
is unpadded—so it's not actually the %if
doing this, but that $track
has the padding applied but $track_alt
is just a "normal field" (a flexible attribute, in fact) and doesn't get automatically padded.
$track_alt
was added in #2363, and as the thread implies, it's not always a number—hence the lack of padding by default.
Some ways to add padding might include the inline
plugin or extending the types
plugin to allow use of the PaddedInt
type.
But the $track_alt
option isn't used in the files in the screenshot its $track that gets used.
$track_alt is only used in my config if the album is Vinyl or Cassette. Which have thier numbering as A1, A2 and so on (on MusicBrainz), so I don't expect that to be padded.
~~So to double check everything is correct on my end,
%if{alt_tracks,$track_alt,$track}
is in reality is %if{condition,truetext,falsetext}
according to docs~~
My condition used above is
item_fields:
alt_tracks: 1 if media in ['12" Vinyl', '10" Vinyl', '7" Vinyl', 'Vinyl', 'Cassette'] else 0
Which should only trigger $track_alt
on Vinyl and Cassettes and $track
on everything else, correct? As the two albums I had tested (created a new library for testing my config changes) where a digital release and a CD, which shouldn't trigger the above.
Is there any way I get more detailed info for use in this info?
EDIT: Let me try replacing $track-alt with track to try and eliminate one option, will up-date this comment with the results
EDIT 2: Ignore the above, items seems @sampsyo was on point that $track_alt
was getting used. Now to check why 1 if media in ['12" Vinyl', '10" Vinyl', '7" Vinyl', 'Vinyl', 'Cassette'] else 0
doesn't work anymore as it use to work in my past versions of my beets config. It's probably safe to close this issue as its basically user error
EDIT 3: Main difference between current config and past configs is the use of the album_fields as well as item_fields, in the past I have exclusively used item_fields, could this have any affect on my results/outcome?
A good way to debug these things is to use beet ls -f
to try out various combinations. Like this:
beet ls -f '$track_alt - $album'
beet ls -f '$media $alt_tracks - $album'
I don't see anything obviously wrong with that definition, but maybe checking that all the values hold what you think they hold would be useful.
$ beet ls -f '$track_alt - $album'
1 - Celeste Original Soundtrack
2 - Celeste Original Soundtrack
3 - Celeste Original Soundtrack
4 - Celeste Original Soundtrack
5 - Celeste Original Soundtrack
6 - Celeste Original Soundtrack
7 - Celeste Original Soundtrack
8 - Celeste Original Soundtrack
9 - Celeste Original Soundtrack
10 - Celeste Original Soundtrack
11 - Celeste Original Soundtrack
12 - Celeste Original Soundtrack
13 - Celeste Original Soundtrack
14 - Celeste Original Soundtrack
15 - Celeste Original Soundtrack
16 - Celeste Original Soundtrack
17 - Celeste Original Soundtrack
18 - Celeste Original Soundtrack
19 - Celeste Original Soundtrack
20 - Celeste Original Soundtrack
21 - Celeste Original Soundtrack
And if I was to run above with $track it shows padding as intended.
$ beet ls -f '$media $alt_tracks - $album'
Digital Media 0 - Celeste Original Soundtrack
Digital Media 0 - Celeste Original Soundtrack
Digital Media 0 - Celeste Original Soundtrack
Digital Media 0 - Celeste Original Soundtrack
Digital Media 0 - Celeste Original Soundtrack
Digital Media 0 - Celeste Original Soundtrack
Digital Media 0 - Celeste Original Soundtrack
Digital Media 0 - Celeste Original Soundtrack
Digital Media 0 - Celeste Original Soundtrack
Digital Media 0 - Celeste Original Soundtrack
Digital Media 0 - Celeste Original Soundtrack
Digital Media 0 - Celeste Original Soundtrack
Digital Media 0 - Celeste Original Soundtrack
Digital Media 0 - Celeste Original Soundtrack
Digital Media 0 - Celeste Original Soundtrack
Digital Media 0 - Celeste Original Soundtrack
Digital Media 0 - Celeste Original Soundtrack
Digital Media 0 - Celeste Original Soundtrack
Digital Media 0 - Celeste Original Soundtrack
Digital Media 0 - Celeste Original Soundtrack
Digital Media 0 - Celeste Original Soundtrack
The media doesn't fit the true condition for $alt_tracks
so why does the true text condition still take precedence?
You can keep debugging that too!! Try using the %if
expression and other variants in beet ls -f
to try to understand what's going on.
I was missing $ in front of the alt_tracks, so the if condition never had anything to check and automatically defaulted to the first value.
Closing because of user error. A nice potential feature can be that beet could complain that an %if condition doesn't actually check anything
Problem
$track
numbering loses it's zero padding if inside an if statementWith a default path set as following (Padding as expected):
default: Music/%upper{%left{$albumartist_sort,1}}/$albumartist/%if{$hasyear,($year)} $album%aunique{} $alb_type$alb_status$media_type/%if{$multidisc,Disc $disc/}$track. $title
My tack listings are zero padded and look like the following screenshot
When I have it inside an if statement (Padding fails):
default: Music/%upper{%left{$albumartist_sort,1}}/$albumartist/%if{$hasyear,($year)} $album%aunique{} $alb_type$alb_status$media_type/%if{$multidisc,Disc $disc/}%if{alt_tracks,$track_alt,$track}. $title
My track listings are not zero padded and look like the following screenshot
Switching from
%if{alt_tracks,$track_alt,$track}. $title
to$track. $title
:Switching from
$track. $title
back to%if{alt_tracks,$track_alt,$track}. $title
(Aka reverting my config change):Setup
Linux thonkpad 5.6.18-156.current #1 SMP PREEMPT Sun Jun 21 07:16:38 UTC 2020 x86_64 GNU/Linux
3.7.7
1.4.9
My configuration is:
Looking at a comment in issue 3352, it mentions that beets zero pads the track automatically (to 2 digits at least), which leads me to believe that this is missed if you go down a different code path then what is considered "default"