mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Pull from trunk
This commit is contained in:
commit
b37c0e1252
@ -248,6 +248,9 @@ class OutputProfile(Plugin):
|
|||||||
#: If True, the date is appended to the title of downloaded news
|
#: If True, the date is appended to the title of downloaded news
|
||||||
periodical_date_in_title = True
|
periodical_date_in_title = True
|
||||||
|
|
||||||
|
#: The character used to represent a star in ratings
|
||||||
|
ratings_char = u'*'
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tags_to_string(cls, tags):
|
def tags_to_string(cls, tags):
|
||||||
return escape(', '.join(tags))
|
return escape(', '.join(tags))
|
||||||
@ -273,6 +276,7 @@ class iPadOutput(OutputProfile):
|
|||||||
'macros': {'border-width': '{length}|medium|thick|thin'}
|
'macros': {'border-width': '{length}|medium|thick|thin'}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
ratings_char = u'\u2605'
|
||||||
touchscreen = True
|
touchscreen = True
|
||||||
# touchscreen_news_css {{{
|
# touchscreen_news_css {{{
|
||||||
touchscreen_news_css = u'''
|
touchscreen_news_css = u'''
|
||||||
@ -553,10 +557,11 @@ class KindleOutput(OutputProfile):
|
|||||||
fsizes = [12, 12, 14, 16, 18, 20, 22, 24]
|
fsizes = [12, 12, 14, 16, 18, 20, 22, 24]
|
||||||
supports_mobi_indexing = True
|
supports_mobi_indexing = True
|
||||||
periodical_date_in_title = False
|
periodical_date_in_title = False
|
||||||
|
ratings_char = u'\u2605'
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tags_to_string(cls, tags):
|
def tags_to_string(cls, tags):
|
||||||
return u'%s <br/><span style="color: white">%s</span>' % (', '.join(tags),
|
return u'%s <br/><span style="color:white">%s</span>' % (', '.join(tags),
|
||||||
'ttt '.join(tags)+'ttt ')
|
'ttt '.join(tags)+'ttt ')
|
||||||
|
|
||||||
class KindleDXOutput(OutputProfile):
|
class KindleDXOutput(OutputProfile):
|
||||||
|
@ -208,8 +208,8 @@ class ITUNES(DriverBase):
|
|||||||
for (j,p_book) in enumerate(self.update_list):
|
for (j,p_book) in enumerate(self.update_list):
|
||||||
if False:
|
if False:
|
||||||
if isosx:
|
if isosx:
|
||||||
self.log.info(" looking for %s" %
|
self.log.info(" looking for '%s' by %s uuid:%s" %
|
||||||
str(p_book['lib_book'])[-9:])
|
(p_book['title'],p_book['author'], p_book['uuid']))
|
||||||
elif iswindows:
|
elif iswindows:
|
||||||
self.log.info(" looking for '%s' by %s (%s)" %
|
self.log.info(" looking for '%s' by %s (%s)" %
|
||||||
(p_book['title'],p_book['author'], p_book['uuid']))
|
(p_book['title'],p_book['author'], p_book['uuid']))
|
||||||
@ -304,7 +304,7 @@ class ITUNES(DriverBase):
|
|||||||
this_book.device_collections = []
|
this_book.device_collections = []
|
||||||
this_book.library_id = library_books[this_book.path] if this_book.path in library_books else None
|
this_book.library_id = library_books[this_book.path] if this_book.path in library_books else None
|
||||||
this_book.size = book.size()
|
this_book.size = book.size()
|
||||||
this_book.uuid = book.album()
|
this_book.uuid = book.composer()
|
||||||
# Hack to discover if we're running in GUI environment
|
# Hack to discover if we're running in GUI environment
|
||||||
if self.report_progress is not None:
|
if self.report_progress is not None:
|
||||||
this_book.thumbnail = self._generate_thumbnail(this_book.path, book)
|
this_book.thumbnail = self._generate_thumbnail(this_book.path, book)
|
||||||
@ -733,15 +733,15 @@ class ITUNES(DriverBase):
|
|||||||
for path in paths:
|
for path in paths:
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
self._dump_cached_book(self.cached_books[path], indent=2)
|
self._dump_cached_book(self.cached_books[path], indent=2)
|
||||||
self.log.info(" looking for '%s' by '%s' (%s)" %
|
self.log.info(" looking for '%s' by '%s' uuid:%s" %
|
||||||
(self.cached_books[path]['title'],
|
(self.cached_books[path]['title'],
|
||||||
self.cached_books[path]['author'],
|
self.cached_books[path]['author'],
|
||||||
self.cached_books[path]['uuid']))
|
self.cached_books[path]['uuid']))
|
||||||
|
|
||||||
# Purge the booklist, self.cached_books, thumb cache
|
# Purge the booklist, self.cached_books, thumb cache
|
||||||
for i,bl_book in enumerate(booklists[0]):
|
for i,bl_book in enumerate(booklists[0]):
|
||||||
if False:
|
if DEBUG:
|
||||||
self.log.info(" evaluating '%s' by '%s' (%s)" %
|
self.log.info(" evaluating '%s' by '%s' uuid:%s" %
|
||||||
(bl_book.title, bl_book.author,bl_book.uuid))
|
(bl_book.title, bl_book.author,bl_book.uuid))
|
||||||
|
|
||||||
found = False
|
found = False
|
||||||
@ -782,10 +782,10 @@ class ITUNES(DriverBase):
|
|||||||
zf.close()
|
zf.close()
|
||||||
|
|
||||||
break
|
break
|
||||||
# else:
|
else:
|
||||||
# if DEBUG:
|
if DEBUG:
|
||||||
# self.log.error(" unable to find '%s' by '%s' (%s)" %
|
self.log.error(" unable to find '%s' by '%s' (%s)" %
|
||||||
# (bl_book.title, bl_book.author,bl_book.uuid))
|
(bl_book.title, bl_book.author,bl_book.uuid))
|
||||||
|
|
||||||
if False:
|
if False:
|
||||||
self._dump_booklist(booklists[0], indent = 2)
|
self._dump_booklist(booklists[0], indent = 2)
|
||||||
@ -906,7 +906,8 @@ class ITUNES(DriverBase):
|
|||||||
|
|
||||||
# Add new_book to self.cached_books
|
# Add new_book to self.cached_books
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
self.log.info(" adding '%s' by '%s' ['%s'] to self.cached_books" %
|
self.log.info("ITUNES.upload_books()")
|
||||||
|
self.log.info(" adding '%s' by '%s' uuid:%s to self.cached_books" %
|
||||||
( metadata[i].title, metadata[i].author, metadata[i].uuid))
|
( metadata[i].title, metadata[i].author, metadata[i].uuid))
|
||||||
self.cached_books[this_book.path] = {
|
self.cached_books[this_book.path] = {
|
||||||
'author': metadata[i].author,
|
'author': metadata[i].author,
|
||||||
@ -944,7 +945,11 @@ class ITUNES(DriverBase):
|
|||||||
new_booklist.append(this_book)
|
new_booklist.append(this_book)
|
||||||
self._update_iTunes_metadata(metadata[i], db_added, lb_added, this_book)
|
self._update_iTunes_metadata(metadata[i], db_added, lb_added, this_book)
|
||||||
|
|
||||||
# Add new_book to self.cached_paths
|
# Add new_book to self.cached_books
|
||||||
|
if DEBUG:
|
||||||
|
self.log.info("ITUNES.upload_books()")
|
||||||
|
self.log.info(" adding '%s' by '%s' uuid:%s to self.cached_books" %
|
||||||
|
( metadata[i].title, metadata[i].author, metadata[i].uuid))
|
||||||
self.cached_books[this_book.path] = {
|
self.cached_books[this_book.path] = {
|
||||||
'author': metadata[i].author[0],
|
'author': metadata[i].author[0],
|
||||||
'dev_book': db_added,
|
'dev_book': db_added,
|
||||||
@ -1407,8 +1412,8 @@ class ITUNES(DriverBase):
|
|||||||
|
|
||||||
for book in booklist:
|
for book in booklist:
|
||||||
if isosx:
|
if isosx:
|
||||||
self.log.info("%s%-40.40s %-30.30s %-10.10s" %
|
self.log.info("%s%-40.40s %-30.30s %-10.10s %s" %
|
||||||
(' '*indent,book.title, book.author, str(book.library_id)[-9:]))
|
(' '*indent,book.title, book.author, str(book.library_id)[-9:], book.uuid))
|
||||||
elif iswindows:
|
elif iswindows:
|
||||||
self.log.info("%s%-40.40s %-30.30s" %
|
self.log.info("%s%-40.40s %-30.30s" %
|
||||||
(' '*indent,book.title, book.author))
|
(' '*indent,book.title, book.author))
|
||||||
@ -1548,11 +1553,12 @@ class ITUNES(DriverBase):
|
|||||||
|
|
||||||
if isosx:
|
if isosx:
|
||||||
for ub in self.update_list:
|
for ub in self.update_list:
|
||||||
self.log.info("%s%-40.40s %-30.30s %-10.10s" %
|
self.log.info("%s%-40.40s %-30.30s %-10.10s %s" %
|
||||||
(' '*indent,
|
(' '*indent,
|
||||||
ub['title'],
|
ub['title'],
|
||||||
ub['author'],
|
ub['author'],
|
||||||
str(ub['lib_book'])[-9:]))
|
str(ub['lib_book'])[-9:],
|
||||||
|
ub['uuid']))
|
||||||
elif iswindows:
|
elif iswindows:
|
||||||
for ub in self.update_list:
|
for ub in self.update_list:
|
||||||
self.log.info("%s%-40.40s %-30.30s" %
|
self.log.info("%s%-40.40s %-30.30s" %
|
||||||
@ -2805,7 +2811,7 @@ class ITUNES_ASYNC(ITUNES):
|
|||||||
#this_book.library_id = library_books[this_book.path] if this_book.path in library_books else None
|
#this_book.library_id = library_books[this_book.path] if this_book.path in library_books else None
|
||||||
this_book.library_id = library_books[book]
|
this_book.library_id = library_books[book]
|
||||||
this_book.size = library_books[book].size()
|
this_book.size = library_books[book].size()
|
||||||
this_book.uuid = library_books[book].album()
|
this_book.uuid = library_books[book].composer()
|
||||||
# Hack to discover if we're running in GUI environment
|
# Hack to discover if we're running in GUI environment
|
||||||
if self.report_progress is not None:
|
if self.report_progress is not None:
|
||||||
this_book.thumbnail = self._generate_thumbnail(this_book.path, library_books[book])
|
this_book.thumbnail = self._generate_thumbnail(this_book.path, library_books[book])
|
||||||
@ -2845,6 +2851,7 @@ class ITUNES_ASYNC(ITUNES):
|
|||||||
this_book.device_collections = []
|
this_book.device_collections = []
|
||||||
this_book.library_id = library_books[book]
|
this_book.library_id = library_books[book]
|
||||||
this_book.size = library_books[book].Size
|
this_book.size = library_books[book].Size
|
||||||
|
this_book.uuid = library_books[book].Composer
|
||||||
# Hack to discover if we're running in GUI environment
|
# Hack to discover if we're running in GUI environment
|
||||||
if self.report_progress is not None:
|
if self.report_progress is not None:
|
||||||
this_book.thumbnail = self._generate_thumbnail(this_book.path, library_books[book])
|
this_book.thumbnail = self._generate_thumbnail(this_book.path, library_books[book])
|
||||||
|
@ -93,7 +93,7 @@ class Jacket(object):
|
|||||||
|
|
||||||
# Render Jacket {{{
|
# Render Jacket {{{
|
||||||
|
|
||||||
def get_rating(rating):
|
def get_rating(rating, rchar):
|
||||||
ans = ''
|
ans = ''
|
||||||
try:
|
try:
|
||||||
num = float(rating)/2
|
num = float(rating)/2
|
||||||
@ -104,7 +104,7 @@ def get_rating(rating):
|
|||||||
if num < 1:
|
if num < 1:
|
||||||
return ans
|
return ans
|
||||||
|
|
||||||
ans = u'\u2605' * int(num)
|
ans = rchar * int(num)
|
||||||
return ans
|
return ans
|
||||||
|
|
||||||
|
|
||||||
@ -129,7 +129,7 @@ def render_jacket(mi, output_profile,
|
|||||||
except:
|
except:
|
||||||
pubdate = ''
|
pubdate = ''
|
||||||
|
|
||||||
rating = get_rating(mi.rating)
|
rating = get_rating(mi.rating, output_profile.ratings_char)
|
||||||
|
|
||||||
tags = mi.tags if mi.tags else alt_tags
|
tags = mi.tags if mi.tags else alt_tags
|
||||||
if tags:
|
if tags:
|
||||||
|
@ -41,24 +41,17 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="4" column="0">
|
||||||
<widget class="QCheckBox" name="opt_insert_metadata">
|
<widget class="QCheckBox" name="opt_insert_metadata">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Insert &metadata as page at start of book</string>
|
<string>Insert &metadata as page at start of book</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="0" colspan="2">
|
<item row="10" column="0" colspan="2">
|
||||||
<widget class="QCheckBox" name="opt_preprocess_html">
|
|
||||||
<property name="text">
|
|
||||||
<string>&Preprocess input file to possibly improve structure detection</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="9" column="0" colspan="2">
|
|
||||||
<widget class="XPathEdit" name="opt_page_breaks_before" native="true"/>
|
<widget class="XPathEdit" name="opt_page_breaks_before" native="true"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="10" column="0" colspan="2">
|
<item row="11" column="0" colspan="2">
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
@ -71,26 +64,33 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="0">
|
<item row="7" column="0">
|
||||||
<widget class="QCheckBox" name="opt_remove_footer">
|
<widget class="QCheckBox" name="opt_remove_footer">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Remove F&ooter</string>
|
<string>Remove F&ooter</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0">
|
<item row="5" column="0">
|
||||||
<widget class="QCheckBox" name="opt_remove_header">
|
<widget class="QCheckBox" name="opt_remove_header">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Remove H&eader</string>
|
<string>Remove H&eader</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0" colspan="2">
|
<item row="6" column="0" colspan="2">
|
||||||
<widget class="RegexEdit" name="opt_header_regex" native="true"/>
|
<widget class="RegexEdit" name="opt_header_regex" native="true"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="0" colspan="2">
|
<item row="8" column="0" colspan="2">
|
||||||
<widget class="RegexEdit" name="opt_footer_regex" native="true"/>
|
<widget class="RegexEdit" name="opt_footer_regex" native="true"/>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QCheckBox" name="opt_preprocess_html">
|
||||||
|
<property name="text">
|
||||||
|
<string>&Preprocess input file to possibly improve structure detection</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user