]> code.delx.au - webdl/blobdiff - common.py
Drop livestreamer support, it probably didn't work anymore anyway
[webdl] / common.py
index e90bbf701885ca47056bfdbba093b6883db3d587..05d344cd5e49a19f26d19bd83b671a8b7c4b3f43 100644 (file)
--- a/common.py
+++ b/common.py
@@ -50,6 +50,7 @@ class Node(object):
     def get_children(self):
         if not self.children:
             self.fill_children()
+            self.children = natural_sort(self.children, key=lambda node: node.title)
         return self.children
 
     def fill_children(self):
@@ -168,16 +169,6 @@ def find_ffprobe():
 
     raise Exception("You must install ffmpeg or libav-tools")
 
-def find_streamlink():
-    if check_command_exists(["streamlink", "--help"]):
-        return "streamlink"
-
-    if check_command_exists(["livestreamer", "--help"]):
-        logging.warn("Detected livestreamer! streamlink is recommended")
-        return "livestreamer"
-
-    raise Exception("You must install streamlink or livestreamer")
-
 def get_duration(filename):
     ffprobe = find_ffprobe()
 
@@ -274,8 +265,6 @@ def convert_to_mp4(filename):
 
 
 def download_hds(filename, video_url, pvswf=None):
-    streamlink = find_streamlink()
-
     filename = sanify_filename(filename)
     logging.info("Downloading: %s", filename)
 
@@ -286,9 +275,9 @@ def download_hds(filename, video_url, pvswf=None):
         param = video_url
 
     cmd = [
-        streamlink,
-        "-f",
-        "-o", filename,
+        "streamlink",
+        "--force",
+        "--output", filename,
         param,
         "best",
     ]
@@ -298,16 +287,14 @@ def download_hds(filename, video_url, pvswf=None):
         return False
 
 def download_hls(filename, video_url):
-    streamlink = find_streamlink()
-
     filename = sanify_filename(filename)
     video_url = "hlsvariant://" + video_url
     logging.info("Downloading: %s", filename)
 
     cmd = [
-        streamlink,
-        "-f",
-        "-o", filename,
+        "streamlink",
+        "--force",
+        "--output", filename,
         video_url,
         "best",
     ]
@@ -317,16 +304,14 @@ def download_hls(filename, video_url):
         return False
 
 def download_mpd(filename, video_url):
-    streamlink = find_streamlink()
-
     filename = sanify_filename(filename)
     video_url = "dash://" + video_url
     logging.info("Downloading: %s", filename)
 
     cmd = [
-        streamlink,
-        "-f",
-        "-o", filename,
+        "streamlink",
+        "--force",
+        "--output", filename,
         video_url,
         "best",
     ]