From c89cb85f12a1642490e7cb58928085056da98891 Mon Sep 17 00:00:00 2001
From: Timothy Legge
Date: Tue, 15 Mar 2011 11:39:22 -0300
Subject: [PATCH 1/2] Add support for Closed Collection to Kobo
---
src/calibre/devices/kobo/driver.py | 40 +++++++++++++++++++++++++++++-
1 file changed, 39 insertions(+), 1 deletion(-)
diff --git a/src/calibre/devices/kobo/driver.py b/src/calibre/devices/kobo/driver.py
index f1c0d3f3d3..3a0254ef20 100644
--- a/src/calibre/devices/kobo/driver.py
+++ b/src/calibre/devices/kobo/driver.py
@@ -115,6 +115,8 @@ class KOBO(USBMS):
playlist_map[lpath]= "Im_Reading"
elif readstatus == 2:
playlist_map[lpath]= "Read"
+ elif readstatus == 3:
+ playlist_map[lpath]= "Closed"
path = self.normalize_path(path)
# print "Normalized FileName: " + path
@@ -599,11 +601,47 @@ class KOBO(USBMS):
try:
cursor.execute('update content set ReadStatus=2,FirstTimeReading=\'true\' where BookID is Null and ContentID = ?', t)
except:
- debug_print('Database Exception: Unable set book as Rinished')
+ debug_print('Database Exception: Unable set book as Finished')
raise
else:
connection.commit()
# debug_print('Database: Commit set ReadStatus as Finished')
+ if category == 'Closed':
+ # Reset Im_Reading list in the database
+ if oncard == 'carda':
+ query= 'update content set ReadStatus=0, FirstTimeReading = \'true\' where BookID is Null and ReadStatus = 3 and ContentID like \'file:///mnt/sd/%\''
+ elif oncard != 'carda' and oncard != 'cardb':
+ query= 'update content set ReadStatus=0, FirstTimeReading = \'true\' where BookID is Null and ReadStatus = 3 and ContentID not like \'file:///mnt/sd/%\''
+
+ try:
+ cursor.execute (query)
+ except:
+ debug_print('Database Exception: Unable to reset Closed list')
+ raise
+ else:
+# debug_print('Commit: Reset Closed list')
+ connection.commit()
+
+ for book in books:
+# debug_print('Title:', book.title, 'lpath:', book.path)
+ book.device_collections = ['Closed']
+
+ extension = os.path.splitext(book.path)[1]
+ ContentType = self.get_content_type_from_extension(extension) if extension != '' else self.get_content_type_from_path(book.path)
+
+ ContentID = self.contentid_from_path(book.path, ContentType)
+# datelastread = time.strftime("%Y-%m-%dT%H:%M:%S", time.gmtime())
+
+ t = (ContentID,)
+
+ try:
+ cursor.execute('update content set ReadStatus=3,FirstTimeReading=\'true\' where BookID is Null and ContentID = ?', t)
+ except:
+ debug_print('Database Exception: Unable set book as Closed')
+ raise
+ else:
+ connection.commit()
+# debug_print('Database: Commit set ReadStatus as Closed')
else: # No collections
# Since no collections exist the ReadStatus needs to be reset to 0 (Unread)
print "Reseting ReadStatus to 0"
From ef1f808d5b30baefa2a63026265284451703b577 Mon Sep 17 00:00:00 2001
From: Kovid Goyal
Date: Tue, 15 Mar 2011 10:50:23 -0600
Subject: [PATCH 2/2] Office Space and Modoros by Zsolt Botykai
---
resources/recipes/modoros.recipe | 89 +++++++++++++++++++++
resources/recipes/office_space.recipe | 109 ++++++++++++++++++++++++++
2 files changed, 198 insertions(+)
create mode 100644 resources/recipes/modoros.recipe
create mode 100644 resources/recipes/office_space.recipe
diff --git a/resources/recipes/modoros.recipe b/resources/recipes/modoros.recipe
new file mode 100644
index 0000000000..72980298d6
--- /dev/null
+++ b/resources/recipes/modoros.recipe
@@ -0,0 +1,89 @@
+import re
+from calibre.web.feeds.recipes import BasicNewsRecipe
+from calibre.constants import config_dir, CONFIG_DIR_MODE
+import os, os.path, urllib
+from hashlib import md5
+
+class ModorosBlogHu(BasicNewsRecipe):
+ __author__ = 'Zsolt Botykai'
+ title = u'Modoros Blog'
+ description = u"Modoros.blog.hu"
+ oldest_article = 10000
+ max_articles_per_feed = 10000
+ reverse_article_order = True
+ language = 'hu'
+ remove_javascript = True
+ remove_empty_feeds = True
+ no_stylesheets = True
+ feeds = [(u'Modoros Blog', u'http://modoros.blog.hu/rss')]
+ remove_javascript = True
+ use_embedded_content = False
+ preprocess_regexps = [
+ (re.compile(r'.*?
]+>.*?.*?', re.DOTALL|re.IGNORECASE), lambda match: ''),
+ (re.compile(r'
.*?
'),
+ (re.compile(r'
', re.DOTALL|re.IGNORECASE), lambda match: ''),
+ (re.compile(r'', re.DOTALL|re.IGNORECASE), lambda m: ''),
+ (re.compile(r'![]()