Hello
I had a scripting problem and I didn't understand why it wasn't working. After testing several things, I saw that when adding a new SongData to the Player's playlist (using SDB.NewSongData, without adding to the library) for an external audio file, the SongID is -1 as it should be, but IsntInDB is wrong (either false, or some similar value, definitely not true).
When I change "Not Item.IsntInDB" by "Item.SongID > -1", it works fine.
Normally these 2 things should be identical, no?
Cheers
Steegy
"Item.SongID > -1" isn't the same as "Not
Moderator: Gurus
"Item.SongID > -1" isn't the same as "Not
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
Ok, but the track that I add to the playlist is an external track (added using a new SongData object and filled the path, artist and title), that is not in the library/database. So shouldn't the 'IsntInDB' property be true then?
Adding external tracks to the Now Playing list (by drag&drop) sets the IsntInDB property to true.
However, if I add them through code (new SongData, without using UpdateDB or so), then the IsntInDB property is not true.
There are no songs with ID = -1 (or without ID) in my Songs table, and I haven't found any occurence of these external tracks in the library.
BTW: This is about the "SaveAndRestoreNowPlaying" script, that I pm'ed you about some time ago.
Anyway, that part of the code works now, but it can be useful to fully understand why this behaviour of MM is happening.
Thanks
Steegy
Adding external tracks to the Now Playing list (by drag&drop) sets the IsntInDB property to true.
However, if I add them through code (new SongData, without using UpdateDB or so), then the IsntInDB property is not true.
There are no songs with ID = -1 (or without ID) in my Songs table, and I haven't found any occurence of these external tracks in the library.
BTW: This is about the "SaveAndRestoreNowPlaying" script, that I pm'ed you about some time ago.
When would this be then?SongID can be -1 even if track is in database, but MM doesn't know about it yet.
Anyway, that part of the code works now, but it can be useful to fully understand why this behaviour of MM is happening.
Thanks
Steegy
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
Let me try to give you an example:
1. You add a track to Now Playing with SongID=-1, IsntInDB=false, Path=C:\music\x.mp3
2. MM starts a thread and so _later_ it finds out whether this track is in DB:
2a. Track is in DB => SongID=n (n>0), IsntInDB=false
2b. Track isn't in DB => SongID=-1, IsntInDB=true
In other words:
IsntInDB = true: We are sure that this track isn't stored in Library, i.e. we have already made an SQL query and it wasn't there.
IsntInDB = false: If SongID>0 then track is clearly in Library, if SongID=-1 then we don't know anything yet.
I can also add that device plug-ins use this property to Set (i.e. they don't read it) that a track isn't in library and thus make MM operations faster - MM doesn't need to execute a SQL query about such a track.
Jiri
1. You add a track to Now Playing with SongID=-1, IsntInDB=false, Path=C:\music\x.mp3
2. MM starts a thread and so _later_ it finds out whether this track is in DB:
2a. Track is in DB => SongID=n (n>0), IsntInDB=false
2b. Track isn't in DB => SongID=-1, IsntInDB=true
In other words:
IsntInDB = true: We are sure that this track isn't stored in Library, i.e. we have already made an SQL query and it wasn't there.
IsntInDB = false: If SongID>0 then track is clearly in Library, if SongID=-1 then we don't know anything yet.
I can also add that device plug-ins use this property to Set (i.e. they don't read it) that a track isn't in library and thus make MM operations faster - MM doesn't need to execute a SQL query about such a track.
Jiri