Re: Add pre-scan task?

AF1 <AF1.ahseoo-NUepA2SMhDQqspMVqqL2D+4xXEVPTSb/[email protected]> Thu, 24 Mar 2022 10:39:05 +0000
Newsgroups gmane.music.equipment.slimdevices.devel
Organization Logitech Squeezebox Forums
Message-ID <[email protected]>
mherger wrote: 
> 
> > One example I can think of: if the user decides to rescan, a plugin
> > could ask LMS to create a backup of the plugin data first before
> > starting the scan process.
> 
> That should work just fine using the above method.

Code:
--------------------
    sub initPlugin {
  
Slim::Music::Import->addImporter
  
  if (main::SCANNER) {
  	unless (!Slim::Schema::hasLibrary()) {
  		createbackup();
  	}
  }
  ...
  }
--------------------


So for the purpose of creating a pre-scan backup, the order of the
commands above would be ok in the initPlugin part (or was it the
postInitPlugin part)?

And am I correct to assume that because LMS is single-threaded, the scan
process will wait for createBackup to finish? Is there any (hard-coded)
time-out that applies -at this pre-scan stage- of the importer, in case
the backup takes a bit longer?

And what if, for some reason, createBackup throws an error? Will that
make the whole scan process fail?



*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