Re: [SlimDevices: Plugins] Tidying TrackStat tables

2010-11-06 Thread chris67

Well, clearing the trackstat data and restoring from backup seems to
have done the trick...mostly.  It has certainly managed to match files
where just the extension has changed.  So thanks for that advice Phil.

Mental note to self - leave the music folder structure alone!


-- 
chris67

It's like, how much more black could this be?  And the answer is none. 
None more black.

chris67's Profile: http://forums.slimdevices.com/member.php?userid=19448
View this thread: http://forums.slimdevices.com/showthread.php?t=83051

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Tidying TrackStat tables

2010-11-04 Thread chris67

Philip Meyer;587043 Wrote: 
> From memory, I think it ignores the file extension, so if you had
> re-encoded an album from .flac into .mp3, I think it would re-attach
> the stats.

If that's the case, problem sorted.  I shall kick off a clean and
rescan to run overnight and then restore statistics tomorrow morning. 
Hopefully it'll have finished when I get home from work and I can post
the result.

BTW, I'd like to point out that I've re-ripped to flac rather than
re-encoding to mp3.  I want to be able to read the audiophile forum
with my head held high... :-)


-- 
chris67

It's like, how much more black could this be?  And the answer is none. 
None more black.

chris67's Profile: http://forums.slimdevices.com/member.php?userid=19448
View this thread: http://forums.slimdevices.com/showthread.php?t=83051

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Tidying TrackStat tables

2010-11-04 Thread Philip Meyer

chris67;587040 Wrote: 
> The "Find alternative files" will not, I think, work for me as the vast
> majority of the changed files are .flac rather than .mp3.  I assume
> that the file extension must be the same?
> Chris
>From memory, I think it ignores the file extension, so if you had
re-encoded an album from .flac into .mp3, I think it would re-attach
the stats.

I think this is what it was doing before I extended the comparison
rules, such that it also find files that shared the same the end-part
of the url including the last two sub-folders and filename (minus
extension).

eg. if you had a file:

C:\music\pop\led zeppelin\IV\01 - Battle Of Evermore.flac

and had moved it to:

C:\music\ROCK\led zeppelin\IV\03 - Battle Of Evermore.mp3

It would find the stats, and re-attach to the correct url, because
"\led zeppelin\IV\03 - Battle Of Evermore." matched.

I believe this was working when I implemented.  I might be wrong though
;-)  You'll have to try it.

Hence why I suggested the backups and comparisons to test it.
Please let me know how you get on!

Phil


-- 
Philip Meyer

Philip Meyer's Profile: http://forums.slimdevices.com/member.php?userid=95
View this thread: http://forums.slimdevices.com/showthread.php?t=83051

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Tidying TrackStat tables

2010-11-04 Thread chris67

Thanks for the prompt responses.  It always impresses me that people are
so willing to give their time on this forum.

The "Find alternative files" will not, I think, work for me as the vast
majority of the changed files are .flac rather than .mp3.  I assume that
the file extension must be the same?

> How do you intend to "identify record with new location/file name" ?

Using MS Access and VBA (having linked the appropriate tables from the
SBS database).  Step through each record and check whether the file
referenced by the url field still exists.  If not, take some action...

> if you have musicbrainz tags in your file, but I'm guessing this
isn't the case in your library ? 

Not until just recently so a lot of the TrackStat records have blank
musicbrainz fields...  (>_<)

I like Phil's ideas where I don't have to manipulate the database
directly.  If I were to use the server trace log to see what urls could
not be restored, do I need to change any logging settings from their
default to ensure this information is recorded?

Just out of interest, what role does the tracks_persistent table have? 
Does the TrackStat plugin update it?

Chris


-- 
chris67

It's like, how much more black could this be?  And the answer is none. 
None more black.

chris67's Profile: http://forums.slimdevices.com/member.php?userid=19448
View this thread: http://forums.slimdevices.com/showthread.php?t=83051

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Tidying TrackStat tables

