>I think you will get the correct behavior if you add your code just
>before the "if($ignoreTrackInSlimserver)" instead of inside that
>if-statement. This should be the case for both saveTrack and
>addToHistory.
>
>I need to look at this a bit into more detail, but I also think the
>call to saveTrack in Backup/File.pm should be changed so it sends 1 in
>the $ignoreTrackInSlimserver parameter. A restore should really restore
>the data independent if the track exists in SqueezeCenter or not.
>
I think you are saying that you believe the $ignoreTrackInSlimserver should be 
redundant in sub addToHistory.  I agree - Backup/Restore should just 
export/import the data.  Old data can be purged before Backup or after Restore. 
 So I have removed the $ignoreTrackInSlimserver from addToHistory.

I had a look around to see where saveTrack is called from.  It's only called 
from Backup\File.pm restoreTrack, and doesn't pass anything for 
$ignoreTrackInSlimserver

In sub saveTrack, after finding the track object for the given url, the code 
calls Plugins::TrackStat::Storage::findTrack($url, 
$mbId,$track,$ignoreTrackInSlimserver).  findTrack is called without passing 
anything for $ignoreTrackInSlimserver in several other places.  It seems like 
it is not necessary to pass a $ignoreTrackInSlimserver parameter into 
saveTrack, and remove it from findTrack too, to simplify the logic.  I haven't 
modified this yet though.

>So I bet the situation is as follows:
>1. The restore operation restored track_statistics with the new
>alternative paths
>2. The restore operation restored track_history with the old paths
>3. The refresh operation created new track_history entries based on the
>information in track_statistics.
>
This sounds correct.  I guess I don't need to worry about invalid track_history 
paths - I can purge them eventually (when the purge functionality works!).  
I'll just try to import again, having hopefully fixed the addToHistory issue.  
I believe that it won't import duplicates for rows that already exist.

Phil
_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/lists/listinfo/plugins

Reply via email to