From eea093014cf24162b852d4b4555f00bb919cffa6 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 7 Nov 2008 13:11:33 -0800 Subject: [PATCH] Fix regression affecting conversion of CBR files in the GUI. Use absolute URLs in the content server to facilitate reverse proxying --- src/calibre/gui2/tools.py | 10 ++++++---- src/calibre/library/database2.py | 4 +++- src/calibre/library/static/gui.js | 7 ++++--- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/calibre/gui2/tools.py b/src/calibre/gui2/tools.py index d8497c9713..0e0d15d0d3 100644 --- a/src/calibre/gui2/tools.py +++ b/src/calibre/gui2/tools.py @@ -62,7 +62,8 @@ def convert_single_epub(parent, db, comics, others): for fmt in ['cbz', 'cbr']: try: data = db.format(row, fmt.upper()) - break + if data is not None: + break except: continue pt = PersistentTemporaryFile('.'+fmt) @@ -121,7 +122,8 @@ def convert_single_lrf(parent, db, comics, others): for fmt in ['cbz', 'cbr']: try: data = db.format(row, fmt.upper()) - break + if data is not None: + break except: continue if data is None: @@ -207,7 +209,7 @@ def convert_bulk_epub(parent, db, comics, others): for fmt in ['cbz', 'cbr']: try: data = db.format(row, fmt.upper()) - if data: + if data is not None: break except: continue @@ -302,7 +304,7 @@ def convert_bulk_lrf(parent, db, comics, others): for fmt in ['cbz', 'cbr']: try: data = db.format(row, fmt.upper()) - if data: + if data is not None: break except: continue diff --git a/src/calibre/library/database2.py b/src/calibre/library/database2.py index 382c423cff..87f37416af 100644 --- a/src/calibre/library/database2.py +++ b/src/calibre/library/database2.py @@ -1159,7 +1159,9 @@ books_series_link feeds rows = db.conn.get('SELECT * FROM %s ORDER BY id ASC'%table) for row in rows: self.conn.execute('INSERT INTO %s VALUES(%s)'%(table, ','.join(repeat('?', len(row)))), row) - + + self.conn.commit() + self.refresh('timestamp', True) for i, book in enumerate(books): progress.setLabelText(header+_(u'Copying %s')%book[1]) id = book[0] diff --git a/src/calibre/library/static/gui.js b/src/calibre/library/static/gui.js index 07f393bc42..d6df4d32f7 100644 --- a/src/calibre/library/static/gui.js +++ b/src/calibre/library/static/gui.js @@ -40,7 +40,8 @@ function create_table_headers() { function format_url(format, id, title) { - return '/get/'+format.toLowerCase() + '/'+title + '_' + id+'.'+format.toLowerCase(); + return self.location.pathname.substring(0,self.location.pathname.lastIndexOf('/')) + + '/get/'+format.toLowerCase() + '/'+title + '_' + id+'.'+format.toLowerCase(); } function render_book(book) { @@ -60,7 +61,7 @@ function render_book(book) { title += ' ({0} MB) '.format(size); } if (tags) title += '[{0}]'.format(tags); - title += ''.format(id); + title += ''.format(id, self.location.pathname.substring(0,self.location.pathname.lastIndexOf('/'))); title += '

{0}

'.format(comments) // Render authors cell var _authors = new Array(); @@ -123,7 +124,7 @@ function fetch_library_books(start, num, timeout, sort, order, search) { current_library_request = $.ajax({ type: "GET", - url: "/library", + url: self.location.pathname.substring(0,self.location.pathname.lastIndexOf('/'))+"/library", data: data, cache: false, timeout: timeout, //milliseconds