Music Database song id's help
#1
I'm hoping one of the Dev's (or someone else) who looks after the music database could give me a little help.

My end goal is to add a "recently added singles" node for one of my machines which is only just used as a big jukebox.

First hurdle and i'm alittle stumped!

I'm trying to stop the re-ordering of idSong in the song table. Currently when you add a new song and the artist doesn't exist in the database it just adds the song to the end of the table using the next highest free idSong, but if you add a new song by an artist which already exists in the database the song id's will re-order all songs by that artist to use the next highest free idSongs. So at the mo there is no info to build a query because idSong changes and is not incremented just as new songs are added.

I've commented out x amount of stuff from musicdatabase.h & cpp and still can't find it!!

So if anyone can point in the right direction to stop the automatic re-ordering i'd be very grateful.

Thanks
Reply
#2
The field is a primary key and is not specified in the query, thus will auto-increment. You want to instead use the dateadded field (assuming there is one).
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#3
Thanks for the replay.

Unfortunately there is no date added in the music db like there is in the video db.

As you said, idSong auto increments as you add new songs (perfect), But when adding another new song by an artist thats already in the db the id's get updated & grouped for that artist & put at the end of the table.

eg If i scan in 20 songs by 20 different artists & coldplay-yellow is idSong 10 & then if i add another coldplay song (say, princess of china) both coldplay songs are put the end of the table, Yellow now has an id of 21 & princess of china now has an id of 22. Where as in an ideal world yellow would stay as id 10 & princess of china would be 21. It's this re grouping i cant seem to find so i can stop it, and then do a query using idSong for recently added.

I am a not very skilled when it comes to the old source code thing, but i am learning fast & do appreciate any help.

Reply
#4
It's actually for the folder of files for which it changed. When a folder is rescanned (due to a changed tag) we remove all songs from the database (and all links to them) and then re-add them all. It doesn't necessarily have anything to do with artists, except for the fact that most folk organise the music on their filesystem according to artists.

It would be quite a bit of work to change this behaviour. See CMusicDatabase::RemoveSongsForPath() for how it all works (along with MusicInfoScanner.cpp).

Cheers,
Jonathan
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#5
Thanks Jonathan.
Reply

Logout Mark Read Team Forum Stats Members Help
Music Database song id's help0