From 961aafff45a1b94990f9dcb4bae45196fa1a0b71 Mon Sep 17 00:00:00 2001 From: ronaldz Date: Wed, 25 Feb 2015 21:19:47 -0500 Subject: [PATCH 1/4] Maximum was miss-spelled in the local Scan command's help text --- mopidy/local/commands.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mopidy/local/commands.py b/mopidy/local/commands.py index a9920ec8..ba34b22b 100644 --- a/mopidy/local/commands.py +++ b/mopidy/local/commands.py @@ -61,8 +61,7 @@ class ScanCommand(commands.Command): super(ScanCommand, self).__init__() self.add_argument('--limit', action='store', type=int, dest='limit', default=None, - help='Maxmimum number of tracks to scan') - + help='Maximum number of tracks to scan') def run(self, args, config): media_dir = config['local']['media_dir'] scan_timeout = config['local']['scan_timeout'] @@ -121,7 +120,9 @@ class ScanCommand(commands.Command): logger.info('Scanning...') uris_to_update = sorted(uris_to_update, key=lambda v: v.lower()) + print("Before: ", uris_to_update) uris_to_update = uris_to_update[:args.limit] + print("After: ", uris_to_update) scanner = scan.Scanner(scan_timeout) progress = _Progress(flush_threshold, len(uris_to_update)) From 87ea3c974557c484b4831084167f2c00c45e8a13 Mon Sep 17 00:00:00 2001 From: ronaldz Date: Wed, 25 Feb 2015 21:36:02 -0500 Subject: [PATCH 2/4] Added a --force argument. Related to issue #910 --- mopidy/local/commands.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mopidy/local/commands.py b/mopidy/local/commands.py index ba34b22b..80ce5c1d 100644 --- a/mopidy/local/commands.py +++ b/mopidy/local/commands.py @@ -62,6 +62,9 @@ class ScanCommand(commands.Command): self.add_argument('--limit', action='store', type=int, dest='limit', default=None, help='Maximum number of tracks to scan') + self.add_argument('--force', + action='store_true', dest='force', default=False, + help='Force rescan of all media files') def run(self, args, config): media_dir = config['local']['media_dir'] scan_timeout = config['local']['scan_timeout'] @@ -95,8 +98,8 @@ class ScanCommand(commands.Command): mtime = file_mtimes.get(abspath) if mtime is None: logger.debug('Missing file %s', track.uri) - uris_to_remove.add(track.uri) - elif mtime > track.last_modified: + uris_to_remove.add(track.uri) + elif mtime > track.last_modified or args.force: uris_to_update.add(track.uri) uris_in_library.add(track.uri) @@ -120,9 +123,7 @@ class ScanCommand(commands.Command): logger.info('Scanning...') uris_to_update = sorted(uris_to_update, key=lambda v: v.lower()) - print("Before: ", uris_to_update) uris_to_update = uris_to_update[:args.limit] - print("After: ", uris_to_update) scanner = scan.Scanner(scan_timeout) progress = _Progress(flush_threshold, len(uris_to_update)) From b2976dccb6a0368f9c682ed6d0439edf68e35883 Mon Sep 17 00:00:00 2001 From: ronaldz Date: Sun, 1 Mar 2015 14:40:08 -0500 Subject: [PATCH 3/4] Trailing white space and expected blank line fix --- mopidy/local/commands.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mopidy/local/commands.py b/mopidy/local/commands.py index 80ce5c1d..79c1c505 100644 --- a/mopidy/local/commands.py +++ b/mopidy/local/commands.py @@ -62,9 +62,10 @@ class ScanCommand(commands.Command): self.add_argument('--limit', action='store', type=int, dest='limit', default=None, help='Maximum number of tracks to scan') - self.add_argument('--force', - action='store_true', dest='force', default=False, + self.add_argument('--force', + action='store_true', dest='force', default=False, help='Force rescan of all media files') + def run(self, args, config): media_dir = config['local']['media_dir'] scan_timeout = config['local']['scan_timeout'] @@ -98,7 +99,7 @@ class ScanCommand(commands.Command): mtime = file_mtimes.get(abspath) if mtime is None: logger.debug('Missing file %s', track.uri) - uris_to_remove.add(track.uri) + uris_to_remove.add(track.uri) elif mtime > track.last_modified or args.force: uris_to_update.add(track.uri) uris_in_library.add(track.uri) From 713c55321f12b57f097ef38ce50be538ce6dbfb1 Mon Sep 17 00:00:00 2001 From: ronaldz Date: Sun, 1 Mar 2015 14:56:38 -0500 Subject: [PATCH 4/4] Updated the changelog --- docs/changelog.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index e6e3bcf4..713ba215 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -70,6 +70,8 @@ v0.20.0 (UNRELEASED) - Add support for giving local libraries direct access to tags and duration. (Fixes: :issue:`967`) +- Add "--force" option for local scan (Fixes: :issue:'910') (PR: :issue:'1010') + **File scanner** - Improve error logging for scan code (Fixes: :issue:`856`, PR: :issue:`874`)