dont fail in folders with spaces

This commit is contained in:
j 2014-05-20 12:30:53 +02:00
parent ca4db4353d
commit 4d1d96c07c
2 changed files with 21 additions and 21 deletions

27
ctl
View file

@ -36,7 +36,7 @@ export oxCACHE
hash -r 2>/dev/null hash -r 2>/dev/null
if [ "$1" == "start" ]; then if [ "$1" == "start" ]; then
cd $BASE/$NAME cd "$BASE/$NAME"
if [ -e $PID ]; then if [ -e $PID ]; then
echo openmedialibrary already running echo openmedialibrary already running
exit 1 exit 1
@ -45,7 +45,7 @@ if [ "$1" == "start" ]; then
exit $? exit $?
fi fi
if [ "$1" == "debug" ]; then if [ "$1" == "debug" ]; then
cd $BASE/$NAME cd "$BASE/$NAME"
if [ -e $PID ]; then if [ -e $PID ]; then
echo openmedialibrary already running echo openmedialibrary already running
exit 1 exit 1
@ -61,8 +61,8 @@ if [ "$1" == "stop" ]; then
fi fi
if [ "$1" == "restart" ]; then if [ "$1" == "restart" ]; then
if [ -e $PID ]; then if [ -e $PID ]; then
$0 stop "$0" stop
$0 start "$0" start
exit $? exit $?
else else
exit 1 exit 1
@ -71,9 +71,9 @@ fi
if [ "$1" == "open" ]; then if [ "$1" == "open" ]; then
#time to switch to python and use webbrowser.open_tab? #time to switch to python and use webbrowser.open_tab?
if [ $SYSTEM == "Darwin" ]; then if [ $SYSTEM == "Darwin" ]; then
open http://$HOST/ open "http://$HOST/"
else else
xdg-open http://$HOST/ xdg-open "http://$HOST/"
fi fi
exit 0 exit 0
fi fi
@ -83,29 +83,28 @@ if [ "$1" == "ui" ]; then
exit $? exit $?
fi fi
if [ "$1" == "update" ]; then if [ "$1" == "update" ]; then
cd $BASE/$NAME cd "$BASE/$NAME"
OLD=`$0 version` OLD=`"$0" version`
cd $BASE/platform cd "$BASE/platform"
echo Update platform.. echo Update platform..
git pull git pull
echo Update $NAME.. echo Update $NAME..
cd $BASE/$NAME cd "$BASE/$NAME"
git pull git pull
find . -name '*.pyc' -exec rm "{}" \; find . -name '*.pyc' -exec rm "{}" \;
$0 setup $0 setup
$0 update_static > /dev/null $0 update_static > /dev/null
NEW=`$0 version` NEW=`"$0" version`
$0 postupdate -o $OLD -n $NEW $0 postupdate -o $OLD -n $NEW
exit exit
fi fi
if [ "$1" == "python" ]; then if [ "$1" == "python" ]; then
cd $BASE/$NAME cd "$BASE/$NAME"
echo `pwd`
shift shift
python2 $@ python2 $@
exit $? exit $?
fi fi
cd $BASE/$NAME cd "$BASE/$NAME"
python2 oml $@ python2 oml $@
exit $? exit $?

View file

@ -31,13 +31,14 @@ def remove_missing():
with app.app_context(): with app.app_context():
prefs = settings.preferences prefs = settings.preferences
prefix = os.path.join(os.path.expanduser(prefs['libraryPath']), 'Books/') prefix = os.path.join(os.path.expanduser(prefs['libraryPath']), 'Books/')
for f in File.query: if os.path.exists(prefix):
path = f.item.get_path() for f in File.query:
if not os.path.exists(path): path = f.item.get_path()
dirty = True if not os.path.exists(path):
f.item.remove_file() dirty = True
if dirty: f.item.remove_file()
db.session.commit() if dirty:
db.session.commit()
def add_file(id, f, prefix): def add_file(id, f, prefix):
user = state.user() user = state.user()