Hi Sonos .. Hi Ian
yes MM database is a a SQLITE database.
and the PLAYED table contains details of every play, but there needs to be some caution taken before relying on it.
MM does not appear to use this data except for in the Statistics report AFAIKS.
It if a bit like a midden pit where they dump their waste and by-products.
The database appears to have no referential integrity measures that ensure the sum of Played plays bears any relation to the counts in the Songs table. The User Community tools that import external plays into MM, or allow play history corrections, typically ignore the Played table.
MM date formats in the database are a bit of a jumble for historic reasons. The date played fields are in Julian Date format.
SQLITE has function that will deal with Julain Dates:
https://www.sqlite.org/lang_datefunc.html
eg.
select strftime('%Y/%m/%d %H:%M:%S',(julianday(LastTimePlayed) + 2415018.5),'localtime')
from songs
where album collate nocase = 'Citizen of Glass'
It is easier to read them, than write them.
I add my Sonos plays, and my away-from-home plays from my Last.fm account, into MM, just for the sake of completeness.
So I now have 340,000 records of bloat sitting in my Played table, accumulated over 12+ years ... but maybe you are creating some purpose for them?
Hi Sonos .. Hi Ian
yes MM database is a a SQLITE database.
and the PLAYED table contains details of every play, but there needs to be some caution taken before relying on it.
MM does not appear to use this data except for in the Statistics report AFAIKS.
It if a bit like a midden pit where they dump their waste and by-products.
The database appears to have no referential integrity measures that ensure the sum of Played plays bears any relation to the counts in the Songs table. The User Community tools that import external plays into MM, or allow play history corrections, typically ignore the Played table.
MM date formats in the database are a bit of a jumble for historic reasons. The date played fields are in Julian Date format.
SQLITE has function that will deal with Julain Dates: https://www.sqlite.org/lang_datefunc.html
eg.
select strftime('%Y/%m/%d %H:%M:%S',(julianday(LastTimePlayed) + 2415018.5),'localtime')
from songs
where album collate nocase = 'Citizen of Glass'
It is easier to read them, than write them.
I add my Sonos plays, and my away-from-home plays from my Last.fm account, into MM, just for the sake of completeness.
So I now have 340,000 records of bloat sitting in my Played table, accumulated over 12+ years ... but maybe you are creating some purpose for them?