PDA

View Full Version : Manually modifying database entries



zonkzonk
2007-07-08, 00:41
I want to take advantage of alphabetical sorting, but there are (at least) two issues:

(1) The wiki says that the behavior of ARTISTSORT, ALBUMSORT, and TITLESORT is undefined if multiple copies of the same tag are used in the same track (e.g. for a duet, you would want an ARTISTSORT for each ARTIST);

(2) There are no corresponding tags like COMPOSERSORT, CONDUCTORSORT, ORCHESTRASORT, BANDSORT.

I was just poking around in the internal database, and it looks pretty straightforward to get around these problems directly in there rather than by tags in the audio files themselves. For example, in the "contributors" table, just set the "namesort" column in each contributor's entry.

If I do this, are there any issues I have to watch out for?

What would happen, for example, if I set Johnny Cash's "namesort" to "CASH JOHNNY", but later get another Johnny Cash track that doesn't have an ARTISTSORT? Would Slimserver use my existing row, with the "CASH JOHNNY"? Or would it create a new row with ARTISTSORT set to "JOHNNY CASH"? Or would it wipe out my existing row's ARTISTSORT with its "JOHNNY CASH"? Or would it just blow up? Or what?

I assume that if I do a "clear library and rescan everything", I'll wipe out any such manual changes, but that's something I can deal with.

Thanks in advance for any help.

erland
2007-07-08, 01:16
I was just poking around in the internal database, and it looks pretty straightforward to get around these problems directly in there rather than by tags in the audio files themselves. For example, in the "contributors" table, just set the "namesort" column in each contributor's entry.

If I do this, are there any issues I have to watch out for?

The information in the database is updated by SlimServer internally at least during the following operations:
1. When you perform a scanning
- "clear library and rescan everything" will for sure wipe out all information you have entered manually in the SlimServer tables
- I'm not sure how "new and changed files" scanning will work regarding artist sort columns, but I suspect that it will overwrite any information if there are ARTISTSORT tags in the scanned files. I'm not sure if it will empty the sort column in the database if the ARTISTSORT tags is missing, but I suspect it won't.

2. When you "browse by folder" and browse to a track that hasn't been scanned before. I think this works the same way as a normal scanning for "new and changed files".

3. During scanning at regular intervals if you are using the iTunes or MusicMagic integration. I think this works the same way as a normal scanning for "new and changed files".

If you have some development skills I would suggest that you do it as follows:

1. Create a new table in the database, which contains "artist name" and "artist sort name". This table won't be cleared during rescans, so any information you enter in it will still be there after a rescan has been performed.

2. Create a simple plugin that:
- Subscribes on the "rescan done" event
- When the callback is called it copies the information from your custom table to the standard "CONTRIBUTORS" table.
- The synchronization can also be called at SlimServer startup, this way you can just restart slimserver after you have changed some values in your custom table.

There is a plugin that has all the subscribe and slimserver restart mechanism already finished in the following thread, so you can use it and just replace the SQL statement to one that copies the information from your table to the contributors table.
http://forums.slimdevices.com/showthread.php?p=202837#post202837


What would happen, for example, if I set Johnny Cash's "namesort" to "CASH JOHNNY", but later get another Johnny Cash track that doesn't have an ARTISTSORT? Would Slimserver use my existing row, with the "CASH JOHNNY"? Or would it create a new row with ARTISTSORT set to "JOHNNY CASH"? Or would it wipe out my existing row's ARTISTSORT with its "JOHNNY CASH"? Or would it just blow up? Or what?I'm not sure exactly how this works, but I don't think it will create a new row. Hopefully someone else that knows how this works exactly sees this thread and can give you an answer to this.