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`) diff --git a/mopidy/local/commands.py b/mopidy/local/commands.py index a9920ec8..79c1c505 100644 --- a/mopidy/local/commands.py +++ b/mopidy/local/commands.py @@ -61,7 +61,10 @@ 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') + 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'] @@ -97,7 +100,7 @@ class ScanCommand(commands.Command): if mtime is None: logger.debug('Missing file %s', track.uri) uris_to_remove.add(track.uri) - elif mtime > track.last_modified: + elif mtime > track.last_modified or args.force: uris_to_update.add(track.uri) uris_in_library.add(track.uri)