Erland, I am wondering if my data is corrupted, or if I just don't
understand the model. I was fooling around with some queries and noticed
this, which I felt like was anomaly.
Code:
--------------------
select 'track_statistics', count(*) from track_statistics
union
select 'tracks', count(*) from tracks
'track_statistics' count(*)
track_statistics 38629
tracks 22773
--------------------
I would have expected those to be one to one. I ran Delete Unused
Statistic but got the same results. In fact I ran the following query
but didn't get any rows:
Code:
--------------------
select *
from track_statistics
where track_statistics.url not in (select url from tracks)
--------------------
Baffled, I did a little digging. Here's a sample of one track in
particular from track_statistics:
Code:
--------------------
url;musicbrainz_id;playCount;added;lastPlayed;rating;urlmd5
file:///storage/music/flac/AC%20-%20DC/Back%20in%20Black/02%20-%20Shoot%20to%20Thrill.flac;3931e32f-debc-423a-8e1e-91d058f7dd1f;10;1388541995;1388863178;;6f6f9bb7178fe6e49dd035a9bfbbaf87
file:///storage/music/flac/AC%20-%20DC/Back%20in%20Black/02%20-%20Shoot%20to%20Thrill.flac;3931e32f-debc-423a-8e1e-91d058f7dd1f;2;1274784902;1282497730;;6f6f9bb7178fe6e49dd035a9bfbbaf87
--------------------
It strikes me that all the keys (url, musicbrainz_id and urlmd5) are the
same, yet these seemingly identical tracks were added different times,
have different playcounts and different lastPlayed? I ran this:
Code:
--------------------
select count(*), url, musicbrainz_id, sum(playCount) as playCount, min(added)
as added,
max(lastPlayed) as lastPlayed, max(rating) as rating, urlmd5
from track_statistics
group by url, musicbrainz_id, urlmd5
having count(*) > 1
order by count(*) desc
--------------------
This returned 389 rows, with a counts as high as 477 (!) and as low as
2.
For my AC/DC example above I saw that they had different playcounts. I
found a track that had 80 "dupes" and played it, then I saw that all 80
rows for that URL were updated with a playcount of 1. Frankly that
makes more sense to me, as a likely outcome of something like UPDATE
TRACK_STATISTICS SET PLAYCOUNT=PLAYCOUNT+1 WHERE URL=someURL...I think
it is more odd that some of the "dupes" actually have different data.
What do you think? Is this normal or do I need to do some cleanup?
Thanks for the wonderful plugins, I am a database guy and love being
able to interact with my music via SQL.
' Most Recent Tracks'
(http://www.last.fm/user/thing-fish/?chartstyle=basicrt10)
------------------------------------------------------------------------
thing-fish's Profile: http://forums.slimdevices.com/member.php?userid=5288
View this thread: http://forums.slimdevices.com/showthread.php?t=49483
_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/plugins