Re: Add pre-scan task?

AF1 <AF1.ahukgn-NUepA2SMhDQqspMVqqL2D+4xXEVPTSb/[email protected]> Fri, 25 Mar 2022 14:39:52 +0000
Newsgroups gmane.music.equipment.slimdevices.devel
Organization Logitech Squeezebox Forums
Message-ID <[email protected]>
mherger wrote: 
> Be careful with loading Plugin.pm from the importer: the scanner doesn't
> support all the modules the server would. In particular if you're using
> any kind of networking you might be facing problems. I usually create a
> Common.pm or similar module with code which can be shared between server
> and scanner.
True. Although I've managed to do without a common.pm so far, I need it
now. And it works fine.

mherger wrote: 
> That's often one solution, yes. But I'd probably go lower level to only
> wrap the potentially blocking call, eg. reading/writing a file. Try to
> understand what might be failing, and whether you can't cover that
> failure in a more controlled way. eval can be a dangerous beast,
> potentially hiding easy problems like typos. At the very least do log $@
> (which would have the eval's error).
Yes, totally agree. That was only an example. The createBackup function
already has eval fail safes with proper error logging.

About file paths: what's the safest way (considering escaping, special
chars, different OS peculiarities...) in Perl to get the *relative* path
of -local- files from the database file urls. So from
"file:///some/media/dir/artist/album/file.ext" to
"artist/album/file.ext".
Would you use -File::Spec- or -Path::Class- or something else? Ideally,
my backup would store relative paths. Then if users change the media dir
it would still be valid. 
But if users have > 1 media dir the plugin would have to test the
relative file paths from the old backup with each currently valid media
dir. If you're dealing with 1000s of urls, what's the fastest way to
check if a file url is valid, i.e. that the file at that url exists? 
Thank you.



*Plugin repositories:* 'Ratings Light'
(https://github.com/AF-1/lms-ratingslight) •••• 'Visual Statistics'
(https://github.com/AF-1/lms-visualstatistics) •••• 'Use Comment Tag
Info' (https://github.com/AF-1/lms-usecommenttaginfo) •••• 'Dynamic
Playlists 3 FAQ' (https://github.com/AF-1/lms-dynamicplaylists#faq) ••••
'Custom Skip 3 FAQ' (https://github.com/AF-1/lms-customskip#faq)
------------------------------------------------------------------------
AF1's Profile: http://forums.slimdevices.com/member.php?userid=39306
View this thread: http://forums.slimdevices.com/showthread.php?t=116160

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