Change Favourite to Shortlist

This commit is contained in:
Timothy Legge 2011-06-22 21:03:42 -03:00
parent f3211275f2
commit 62d74dc011

View File

@ -125,9 +125,9 @@ class KOBO(USBMS):
# this shows an expired Collection so the user can decide to delete the book # this shows an expired Collection so the user can decide to delete the book
if expired == 3: if expired == 3:
playlist_map[lpath].append('Expired') playlist_map[lpath].append('Expired')
# Favourites are supported on the touch but the data field is there on most earlier models # A SHORTLIST is supported on the touch but the data field is there on most earlier models
if favouritesindex == 1: if favouritesindex == 1:
playlist_map[lpath].append('Favourite') playlist_map[lpath].append('Shortlist')
path = self.normalize_path(path) path = self.normalize_path(path)
# print "Normalized FileName: " + path # print "Normalized FileName: " + path
@ -557,7 +557,7 @@ class KOBO(USBMS):
if collections: if collections:
# Process any collections that exist # Process any collections that exist
for category, books in collections.items(): for category, books in collections.items():
debug_print (category) # debug_print (category)
if category == 'Im_Reading': if category == 'Im_Reading':
# Reset Im_Reading list in the database # Reset Im_Reading list in the database
if oncard == 'carda': if oncard == 'carda':
@ -676,7 +676,7 @@ class KOBO(USBMS):
else: else:
connection.commit() connection.commit()
# debug_print('Database: Commit set ReadStatus as Closed') # debug_print('Database: Commit set ReadStatus as Closed')
if category == 'Favourite': if category == 'Shortlist':
# Reset FavouritesIndex list in the database # Reset FavouritesIndex list in the database
if oncard == 'carda': if oncard == 'carda':
query= 'update content set FavouritesIndex=-1 where BookID is Null and ContentID like \'file:///mnt/sd/%\'' query= 'update content set FavouritesIndex=-1 where BookID is Null and ContentID like \'file:///mnt/sd/%\''
@ -686,17 +686,17 @@ class KOBO(USBMS):
try: try:
cursor.execute (query) cursor.execute (query)
except: except:
debug_print('Database Exception: Unable to reset Favourites list') debug_print('Database Exception: Unable to reset Shortlist list')
raise raise
else: else:
# debug_print('Commit: Reset Favourites list') # debug_print('Commit: Reset Shortlist list')
connection.commit() connection.commit()
for book in books: for book in books:
# debug_print('Title:', book.title, 'lpath:', book.path) # debug_print('Title:', book.title, 'lpath:', book.path)
if 'Favourite' not in book.device_collections: if 'Shortlist' not in book.device_collections:
book.device_collections.append('Favourite') book.device_collections.append('Shortlist')
debug_print ("Favourite found for: ", book.title) # debug_print ("Shortlist found for: ", book.title)
extension = os.path.splitext(book.path)[1] 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) ContentType = self.get_content_type_from_extension(extension) if extension != '' else self.get_content_type_from_path(book.path)
@ -708,11 +708,11 @@ class KOBO(USBMS):
try: try:
cursor.execute('update content set FavouritesIndex=1 where BookID is Null and ContentID = ?', t) cursor.execute('update content set FavouritesIndex=1 where BookID is Null and ContentID = ?', t)
except: except:
debug_print('Database Exception: Unable set book as Favourite') debug_print('Database Exception: Unable set book as Shortlist')
raise raise
else: else:
connection.commit() connection.commit()
# debug_print('Database: Commit set FavouritesIndex as Favourite') # debug_print('Database: Commit set Shortlist as Shortlist')
else: # No collections else: # No collections
# Since no collections exist the ReadStatus needs to be reset to 0 (Unread) # Since no collections exist the ReadStatus needs to be reset to 0 (Unread)