Browse Source

zdf_mediathek: implement search option for channels, use headline instead of titel to find videos (closes #13)

Helmut Pozimski 6 years ago
parent
commit
91039728ca
8 changed files with 27 additions and 9 deletions
  1. 6 0
      CHANGELOG
  2. 1 1
      README.md
  3. 6 0
      debian/changelog
  4. 1 1
      doc/conf.py
  5. 1 1
      lib_stov/main.py
  6. 1 1
      lib_stov/subscription.py
  7. 10 4
      lib_stov/zdf_mediathek.py
  8. 1 1
      setup.py

+ 6 - 0
CHANGELOG

@@ -1,3 +1,9 @@
+1.1.1
+---
+
+* ZDF Mediathek: add optional search parameter
+* ZDF Mediathek: search in headline instead of video title for channel name
+
 1.1
 ---
 

+ 1 - 1
README.md

@@ -66,7 +66,7 @@ For this site, all features are supported, you can subscribe to users, channels
 
 ### ZDF Mediathek
 
-Only the "channel" subscription type is supported. The string you put in as the channel name will be used to select broadcasts from all of the available ones to download. Since many broadcasts are removed from the Mediathek after 7 days, you should run stov at least weekly to catch all broadcasts.
+Only the "channel" subscription type is supported with an optional string to search for in the video title. The string you put in as the channel name will be used to select broadcasts from all of the available ones to download. Since many broadcasts are removed from the Mediathek after 7 days, you should run stov at least weekly to catch all broadcasts.
 
 ### Twitch.tv
 

+ 6 - 0
debian/changelog

@@ -1,3 +1,9 @@
+stov (1.1.1-1) unstable; urgency=low
+
+  * New upstream release
+
+ -- Helmut Pozimski <helmut@pozimski.eu>  Mon, 20 Nov 2017 19:51:00 +0100
+
 stov (1.1.0-1) unstable; urgency=low
 
   * New upstream release

+ 1 - 1
doc/conf.py

@@ -54,7 +54,7 @@ copyright = (u"2017, Helmut Pozimski License GPLv2, GNU GPL version 2 "
 # The short X.Y version.
 version = '1.1'
 # The full version, including alpha/beta/rc tags.
-release = '1.1'
+release = '1.1.1'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.

+ 1 - 1
lib_stov/main.py

@@ -71,7 +71,7 @@ def main():
     elif arguments.license:
         program.print_license()
     elif arguments.version:
-        logger.info("1.1")
+        logger.info("1.1.1")
     else:
         parser.print_help()
     helpers.remove_lock()

+ 1 - 1
lib_stov/subscription.py

@@ -62,7 +62,7 @@ class Sub(object):
                                                  self._conf, self._search)
         elif site == "zdf_mediathek":
             self._connector = zdf_mediathek.Connector(self._type, self._name,
-                                                      self._conf)
+                                                      self._conf, self._search)
         elif site == "twitch":
             self._connector = twitch.Connector(self._type, self._name,
                                                self._conf, self._search)

+ 10 - 4
lib_stov/zdf_mediathek.py

@@ -49,13 +49,14 @@ class ZDFVideo(object):
 
 class Connector(object):
     """Connector class performing operations against the API"""
-    def __init__(self, subscription_type, name, conf):
+    def __init__(self, subscription_type, name, conf, search=""):
         if subscription_type == "user":
             self._type = "channel"
         else:
             self._type = subscription_type
         self._name = name
         self._conf = conf
+        self._search = search
         if self._type != "channel":
             raise stov_exceptions.TypeNotSupported()
 
@@ -80,9 +81,14 @@ class Connector(object):
             response = json.loads(data)
             for cluster in response["broadcastCluster"]:
                 for broadcast in cluster["teaser"]:
-                    if self._name in broadcast["titel"]:
-                        new_videos.append((broadcast["sharingUrl"],
-                                           broadcast["titel"]))
+                    if self._name in broadcast["headline"]:
+                        if self._search:
+                            if self._search in broadcast["titel"]:
+                                new_videos.append((broadcast["sharingUrl"],
+                                                   broadcast["titel"]))
+                        else:
+                            new_videos.append((broadcast["sharingUrl"],
+                                               broadcast["titel"]))
         if new_videos:
             for broadcast in new_videos:
                 video_exists = False

+ 1 - 1
setup.py

@@ -24,7 +24,7 @@ from distutils.core import setup
 
 setup(
     name="stov",
-    version="1.1",
+    version="1.1.1",
     author="Helmut Pozimski",
     author_email="helmut@pozimski.eu",
     description=("a program to subscribe to channels and users from youtube and"