2010-11-03 Thread Phil Meyer
>Maybe I am making this too complicated and there is a far easier
>method.  Have I missed a "tidy-up" button?
I think perhaps you have missed the "delete unused statistics" option (within 
Settings > Advanced > TrackStat > Backup/Restore/Clear).

This is what I do from time to time:

1. Backup trackstat stats to a file (Settings > Advanced > TrackStat > 
Backup/Restore/Clear > Backup to file)
2. Do a full clean+rescan of the SBS music library.
3. Restore trackstat stats from file.  This can automatically reconnect stats 
for urls that have changed (see "Find alternative files" option).
Look in the server trace log to see what urls could not be restored/re-attached 
to alternative urls.
You could correct these urls in the backup file (eg. maybe a few global 
search&replace operations to correct the majority of moved files), and then 
restore again.

Alternatively/additionally:

4. Make a new backup.
5. Delete unused statistics (removes all of the stats that don't match urls).
6. Rename the backup file from step 4, and make a new backup.
7. Compare the backup from step 4 against backup from step 6 to see what unused 
statistics were purged - can tweak the urls in the step 4 backup and restore.
___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Tidying TrackStat tables

2010-11-03 Thread erland

There is a "Delete unused statistics" button in the backup section of
TrackStat settings pages, but that will only delete all entries which
doesn't refer to an existing file name. So it will delete more than
your suggested approach. Still, it would only delete entries which
aren't used today, TrackStat only uses entries with paths that matches
an entry in the SBS library.

If you can also do an:
1. TrackStat backup
2. TrackStat "Remove all data"
3. TrackStat restore

The restore operation will by default try to find the correct
references by searching for paths that ends exactly the same if you
have the "Find alternative files" option checked in the TrackStat
settings page. However, please note that this operation takes a lot of
time, so in a large library the restore can take several days. This
process will find entries if you have kept the structure by moved the
library from C: to D: for example.

How do you intend to "identify record with new location/file name" ?
Was your idea to do that manually or do you have some automatic process
in your mind ?

The refresh operation in TrackStat will correct any incorrect paths if
you have musicbrainz tags in your file, but I'm guessing this isn't the
case in your library ?


-- 
erland

Erland Isaksson ('My homepage' (http://erland.isaksson.info))
(Developer of 'many plugins/applets'
(http://wiki.slimdevices.com/index.php/User:Erland). If my answer
helped you and you like to encourage future presence on this forum
and/or third party plugin/applet development, 'donations are always
appreciated' (http://erland.isaksson.info/donate))

erland's Profile: http://forums.slimdevices.com/member.php?userid=3124
View this thread: http://forums.slimdevices.com/showthread.php?t=83051

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


[SlimDevices: Plugins] Tidying TrackStat tables

2010-11-03 Thread chris67

Over the past few years, I have made numerous changes to my music
library, mostly by re-ripping CDs and encoding to flac rather than mp3.
Because I did not tag files with Musicbrainz Ids until recently, the
TrackStat tables have a lot of records which relate to non-existent mp3
files.  I'd really like to sort this out and by doing so, make my
listening statistics accurate.  Damn this obsessiveness!

So, can anyone comment on my plan?  I reckon I can automate most of the
following using Visual Basic and manipulating the Squeezebox Server
database through an ODBC connection.  Go for it?  Not recommended? 
Don't do it under any circumstances?

1. Update track_history table: identify urls which no longer exist and
change url field to reflect new location/file name.  

2. Update track_statistics table: identify urls which no longer exist.
If playcount field is null, delete record; otherwise identify record
with new location/file name, update playcount field and then delete the
original (incorrect url) record.

3. Backup TrackStat data via web interface

4. Delete MySQL database so Squeezebox Server creates brand new one

5. Restore TrackStat data - I assume this would populate
tracks_persistent table?  Or is that not necessary?

Maybe I am making this too complicated and there is a far easier
method.  Have I missed a "tidy-up" button?

Thanks for any help/advice.


-- 
chris67

It's like, how much more black could this be?  And the answer is none. 
None more black.

chris67's Profile: http://forums.slimdevices.com/member.php?userid=19448
View this thread: http://forums.slimdevices.com/showthread.php?t=83051

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins