def folder_scan(): s = Scanner(session) folders = session.query(Folder).filter(Folder.root == True) if folders: for folder in folders: print "Scanning: " + folder.path FolderManager.scan(folder.id, s) added, deleted = s.stats() print "\a" print "Scanning done" print 'Added: %i artists, %i albums, %i tracks' % (added[0], added[1], added[2]) print 'Deleted: %i artists, %i albums, %i tracks' % (deleted[0], deleted[1], deleted[2])
def scan_folder(id = None): s = Scanner(session) if id is None: for folder in Folder.query.filter(Folder.root == True): FolderManager.scan(folder.id, s) else: status = FolderManager.scan(id, s) if status != FolderManager.SUCCESS: flash(FolderManager.error_str(status)) return redirect(url_for('folder_index')) added, deleted = s.stats() session.commit() flash('Added: %i artists, %i albums, %i tracks' % (added[0], added[1], added[2])) flash('Deleted: %i artists, %i albums, %i tracks' % (deleted[0], deleted[1], deleted[2])) return redirect(url_for('folder_index'))
def folder_scan(): s = Scanner(session) folders = session.query(Folder).filter(Folder.root == True) if folders: for folder in folders: print "Scanning: " + folder.path FolderManager.scan(folder.id, s) added, deleted = s.stats() print "\a" print "Scanning done" print 'Added: %i artists, %i albums, %i tracks' % (added[0], added[1], added[2]) print 'Deleted: %i artists, %i albums, %i tracks' % ( deleted[0], deleted[1], deleted[2])
def folder_scan(self, folders): s = Scanner(db.session) if folders: folders = map(lambda n: db.Folder.query.filter(db.Folder.name == n and db.Folder.root == True).first() or n, folders) if any(map(lambda f: isinstance(f, basestring), folders)): print "No such folder(s): " + ' '.join(f for f in folders if isinstance(f, basestring)) for folder in filter(lambda f: isinstance(f, db.Folder), folders): FolderManager.scan(folder.id, s) else: for folder in db.Folder.query.filter(db.Folder.root == True): FolderManager.scan(folder.id, s) added, deleted = s.stats() db.session.commit() print "Scanning done" print 'Added: %i artists, %i albums, %i tracks' % (added[0], added[1], added[2]) print 'Deleted: %i artists, %i albums, %i tracks' % (deleted[0], deleted[1], deleted[2])
def scan_folder(id=None): s = Scanner(session) if id is None: for folder in Folder.query.filter(Folder.root == True): FolderManager.scan(folder.id, s) else: status = FolderManager.scan(id, s) if status != FolderManager.SUCCESS: flash(FolderManager.error_str(status)) return redirect(url_for('folder_index')) added, deleted = s.stats() session.commit() flash('Added: %i artists, %i albums, %i tracks' % (added[0], added[1], added[2])) flash('Deleted: %i artists, %i albums, %i tracks' % (deleted[0], deleted[1], deleted[2])) return redirect(url_for('folder_index'))