Adding date support so we can navigate programming
authorEd Page <eopage@byu.net>
Wed, 5 May 2010 11:52:18 +0000 (06:52 -0500)
committerEd Page <eopage@byu.net>
Wed, 5 May 2010 11:53:25 +0000 (06:53 -0500)
src/backend.py

index 826cef2..4bd0b22 100755 (executable)
@@ -29,11 +29,19 @@ class Backend(object):
                channels = tree.find("channels")
                return self._process_list(channels, ["description", "url", "port"])
 
                channels = tree.find("channels")
                return self._process_list(channels, ["description", "url", "port"])
 
-       def get_radio_channel_programming(self, chanId):
-               tree = self._get_page_with_validation(
-                       action="lds.radio.radiochannels.programming.query",
-                       channelID=chanId,
-               )
+       def get_radio_channel_programming(self, chanId, date=None):
+               if date is not None:
+                       date = date.strftime("%Y-%m-%d")
+                       tree = self._get_page_with_validation(
+                               action="lds.radio.radiochannels.programming.query",
+                               channelID=chanId,
+                               date=date,
+                       )
+               else:
+                       tree = self._get_page_with_validation(
+                               action="lds.radio.radiochannels.programming.query",
+                               channelID=chanId,
+                       )
                programs = tree.find("programs")
                return self._process_list(programs, ["date", "time", "title", "shortdescription", "artist"])
 
                programs = tree.find("programs")
                return self._process_list(programs, ["date", "time", "title", "shortdescription", "artist"])