afriend wrote: 
> 
> So the music file was deleted manually without a rescan afterwards? When
> I do track->rating to *get* a track rating does LMS check if the file
> exists? Or do you have to perform some (failed) action on it before it's
> marked dead?
> 
track->rating just reads the database, it does not check if the file
exist.
If a track has been removed and you perform a rescan the entry will be
removed from tracks table but it will remain in track_persistence. In
this situation objectForUrl would return undef

afriend wrote: 
> 
> I guess when the backup function does
> -$track =
> Slim::Schema->resultset("Track")->objectForUrl($BACKUPtrackURL);-
> it would return undef and I could catch this. 
> 
Yes

afriend wrote: 
> 
> Since I use SQL to set the trackrating directly in the persistent
> database and not -$track->rating- to *set* the rating, I'm not sure if
> the restore function would mind processing urls for missing tracks.
> 
> Anyway, will look into it.
As an alternative to check for undef, you could probably read the rating
using SQL directly from track_persitence also. Reading directly from
track_persitence would work, going through a $track object won’t work
since there isn’t an entry in tracks table. It depends if you want the
backup to contain information for all previously renamed/moved/deleted
tracks or not. 

In normal situation a user is probably not interested to keep
information for deleted tracks. The only situation when it could be
useful is if you move all the music to a new disc/path and doesn’t do a
backup before the move. In this situation LMS would loose all ratings
since all file URLs are changed, but if the user could do a backup to
export the information they could do a “replace all” in a text editor of
the backup file and restore it to restore the ratings. However, this is
a corner case, in normal situation the user should have a backup file
from before the move and could just use that. I think my suggestion
would be to instead do filtering of undef when creating the backup and
only store ratings for tracks that exist in tracks table.



Erland Isaksson ('My homepage' (http://erland.isaksson.info))
Developer of 'many plugins/applets'
(https://wiki.slimdevices.com/index.php/User_Erland.html)
*Starting with LMS 8.0 I no longer support my plugins/applets* ('see
here for more information'
(https://forums.slimdevices.com/showthread.php?49483-Announce-New-versions-of-erlands-plugins&p=998836&viewfull=1#post998836)
)
------------------------------------------------------------------------
erland's Profile: http://forums.slimdevices.com/member.php?userid=3124
View this thread: http://forums.slimdevices.com/showthread.php?t=113344

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

Reply via email to