From 507af7683afd97e379efe573ea8d508528ac7ebf Mon Sep 17 00:00:00 2001 From: ale <ale@incal.net> Date: Fri, 28 Oct 2011 15:16:50 +0100 Subject: [PATCH] do not die if the music_dir does not exist, just report an error --- client/djrandom_client/client.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/client/djrandom_client/client.py b/client/djrandom_client/client.py index 09b342e..f218886 100644 --- a/client/djrandom_client/client.py +++ b/client/djrandom_client/client.py @@ -55,6 +55,10 @@ def run_client(server_url, music_dir, api_key, run_once, bwlimit, enable_watcher if bwlimit: throttle.set_rate_limit(bwlimit) + # Warn on this condition, but don't die -- the directory might exist later! + if not os.path.isdir(music_dir): + log.error('The music_dir you specified does not exist') + if enable_watcher and not watcher_support: log.warn('inotify/fsevents support not enabled on this platform') enable_watcher = False @@ -128,8 +132,8 @@ def main(): opts, args = parser.parse_args() if not opts.api_key: parser.error('You must specify an API Key') - if not os.path.isdir(opts.music_dir): - parser.error('The --music_dir you specified does not exist') + + music_dir = os.path.expanduser(opts.music_dir) if args: parser.error('Too many arguments') @@ -142,7 +146,7 @@ def main(): do_realtime = not opts.no_realtime_watch daemonize.daemonize(opts, run_client, - (opts.server_url, opts.music_dir, opts.api_key, + (opts.server_url, music_dir, opts.api_key, opts.once, opts.bwlimit, do_realtime)) -- GitLab