[packages/griffith] import other fields as notes

glen glen at pld-linux.org
Tue Jul 28 19:53:42 CEST 2015


commit 91cfb43dc65e71621c542f1b060d1a3d49e7da74
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Tue Jul 28 20:53:15 2015 +0300

    import other fields as notes

 Kodi.py | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
---
diff --git a/Kodi.py b/Kodi.py
index 585f16e..87dea0a 100644
--- a/Kodi.py
+++ b/Kodi.py
@@ -68,12 +68,24 @@ class ImportPlugin(IP):
         'director': 'director',
         'studio': 'studio',
         'country': 'country',
+        'classification': 'mpaa',
         # while the trailer field exists, it is not useful for griffith
         # as it's something like: "plugin://plugin.video.youtube/?action=play_video&videoid=..."
         # however youtube urls can be probably fixed.
         'trailer': 'trailer',
     }
 
+    # rest of the stuff to insert into notes field
+    notes_map = {
+        _('Id') : 'id',
+        _('Play count'): 'playcount',
+        _('Date added'): 'dateadded',
+        _('Last played'): 'lastplayed',
+        _('Collection'): 'set',
+        _('Premiered'): 'premiered',
+        _('Aired'): 'aired',
+    }
+
     def initialize(self):
         if not IP.initialize(self):
             return False
@@ -167,6 +179,21 @@ class ImportPlugin(IP):
         if cast:
             details['cast'] = "\n".join(cast)
 
+        # put rest of information into notes field
+        notes = []
+        for k,v in self.notes_map.items():
+            v = item.findtext(v)
+            if v:
+                notes.append('%s: %s' % (k, v))
+
+        # credits can have multiple values, handle separately
+        credits = ', '.join(n.text for n in item.findall('credits'))
+        if credits:
+            notes.append(_('Credits: %s') % credits)
+
+        if notes:
+            details['notes'] = "\n".join(notes)
+
         # increment for next iteration
         self.itemindex = self.itemindex + 1
 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/griffith.git/commitdiff/91cfb43dc65e71621c542f1b060d1a3d49e7da74



More information about the pld-cvs-commit mailing list