FS#13497: '0' is sometimes a valid track number

Most notably for CD rips that use a track number of 0 for
the leadin.

Therefore change our "invalid track number" canary to -1 instead
of 0.  Additionally don't try to parse an empty string.

In the process, get rid of redudant 'discnum = 0' as well.

NOTE: While not strictly necessary, we recommend rebuilding the
      database to ensure files without track numbers are
      updated with the new canary.

Change-Id: I543f98ca49cec7b5eeffa7c14c1eca57171f345a
This commit is contained in:
Solomon Peachy 2025-11-19 21:03:34 -05:00
parent 481cc70fe0
commit e94a96cdcf
15 changed files with 104 additions and 89 deletions

View file

@ -263,7 +263,7 @@ const char *get_id3_token(struct wps_token *token, struct mp3entry *id3,
case SKIN_TOKEN_METADATA_TRACK_NUMBER:
if (id3->track_string)
return id3->track_string;
if (id3->tracknum) {
if (id3->tracknum >= 0) {
itoa_buf(buf, buf_size, id3->tracknum);
return buf;
}