mirror of
https://github.com/spl0k/supysonic.git
synced 2024-11-15 06:32:16 +00:00
some status messages for scan and flush database more often during scan
to prevent error from cancelling entire scan
This commit is contained in:
parent
64e8d616fc
commit
5252111e91
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
*.pyc
|
||||
*.swp
|
||||
start_server.sh
|
||||
|
@ -21,6 +21,7 @@ def prepare_transcoding_cmdline(base_cmdline, input_file, input_format, output_f
|
||||
@app.route('/rest/stream.view', methods = [ 'GET', 'POST' ])
|
||||
def stream_media():
|
||||
status, res = get_entity(request, Track)
|
||||
|
||||
if not status:
|
||||
return res
|
||||
|
||||
@ -78,6 +79,7 @@ def stream_media():
|
||||
proc.terminate()
|
||||
proc.wait()
|
||||
|
||||
|
||||
response = Response(transcode(), mimetype = dst_mimetype)
|
||||
else:
|
||||
response = send_file(res.path, mimetype = dst_mimetype)
|
||||
|
1
cli.py
1
cli.py
@ -104,6 +104,7 @@ class CLI(cmd.Cmd):
|
||||
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)
|
||||
print 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):
|
||||
|
2
db.py
2
db.py
@ -58,7 +58,7 @@ def now():
|
||||
return datetime.datetime.now().replace(microsecond = 0)
|
||||
|
||||
engine = create_engine(config.get('base', 'database_uri'), convert_unicode = True)
|
||||
session = scoped_session(sessionmaker(autocommit = False, autoflush = False, bind = engine))
|
||||
session = scoped_session(sessionmaker(autoflush = True, bind = engine))
|
||||
|
||||
Base = declarative_base()
|
||||
Base.query = session.query_property()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# coding: utf-8
|
||||
|
||||
import os.path, sys
|
||||
sys.path.insert(0, '/path/to/the/supysonic/app')
|
||||
sys.path.insert(0, '/home/emory/supysonic')
|
||||
|
||||
import config
|
||||
if not config.check():
|
||||
|
@ -23,7 +23,10 @@ class Scanner:
|
||||
self.__deleted_tracks = 0
|
||||
|
||||
def scan(self, folder):
|
||||
for root, subfolders, files in os.walk(folder.path):
|
||||
print "scanning", folder.path
|
||||
for root, subfolders, files in os.walk(folder.path, topdown=False):
|
||||
for p in subfolders:
|
||||
db.session.flush()
|
||||
for f in files:
|
||||
self.__scan_file(os.path.join(root, f), folder)
|
||||
folder.last_scan = int(time.time())
|
||||
@ -60,6 +63,7 @@ class Scanner:
|
||||
self.__remove_track(tr)
|
||||
return
|
||||
else:
|
||||
print "Added ", path
|
||||
tag = self.__try_load_tag(path)
|
||||
if not tag:
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user