Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 7 of 7
  1. #1
    Senior Member
    Join Date
    Jun 2005
    Posts
    381

    [Slim-Checkins] r8361 - in /trunk/server:Plugins/MusicMagic/Plugin.pmSQL/mysql/schema_clear.sql Slim/Music/Import.pm scanner.pl

    dsully (AT) svn (DOT) slimdevices.com wrote:
    > Author: dsully
    > Date: Mon Jul 10 14:10:41 2006
    > New Revision: 8361
    > Modified: trunk/server/Slim/Music/Import.pm
    > URL: http://svn.slimdevices.com/trunk/ser...8361&view=diff
    > ================================================== ============================
    > --- trunk/server/Slim/Music/Import.pm (original)
    > +++ trunk/server/Slim/Music/Import.pm Mon Jul 10 14:10:41 2006
    > sub stillScanning {
    > + # Return true if the process is still running, or the process is still
    > + # running and the flag is set in the db. Return false if the process
    > + # isn't running and the flag isn't set. Or if the process isn't
    > + # running and the flag is set, as setting the flag is the last thing
    > + # the scanner does.
    > + if ($running || ($scanning && $running)) {


    Logic problem:
    (r || (s && r)) == r

    What's the point of the flag again?

  2. #2
    NOT a Slim Devices Employee kdf's Avatar
    Join Date
    Apr 2005
    Posts
    9,493

    Re: [Slim-Checkins] r8361 - in /trunk/server:Plugins/MusicMagic/Plugin.pm SQL/mysql/schema_clear.sqlSlim/Music/Import.pm scanner.pl

    Another issue below with this change (prior to the change also),
    startScan() is no longer a function in Plugin.pm, so if the case is
    ever satisfied the server will crash.

    -kdf


    ================================================== ============================
    --- trunk/server/Plugins/MusicMagic/Plugin.pm (original)
    +++ trunk/server/Plugins/MusicMagic/Plugin.pm Mon Jul 10 14:10:41 2006
    @@ -298,10 +298,13 @@
    sub checker {
    my $firstTime = shift || 0;

    - return unless (Slim::Utils::Prefs::get('musicmagic'));
    -
    + if (!Slim::Utils::Prefs::get('musicmagic')) {
    + return;
    + }
    +
    my $change = 0;
    - if (!$firstTime && !stillScanning() && isMusicLibraryFileChanged()) {
    +
    + if (!$firstTime && !Slim::Music::Import->stillScanning &&
    isMusicLibraryFileChanged()) {
    startScan();
    }

  3. #3
    Senior Member
    Join Date
    Jun 2005
    Location
    Switzerland
    Posts
    610
    Quote Originally Posted by Grotus
    What's the point of the flag again?
    The point is to be able to know in slimserver when scanning is done, I think.
    Now assuming StillScanning worked before AND the solution is based on polling, then why not simply poll every N seconds to see if the process is still running?

    Fred

  4. #4
    Senior Member
    Join Date
    Jun 2005
    Posts
    381

    Re: [Slim-Checkins] r8361 -

    Fred wrote:
    > Grotus Wrote:
    >
    >>What's the point of the flag again?

    >
    >
    > The point is to be able to know in slimserver when scanning is done, I
    > think.
    > Now assuming StillScanning worked before AND the solution is based on
    > polling, then why not simply poll every N seconds to see if the process
    > is still running?


    The question is more about the use of the flag in the stillScanning
    method. He reads that flag from the database, but doesn't actually use
    it in determining the return value of stillScanning.

  5. #5
    Senior Member
    Join Date
    Jun 2005
    Location
    Switzerland
    Posts
    610
    If you read the comment, I think Dan meant

    ($running || ($scanning && !$running))

    we're scanning if the process is running.
    If it is not, then we're only scanning if the flag is set.

    The flag is however set during a global transaction... so another thread would only see it as 1 once the transaction is commited, which happens when scanning is done.
    Also it seems the flag is never reset to 0. There's a cleanup routine in scanner.pl which does that but I can't figure out if/when it is called.

    I am wondering if it would not be simpler just to poll for the existence of the scanner.pl process.

    Fred

  6. #6
    Perl Commando Dan Sully's Avatar
    Join Date
    Apr 2005
    Location
    Daly City, CA
    Posts
    2,864

    [Slim-Checkins] r8361 - in

    * Fred shaped the electrons to say...

    >The flag is however set during a global transaction... so another
    >thread would only see it as 1 once the transaction is commited, which
    >happens when scanning is done.


    Actually it's not.. it's set within a sub-transaction, which is commited immediately.

    >Also it seems the flag is never reset to 0. There's a cleanup routine
    >in scanner.pl which does that but I can't figure out if/when it is
    >called.


    It is run when the scanner process exits.

    -D
    --
    <dr.pie> 31336.5: the neighbor of the l33t

  7. #7
    Senior Member
    Join Date
    Jun 2005
    Location
    Switzerland
    Posts
    610
    Thanks for the explanation. Crystal clear.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •