Fix some stuck Inoreader synchronized items
authorJack Miller <millerjo@us.ibm.com>
Wed, 3 Jun 2015 00:43:47 +0000 (19:43 -0500)
committerJack Miller <millerjo@us.ibm.com>
Wed, 3 Jun 2015 00:43:47 +0000 (19:43 -0500)
It appears that sometimes, an item will be given a "com.google/fresh"
tag, and it will resist being set as "read" on Inoreader's side, so
don't let fresh items override our local "read" state. If you mark it in
canto, it should stay read in canto.

plugins/sync-inoreader.py

index 7c507a2..254b8ef 100644 (file)
@@ -101,7 +101,7 @@ def inoreader_req(path, query = {}):
     return r
 
 def full_ino_tag_suffix(tag):
     return r
 
 def full_ino_tag_suffix(tag):
-    if tag in ["read", "starred"]:
+    if tag in ["read", "starred", "fresh"]:
         return "/state/com.google/" + tag
     return "/label/" + tag
 
         return "/state/com.google/" + tag
     return "/label/" + tag
 
@@ -290,7 +290,12 @@ class CantoFeedInoReader(DaemonFeedPlugin):
             if "canto-state" not in entry or type(entry["canto-state"]) != list:
                 continue
 
             if "canto-state" not in entry or type(entry["canto-state"]) != list:
                 continue
 
-            if "read" in entry["canto-state"] and not has_ino_tag(entry, "read"):
+            # It appears that if an item is "fresh" it will resist all attempts
+            # to set it as read?
+
+            if "read" in entry["canto-state"] and not\
+                    (has_ino_tag(entry, "read") or has_ino_tag(entry, "fresh")):
+                log.debug("Marking unread from Inoreader")
                 entry["canto-state"].remove("read")
 
             if "canto-tags" not in entry or type(entry["canto-tags"]) != list:
                 entry["canto-state"].remove("read")
 
             if "canto-tags" not in entry or type(entry["canto-tags"]) != list: