local: Add --clear flag to scanner.
This commit is contained in:
parent
09c0ae2551
commit
82877ec60f
@ -22,6 +22,11 @@ class LocalCommand(commands.Command):
|
||||
class ScanCommand(commands.Command):
|
||||
help = "Scan local media files and populate the local library."
|
||||
|
||||
def __init__(self):
|
||||
super(ScanCommand, self).__init__()
|
||||
self.add_argument('--clear', action='store_true', dest='clear',
|
||||
help='Clear out library storage')
|
||||
|
||||
def run(self, args, config):
|
||||
media_dir = config['local']['media_dir']
|
||||
scan_timeout = config['local']['scan_timeout']
|
||||
@ -40,6 +45,13 @@ class ScanCommand(commands.Command):
|
||||
library = libraries[library_name](config)
|
||||
logger.debug('Using %s as the local library', library_name)
|
||||
|
||||
if args.clear:
|
||||
if library.clear():
|
||||
logging.info('Library succesfully cleared.')
|
||||
return 0
|
||||
logging.warning('Unable to clear library.')
|
||||
return 1
|
||||
|
||||
uri_path_mapping = {}
|
||||
uris_in_library = set()
|
||||
uris_to_update = set()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user