Okay, I have it working - not as hard as I imagined (for a novice Perl
programmer!).
It will probably a good idea to add an option to turn this restore feature
on/off (or maybe pick from a list of guess options...).
I was just going to get it to work for my situation first and then think about
how to make it work for others. There could be all sorts of alternative
situations - I've rather stupidly moved some albums into completely different
folder structures, (such as for compilations, soundtracks and classical).
Those I will probably correct with search/replace in the xml file. I've also
changed some file names, where I had saved them as "track num - title" (eg.
singles don't have a track num) - don't care too much about losing stats for
those.
I may change the code to also not match the file extension - I've re-ripped
some of my previous .mp3 rips as .flac over the last year. The url will be the
same, except for file extension.
I don't think it's possible to catch every case - for now just wanted to catch
the majority for me.
Other more generic solutions could be:
1) search for ever-decreasing sub-folder paths (chop a sub-folder from the left
side on each search attempt until a match is found - however there could be
several albums with the same track number an name but are different
albums/artists).
2) add several like conditions for each sub-folder (sort of where url like
'%sub-folder1%' and url like '%sub-folder2%' and url like '%sub-folder3%')?
3) trackstat backup/restore could store enough tag info to identify the song
(eg. the artist, album, song, tracknum info) instead of a url?
I have done one test run, with a lot of debug info being written to the log,
and it took over 30 mins (still running now...). You're right - performance
isn't critical for this (can leave restoration running over night).
Note also that I tried to use your "Library Rating Statistics" custom browse
view whilst the restore was running (to predict how long it was going to take
based on how many rated tracks it had found), and got the following error:
Error:
Running: select 1,concat("Rated Songs: ",count(distinct id)) from tracks where
audio=1 and rating>0 got error:
Unknown column 'rating' in 'where clause'Running: select 1,concat("Unrated
Songs: ",count(distinct id)) from tracks where audio=1 and (rating=0 or rating
is null) got error:
Unknown column 'rating' in 'where clause'
I thought this was working very recently in SC7.3 - is it possible this doesn't
work when a restore is in progress, or is something just broke with latest SVN?
Phil
_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/lists/listinfo/plugins