Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Calculate short, alphanumeric unique track ID (Read 2406 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Calculate short, alphanumeric unique track ID

I'm searching a short way to uniquely identify any given track in my music collection by a short, unique and alphanumeric ID [A-Za-z0-9-]. (Reason: see signature.)
Ideally, I would like it to be human readable, or at least interpretable, so that a track could at be recognised among a short sequence of those IDs. I have come up with the following title formatting string that I use with foo_dynfil to calculate a field %_uid%:

Code: [Select]
$replace(
$if2(%release%,$lower($abbr($ascii(%album artist% %album%),6)))
$right(%date%,2)
$lower($left($abbr($ascii(%title%)),2))
$ifgreater(%totaldiscs%,1,%discnumber%,)%tracknumber%
,-,,?,,'',,",,/,,\,,!,,&,,:,,.,,+,,'(',,')',, ,,@,,'[',,']',,~,,#,,%,,_,,^,,|,,*,,$,)


On my 25000 track database it creates one collision, with an average length of 13.5 characters per song. Has anyone here done something similar already which is a) shorter and/or b) less likely to have collisions?


Calculate short, alphanumeric unique track ID

Reply #1
Would this work?

$crc32(%path%)

Calculate short, alphanumeric unique track ID

Reply #2
$crc32(%path%)

While it would certainly reduce collision probability dramatically, this approach fails in the category "human readable". Maybe I shouldn't have called it unique ID, but a DIY catalogue number, derived from basic tags like artist, album, disc-/tracknumber, title.

Calculate short, alphanumeric unique track ID

Reply #3
You can make a mix of both methods.
Start with some abbreviations as you do, and append a short CRC checksum (eg track title only).
"Human readable" however, seriously reduces the options, and often doesn't mix well with "short".