[packages/griffith] import only "seen" movies

glen glen at pld-linux.org
Sun Jun 5 14:53:33 CEST 2016


commit a48bca53fa8005e9d0b125b2dc6d3b94af7b04e8
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Sun Jun 5 15:43:51 2016 +0300

    import only "seen" movies

 Kodi.py | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/Kodi.py b/Kodi.py
index 6438981..88a6468 100644
--- a/Kodi.py
+++ b/Kodi.py
@@ -2,7 +2,7 @@
 
 __revision__ = '$Id: $'
 
-# Copyright (c) 2015
+# Copyright (c) 2015-2016 Elan Ruusamäe <glen at pld-linux.org>
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -167,12 +167,20 @@ class ImportPlugin(IP):
 
         # fill details
         details = {}
-        for k,v in self.field_map.items():
-            details[k] = item.findtext(v)
 
         # if playcount set, means it's seen
         details['seen'] = int(item.find('playcount').text) > 0
 
+        # import only "seen" movies
+        if not details['seen']:
+            # importer will skip movie without title and original title
+            self.itemindex = self.itemindex + 1
+            # increment for next iteration
+            return details
+
+        for k,v in self.field_map.items():
+            details[k] = item.findtext(v)
+
         # genre can be multiple items, join by comma
         details['genre'] = ', '.join(n.text for n in item.findall('genre'))
 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/griffith.git/commitdiff/8a0f2423e2e482c81bb413ce908a2165f4c8dda7



More information about the pld-cvs-commit mailing list