radio-looptober

somehow downloads looptober mp3 files and make a radio out of them
git clone https://git.lurk.org/repos/radio-looptober.git
Log | Files | Refs | README | LICENSE | TODO

commit 60619aad6c413a716bd5dab15e76300af4151823
parent b908fe7fc6f9b435aea17c6fa4c2620c4cda766c
Author: Claude Heiland-Allen <claude@mathr.co.uk>
Date:   Thu Jun 15 07:50:09 +0100

per-year download directory

to avoid downloading everything again,
move the existing files to the new location:

cd loooooops/ && mkdir 2022 && mv * 2022

Signed-off-by: ugrnm <ultrageranium@bleu255.com>
Diffstat:
download_loooooops.py | 13++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/download_loooooops.py b/download_loooooops.py
@@ -9,7 +9,9 @@ from urllib.parse import urlparse
 #   remote_url
 #   description
 
-output_dir = "loooooops"
+year = "2022"
+
+output_dir = os.path.join("loooooops", year)
 
 bitrate = "128k"
 
@@ -88,7 +90,7 @@ for collection in data:
                 i['created_at'][:-1]).astimezone(
                 datetime.timezone.utc)
 
-            if creation_date.strftime('%Y') == "2022": #we only take entries from this year
+            if creation_date.strftime('%Y') == year: #we only take entries from this year
                 stuff = {}
                 stuff["url"] = i["url"]
                 stuff["description"] = i["content"]
@@ -119,6 +121,7 @@ for l in looooops:
 
 # Once we've done everythin we generate a playlist and ask ezstream
 # to reload it
-os.system('find . -iname "*opus" > playlist_loooooops.m3u'\
-    '&& kill -s HUP `pidof ezstream`')
-
+# this is not an injection vulnerability as output_dir is under
+# our control
+os.system('find {} -iname "*opus" > playlist_loooooops.m3u'\
+    '&& kill -s HUP `pidof ezstream`'.format(output_dir))