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))