- allow to import tags from timer & movie,
authorMoritz Venn <ritzmo@users.schwerkraft.elitedvb.net>
Wed, 31 Dec 2008 15:42:22 +0000 (15:42 +0000)
committerMoritz Venn <ritzmo@users.schwerkraft.elitedvb.net>
Wed, 31 Dec 2008 15:42:22 +0000 (15:42 +0000)
- allow to import dirname from movie

autotimer/src/AutoTimerEditor.py
autotimer/src/AutoTimerImporter.py

index b55913f..babc38d 100644 (file)
@@ -1053,9 +1053,10 @@ def addAutotimerFromEvent(session, evt = None, service = None):
                end,                       # Proposed End
                None,                      # Proposed Disabled
                sref,                      # Proposed ServiceReference
-               None,                  # Proposed afterEvent 
-               None,                      # Proposed justplay 
-               None                       # Proposed dirname, can we get anything useful here? 
+               None,                  # Proposed afterEvent
+               None,                      # Proposed justplay
+               None,                      # Proposed dirname, can we get anything useful here?
+               []                 #
        )
 
 def addAutotimerFromService(session, service = None):  
@@ -1088,6 +1089,14 @@ def addAutotimerFromService(session, service = None):
        else:
                begin = end = 0
 
+       from os.path import dirname
+       path = dirname(service.getPath())
+       if not path == '/':
+               path += '/'
+
+       tags = info.getInfoString(service, iServiceInformation.sTags)
+       tags = tags and tags.split(' ') or []
+
        # XXX: we might want to make sure that we actually collected any data because the importer does not do so :-)
 
        session.openWithCallback(
@@ -1104,9 +1113,10 @@ def addAutotimerFromService(session, service = None):
                end,                       # Proposed End
                None,                      # Proposed Disabled
                sref,                      # Proposed ServiceReference
-               None,                  # Proposed afterEvent 
-               None,                      # Proposed justplay 
-               None                       # Proposed dirname, can we get anything useful here? 
+               None,                  # Proposed afterEvent
+               None,                      # Proposed justplay
+               path,                      # Proposed dirname
+               tags               # Proposed tags
        )
 
 def importerCallback(ret):
index 674321a..c92458f 100644 (file)
@@ -85,7 +85,8 @@ class AutoTimerImportSelector(Screen):
                                cur.service_ref,
                                cur.afterEvent,
                                cur.justplay,
-                               cur.dirname
+                               cur.dirname,
+                               cur.tags
                        )
 
        def cancel(self):
@@ -106,7 +107,7 @@ class AutoTimerImporter(Screen):
                <widget name="key_blue" position="420,235" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
        </screen>"""
 
-       def __init__(self, session, autotimer, name, begin, end, disabled, sref, afterEvent, justplay, dirname):
+       def __init__(self, session, autotimer, name, begin, end, disabled, sref, afterEvent, justplay, dirname, tags):
                Screen.__init__(self, session)
 
                # Keep AutoTimer
@@ -185,6 +186,15 @@ class AutoTimerImporter(Screen):
                                        True
                        ))
 
+               if tags:
+                       list.append(
+                               SelectionEntryComponent(
+                                       ': '.join([_("Tags"), ', '.join(tags)]),
+                                       tags,
+                                       7,
+                                       True
+                       ))
+
                self["list"] = SelectionList(list)
 
                # Define Actions
@@ -263,6 +273,8 @@ class AutoTimerImporter(Screen):
                                self.autotimer.justplay = item[1]
                        elif item[2] == 6: # Location
                                self.autotimer.destination = item[1]
+                       elif item[2] == 7: # Tags
+                               self.autotimer.tags = item[1]
 
                if self.autotimer.match == "":
                        self.session.openWithCallback(