From 2566e434ee9785b3e5b3498464eddcaca6f2329f Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Sun, 28 Apr 2013 11:34:46 -0500 Subject: [PATCH] Tweak 'skip update when the story URL would be changed' feature. --- calibre-plugin/ffdl_plugin.py | 40 +++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/calibre-plugin/ffdl_plugin.py b/calibre-plugin/ffdl_plugin.py index daf8069..2adb8dd 100644 --- a/calibre-plugin/ffdl_plugin.py +++ b/calibre-plugin/ffdl_plugin.py @@ -846,6 +846,28 @@ class FanFictionDownLoaderPlugin(InterfaceAction): book['icon'] = 'edit-redo.png' book['status'] = 'Update' + if book_id and mi: # book_id and mi only set if matched by title/author. + liburl = self.get_story_url(db,book_id) + if book['url'] != liburl: + if collision in (OVERWRITE,OVERWRITEALWAYS): + updat="overwrit" + else: + updat="updat" + if not question_dialog(self.gui, 'Change Story URL?', + '

Change Story URL?

'+ + '

%s by %s is already in your library with a different source URL:

'% + (mi.title,', '.join(mi.author))+ + '

In library: %(liburl)s

New URL: %(newurl)s

'% + {'liburl':liburl,'newurl':book['url']}+ + "

Click 'Yes' to %se book with new URL.

"%updat+ + "

Click 'No' to skip %sing this book.

"%updat, + show_copy_button=False): + book['comment'] = "Update declined by user due to differing story URL(%s)"%liburl + book['good']=False + book['icon']='rotate-right.png' + book['status'] = 'Different URL' + return + if book_id != None and collision != ADDNEW: if collision in (CALIBREONLY): book['comment'] = 'Metadata collected.' @@ -891,24 +913,6 @@ class FanFictionDownLoaderPlugin(InterfaceAction): print("existing epub tmp:"+tmp.name) book['epub_for_update'] = tmp.name - if book_id and mi: # book_id and mi only set if matched by title/author. - liburl = self.get_story_url(db,book_id) - if book['url'] != liburl: - if not question_dialog(self.gui, 'Change Story URL?', - '

Change Story URL?

'+ - '

%s by %s is already in your library with a different source URL:

'% - (mi.title,', '.join(mi.author))+ - '

In library: %s

New URL: %s

'% - (liburl,book['url'])+ - "

Click 'Yes' to change book to new URL.

"+ - "

Click 'No' to skip updating this book.

", - show_copy_button=False): - book['comment'] = "Update declined by user due to differing story URL(%s)"%liburl - book['good']=False - book['icon']='rotate-right.png' - book['status'] = 'Different URL' - return - if book_id != None and prefs['injectseries']: mi = db.get_metadata(book_id,index_is_id=True) if not book['series'] and mi.series != None: