Inteligent playlists

Viewing 3 posts - 11 through 13 (of 13 total)
  • Author
    Posts
  • #7576
    fizze
    Participant

    very nice. ๐Ÿ™‚

    one problem though:
    if a song is NOT played since the last update, it is inserted into the log-db with the same time. This wont give an error since the song ID isnt a primary key. (ouch).

    both fields should be primary keys. Also, you maybe dont want to use the ID of firefly since that can change with DB versions and more or less songs in the library. Depending on how ‘static’ youd library is however, this might not be a problem.

    To insert, you have to use a cursor and check the latest playtime, and if its different, insert the new entry.
    otherwise you’d get lots and lots of bogus data from songs that were not played.

    I donno if sqlite is capable of triggers and ‘smart’ indices, but triggering would be a lot more sophisticated & elegant. ๐Ÿ˜‰

    #7577
    riro
    Participant

    @fizze wrote:

    if a song is NOT played since the last update, it is inserted into the log-db with the same time. This wont give an error since the song ID isnt a primary key. (ouch).

    Since the unix timestamp is created every time the script runs “echo LASTRUN…” I dont see how this could happen.

    I run the insert-script once every 12 minutes… I use it to audio-scrobble. And I haven’t seen any problems yet.

    #7578
    fizze
    Participant

    ah, got it. this is what you use LASTFILE for.
    nice. ๐Ÿ™‚

Viewing 3 posts - 11 through 13 (of 13 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.