• Status Closed
  • Percent Complete
  • Task Type Patches
  • Category Database
  • Assigned To No-one
  • Operating System All players
  • Severity Low
  • Priority Very Low
  • Reported Version Daily build (which?)
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by sideral - 2011-05-10
Last edited by sideral - 2011-06-06

FS#12107 - Remove track-number generation heuristic from database

The database has a feature that generates a track number from a track’s file name in case that information is missing from the tags. This track number is used solely in the database for displaying and sorting views displaying collections of tracks (such as album views).

The track number is assumed to be the last pair of digits in the file’s basename (sans the filename extension after the last “.”). I find this heuristic rather problematic for two reasons: Given there’s no track-number tag, (1) it assigns spurious track numbers for titles including multiple digits, and (2) typically I’d expect the track number to appear at the beginning of the filename, not at its end.

The attached experimental patch removes the track-number generation feature entirely. In result, tracks without a track-number tag are displayed without a track number and alphanumerically sorted by track title (not filename!).

This has the following effects:

* For tracks that do have a track number in their tags, nothing changes.

* For tracks that have no track number in either the tags or the file name, no spurious track number is generated and used for displaying / sorting. These tracks are now sorted by track title (the tagnavi.config default).

* For tracks that do have a track number in their file name (but not in their tags), this information is not used any longer and the tracks are now sorted by track title as well.

Arguably, tracks without a track-number tag by default could be sorted by the pathname of files, which often are organized and named in the intended track order. But this could be confusing as well and seems like just a another heuristic that’s prone to break. Also, users can use the file browser or define their own filename-based %format sort in tagnavi.conf. I’d argue against making this the default for DB views.

Please comment on which behavior you find most desirable. Thanks!

Closed by  sideral
2011-06-06 23:08
Reason for closing:  Accepted
Additional comments about closing:  

Committed a sanitized version as r29982

I’d like this committed; while I generally have my track numbers tagged, I’ve had some downright confusing behaviour when I’ve missed some and this heuristic has come into play.

Why not just remove the code, rather than using #if 0 ?

Not so fast, pondlife! :) The “#if 0” is there tell that this patch is purely experimental. This isn’t a commit candidate, and I’m not ready to commit this yet.

On IRC, Slasheri (the original database author) has weighted in, conceding that the heuristic, like all heuristics, is not perfect, but he suggested making this feature configurable rather than outright removing it. This could either be a global configuration option or a new tagnavi %format conditional. (The database keeps track of which track numbers have been guessed from the filename, so making this distinction in the code is trivial.)

To me, the track-number guessing approach seems to be closely related to sorting by filename. The tracks of a typical MP3-album download are alphanumerically sorted, with the track number (being a filename component) providing the order. However, sometimes the filename does not start with the track number, but is preceeded with a CD number (in multivolume albums) or a release number, both of which contain digits as well. Thus, an alphanumeric filename order seems to be more robust than a track-number generation heuristic, but has the disadvantage that no (guessed) track numbers can be displayed to illustrate the track order. Barring that limitation, we can provide filename order using the same means as order by guessed track numbers: global config option or tagnavi %format (the latter is already possible today, but somewhat expensive in runtime cost).

I prefer removing the track-number heuristic altogether and offer filename sort via tagnavi. If we were to keep the track-number guessing feature, I’d like to change the heuristic to use the file name’s first few digits as the track number, rather than the last ones.

Any comments on the relative merits of the various approaches (remove track-number guessing; make the guessing configurable via a global option; allow the tagnavi %format to access guessed track numbers explicitly)?

I’d favour complete removal. The database is tag-based, so you do need reasonable tags.

If we were to offer a retagging plugin or somesuch, I’d be happy for such guesswork to be included in there (not that I’d use it).

MikeS commented on 2011-05-12 05:56

Perhaps OT, but why is the database so hard-core about tagging that it must display “<untagged>” instead of useful info like even a filename that would at least let me have _some_ useful information about the track without playing it? Let’s address annoying things more globally!

MikeS wrote:
> Perhaps OT, but why is the database so hard-core about tagging that it
> must display “<untagged>” instead of useful info like even a filename
> that would at least let me have _some_ useful information about the
> track without playing it?

That’s indeed quite offtopic for this item – which is why I have opened a new task  FS#12132  that addresses this request. :-)


Available keyboard shortcuts


Task Details

Task Editing