Skip to content
Snippets Groups Projects
Commit e728985a authored by ale's avatar ale
Browse files

minor fixes

parent d6e3251b
No related branches found
No related tags found
No related merge requests found
......@@ -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',
......
......@@ -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()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment