projects
/
oe1archive.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed surl and changed order of day, month, year in file-/dirnames.
[oe1archive.git]
/
oe1archive.py
diff --git
a/oe1archive.py
b/oe1archive.py
old mode 100755
(executable)
new mode 100644
(file)
index
de4d412
..
253fde6
--- a/
oe1archive.py
+++ b/
oe1archive.py
@@
-2,7
+2,7
@@
"""A simple tool to query the Oe1 7 Tage archive."""
"""A simple tool to query the Oe1 7 Tage archive."""
-__version__ = "2.
0
"
+__version__ = "2.
1
"
__author__ = "Stefan Huber"
__author__ = "Stefan Huber"
@@
-54,7
+54,7
@@
class Archive:
return None
sid = sjson[0]['loopStreamId']
return None
sid = sjson[0]['loopStreamId']
- surl = 'http://loopstream01.apa.at/?channel=oe1&shoutcast=0&id=%s'
+ surl = 'http
s
://loopstream01.apa.at/?channel=oe1&shoutcast=0&id=%s'
return surl % sid
def get_broadcast_description(self, day, broadcast):
return surl % sid
def get_broadcast_description(self, day, broadcast):
@@
-172,7
+172,7
@@
def get_directory_name(name, datetime):
if len(name) > 0:
prefix = name + "_"
if len(name) > 0:
prefix = name + "_"
- return prefix + datetime.strftime("%
Y-%m-%d
")
+ return prefix + datetime.strftime("%
d-%m-%Y
")
def make_directory(name, datetime):
"""Creates the download subdirectory for the given name and datetime."""
def make_directory(name, datetime):
"""Creates the download subdirectory for the given name and datetime."""
@@
-184,7
+184,7
@@
def write_html_file(name, datetime, description):
"""Stores broadcast description into a html file."""
longname = get_directory_name(name, datetime)
"""Stores broadcast description into a html file."""
longname = get_directory_name(name, datetime)
- filepath = os.path.join(longname,
"description
.html")
+ filepath = os.path.join(longname,
longname + "
.html")
file = open(filepath, 'w+')
file.write("<!DOCTYPE html>\n")
file.write("<html>\n")
file = open(filepath, 'w+')
file.write("<!DOCTYPE html>\n")
file.write("<html>\n")
@@
-205,7
+205,7
@@
def write_mp3_file(name, datetime, url):
import requests
longname = get_directory_name(name, datetime)
import requests
longname = get_directory_name(name, datetime)
- filepath = os.path.join(longname,
"stream
.mp3")
+ filepath = os.path.join(longname,
longname + "
.mp3")
print("Fetching mp3...")
r = requests.get(url, stream=True)
print("Fetching mp3...")
r = requests.get(url, stream=True)