diff --git a/client/djrandom_client/client.py b/client/djrandom_client/client.py index f21888635a4ec933765ef4cd90f48e51ea7d0f91..9523017d3a952d310dac7888fec30ca3ef45534e 100644 --- a/client/djrandom_client/client.py +++ b/client/djrandom_client/client.py @@ -99,13 +99,16 @@ def run_client(server_url, music_dir, api_key, run_once, bwlimit, enable_watcher upl.start() scan.start() - # It turns out that, even if we set up signal handlers in this - # same main thread, they won't be executed if we're blocking on - # a mutex (such as 'upl.join()' for example)... so we do this - # silly idle loop in the main thread just to ensure that we - # catch SIGTERM and SIGINT. - while True: - time.sleep(3600) + if run_once: + upl.join() + else: + # It turns out that, even if we set up signal handlers in this + # same main thread, they won't be executed if we're blocking on + # a mutex (such as 'upl.join()' for example)... so we do this + # silly idle loop in the main thread just to ensure that we + # catch SIGTERM and SIGINT. + while True: + time.sleep(3600) def main(): @@ -115,7 +118,7 @@ def main(): parser.add_option('--once', action='store_true', help='Scan music_dir once and then exit') parser.add_option('--music_dir', - default=os.path.join(os.getenv('HOME'), 'Music'), + default='~/Music', help='Path to your music directory') parser.add_option('--server_url', default='https://djrandom.incal.net/receiver', diff --git a/client/djrandom_client/utils.py b/client/djrandom_client/utils.py index cced8cc7d3418726c0f24dce29528bee8735bb46..427822acbb19b9c62f93cabae022ec61f59d00d1 100644 --- a/client/djrandom_client/utils.py +++ b/client/djrandom_client/utils.py @@ -8,15 +8,6 @@ NESTING = 2 VERSION_PY_URL = 'https://git.autistici.org/djrandom/plain/client/djrandom_client/version.py' -def generate_path(base_dir, sha1): - dir_parts = [base_dir] - dir_parts.extend(sha1[:NESTING]) - base_path = os.path.join(*dir_parts) - if not os.path.isdir(base_path): - os.makedirs(base_path) - return os.path.join(base_path, sha1) - - def sha1_of_file(path): with open(path, 'rb') as fd: sha = hashlib.sha1()