<?sphp $this->text('pagetitle') ?>
 
Home of the Squeezebox™ & Transporter® network music players.

NewScanner

From SqueezeboxWiki

Revision as of 07:53, 23 June 2010 by Soulkeeper (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

8.0 Scanner Improvements

The scanner in 8.0 is being completely rewritten. The major goals of this are:

  • Improved performance.
  • Better support for handling deleted and changed files.
  • Automatic detection and rescanning of new/deleted/changed files.
  • Support rescanning in-process without launching the separate scanner.

Performance

Scanning of file metadata and tags accounted for approx. 1/3 of the scan time in prior versions of SqueezeCenter. All the Perl-based file scanning modules have been replaced by a single C-based module, Audio::Scan. This reduces this metadata/tag reading time to a much smaller fraction of the scan process. The rest of the scan time is taken in the Perl database abstraction layer (DBIx::Class), and remains generally unchanged.

Scan Types

There are now 3 ways in which your library can be scanned:

  • Wipe & Rescan, either via the web, or command-line scanner.pl --wipe
  • Manual scan for changes, either via the web, or command-line scanner.pl --rescan
  • Automatic rescan of a subset of your library that has changed.

During a rescan (manual or automatic), the scanner now makes 3 separate passes over your files. These passes are:

  • Remove files that have been deleted.
  • Add new files.
  • Rescan changed files. Files are considered changed if either their mtime or file size differs from the last time the file was scanned.

Auto-Rescan

Auto-rescan is supported in several different ways depending on the platform and location of the music library.

Platform Local Files Network share (SMB/NFS/etc)
Linux Yes Yes
Mac OSX Yes Yes
Windows Soon If possible

For detecting local file changes, the following platform-specific methods are used:

  • Linux - inotify (via Linux::Inotify2)
  • Mac OSX 10.5+ - FSEvents (via Mac::FSEvents)
  • Mac OSX 10.3-10.4 - Less efficient stat-based monitoring (using threads)
  • Windows - ChangeNotify (via Win32::ChangeNotify)

Detecting changes on a network share can only be achieved by stating every file at regular intervals. Linux and Mac make use of the IO::AIO module to perform this check using many parallel threads. Unfortunately, this is not supported on Windows, so it is unknown yet whether or not auto-rescan will be supported on network shares under Windows.

Debugging

If you have problems with the scanner, enable the following debug settings:

  • scan.scanner
  • scan.auto

More verbose debug info is available with:

  • database.info

Todo

Things that are not yet completed:

  • Stat-based auto-rescan detection
  • Windows auto-rescan detection
  • Browse Music Folder migration to new scanner code