From 4d1d96c07c932c49e4aaedc10e98dd411a736147 Mon Sep 17 00:00:00 2001 From: j Date: Tue, 20 May 2014 12:30:53 +0200 Subject: [PATCH] dont fail in folders with spaces --- ctl | 27 +++++++++++++-------------- oml/item/scan.py | 15 ++++++++------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/ctl b/ctl index b8570a1..537bfe4 100755 --- a/ctl +++ b/ctl @@ -36,7 +36,7 @@ export oxCACHE hash -r 2>/dev/null if [ "$1" == "start" ]; then - cd $BASE/$NAME + cd "$BASE/$NAME" if [ -e $PID ]; then echo openmedialibrary already running exit 1 @@ -45,7 +45,7 @@ if [ "$1" == "start" ]; then exit $? fi if [ "$1" == "debug" ]; then - cd $BASE/$NAME + cd "$BASE/$NAME" if [ -e $PID ]; then echo openmedialibrary already running exit 1 @@ -61,8 +61,8 @@ if [ "$1" == "stop" ]; then fi if [ "$1" == "restart" ]; then if [ -e $PID ]; then - $0 stop - $0 start + "$0" stop + "$0" start exit $? else exit 1 @@ -71,9 +71,9 @@ fi if [ "$1" == "open" ]; then #time to switch to python and use webbrowser.open_tab? if [ $SYSTEM == "Darwin" ]; then - open http://$HOST/ + open "http://$HOST/" else - xdg-open http://$HOST/ + xdg-open "http://$HOST/" fi exit 0 fi @@ -83,29 +83,28 @@ if [ "$1" == "ui" ]; then exit $? fi if [ "$1" == "update" ]; then - cd $BASE/$NAME - OLD=`$0 version` - cd $BASE/platform + cd "$BASE/$NAME" + OLD=`"$0" version` + cd "$BASE/platform" echo Update platform.. git pull echo Update $NAME.. - cd $BASE/$NAME + cd "$BASE/$NAME" git pull find . -name '*.pyc' -exec rm "{}" \; $0 setup $0 update_static > /dev/null - NEW=`$0 version` + NEW=`"$0" version` $0 postupdate -o $OLD -n $NEW exit fi if [ "$1" == "python" ]; then - cd $BASE/$NAME - echo `pwd` + cd "$BASE/$NAME" shift python2 $@ exit $? fi -cd $BASE/$NAME +cd "$BASE/$NAME" python2 oml $@ exit $? diff --git a/oml/item/scan.py b/oml/item/scan.py index 01d4a47..e48c2d7 100644 --- a/oml/item/scan.py +++ b/oml/item/scan.py @@ -31,13 +31,14 @@ def remove_missing(): with app.app_context(): prefs = settings.preferences prefix = os.path.join(os.path.expanduser(prefs['libraryPath']), 'Books/') - for f in File.query: - path = f.item.get_path() - if not os.path.exists(path): - dirty = True - f.item.remove_file() - if dirty: - db.session.commit() + if os.path.exists(prefix): + for f in File.query: + path = f.item.get_path() + if not os.path.exists(path): + dirty = True + f.item.remove_file() + if dirty: + db.session.commit() def add_file(id, f, prefix): user = state.user()