Pull from trunk

This commit is contained in:
Kovid Goyal 2010-09-15 10:06:39 -06:00
commit b37c0e1252
4 changed files with 47 additions and 35 deletions

View File

@ -248,6 +248,9 @@ class OutputProfile(Plugin):
#: If True, the date is appended to the title of downloaded news
periodical_date_in_title = True
#: The character used to represent a star in ratings
ratings_char = u'*'
@classmethod
def tags_to_string(cls, tags):
return escape(', '.join(tags))
@ -273,6 +276,7 @@ class iPadOutput(OutputProfile):
'macros': {'border-width': '{length}|medium|thick|thin'}
}
]
ratings_char = u'\u2605'
touchscreen = True
# touchscreen_news_css {{{
touchscreen_news_css = u'''
@ -553,10 +557,11 @@ class KindleOutput(OutputProfile):
fsizes = [12, 12, 14, 16, 18, 20, 22, 24]
supports_mobi_indexing = True
periodical_date_in_title = False
ratings_char = u'\u2605'
@classmethod
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 ')
class KindleDXOutput(OutputProfile):

View File

@ -208,8 +208,8 @@ class ITUNES(DriverBase):
for (j,p_book) in enumerate(self.update_list):
if False:
if isosx:
self.log.info(" looking for %s" %
str(p_book['lib_book'])[-9:])
self.log.info(" looking for '%s' by %s uuid:%s" %
(p_book['title'],p_book['author'], p_book['uuid']))
elif iswindows:
self.log.info(" looking for '%s' by %s (%s)" %
(p_book['title'],p_book['author'], p_book['uuid']))
@ -304,7 +304,7 @@ class ITUNES(DriverBase):
this_book.device_collections = []
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.uuid = book.album()
this_book.uuid = book.composer()
# Hack to discover if we're running in GUI environment
if self.report_progress is not None:
this_book.thumbnail = self._generate_thumbnail(this_book.path, book)
@ -733,15 +733,15 @@ class ITUNES(DriverBase):
for path in paths:
if DEBUG:
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]['author'],
self.cached_books[path]['uuid']))
# Purge the booklist, self.cached_books, thumb cache
for i,bl_book in enumerate(booklists[0]):
if False:
self.log.info(" evaluating '%s' by '%s' (%s)" %
if DEBUG:
self.log.info(" evaluating '%s' by '%s' uuid:%s" %
(bl_book.title, bl_book.author,bl_book.uuid))
found = False
@ -782,10 +782,10 @@ class ITUNES(DriverBase):
zf.close()
break
# else:
# if DEBUG:
# self.log.error(" unable to find '%s' by '%s' (%s)" %
# (bl_book.title, bl_book.author,bl_book.uuid))
else:
if DEBUG:
self.log.error(" unable to find '%s' by '%s' (%s)" %
(bl_book.title, bl_book.author,bl_book.uuid))
if False:
self._dump_booklist(booklists[0], indent = 2)
@ -906,7 +906,8 @@ class ITUNES(DriverBase):
# Add new_book to self.cached_books
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))
self.cached_books[this_book.path] = {
'author': metadata[i].author,
@ -944,7 +945,11 @@ class ITUNES(DriverBase):
new_booklist.append(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] = {
'author': metadata[i].author[0],
'dev_book': db_added,
@ -1407,8 +1412,8 @@ class ITUNES(DriverBase):
for book in booklist:
if isosx:
self.log.info("%s%-40.40s %-30.30s %-10.10s" %
(' '*indent,book.title, book.author, str(book.library_id)[-9:]))
self.log.info("%s%-40.40s %-30.30s %-10.10s %s" %
(' '*indent,book.title, book.author, str(book.library_id)[-9:], book.uuid))
elif iswindows:
self.log.info("%s%-40.40s %-30.30s" %
(' '*indent,book.title, book.author))
@ -1548,11 +1553,12 @@ class ITUNES(DriverBase):
if isosx:
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,
ub['title'],
ub['author'],
str(ub['lib_book'])[-9:]))
str(ub['lib_book'])[-9:],
ub['uuid']))
elif iswindows:
for ub in self.update_list:
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[book]
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
if self.report_progress is not None:
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.library_id = library_books[book]
this_book.size = library_books[book].Size
this_book.uuid = library_books[book].Composer
# Hack to discover if we're running in GUI environment
if self.report_progress is not None:
this_book.thumbnail = self._generate_thumbnail(this_book.path, library_books[book])

View File

@ -93,7 +93,7 @@ class Jacket(object):
# Render Jacket {{{
def get_rating(rating):
def get_rating(rating, rchar):
ans = ''
try:
num = float(rating)/2
@ -104,7 +104,7 @@ def get_rating(rating):
if num < 1:
return ans
ans = u'\u2605' * int(num)
ans = rchar * int(num)
return ans
@ -129,7 +129,7 @@ def render_jacket(mi, output_profile,
except:
pubdate = ''
rating = get_rating(mi.rating)
rating = get_rating(mi.rating, output_profile.ratings_char)
tags = mi.tags if mi.tags else alt_tags
if tags:

View File

@ -41,24 +41,17 @@
</property>
</widget>
</item>
<item row="3" column="0">
<item row="4" column="0">
<widget class="QCheckBox" name="opt_insert_metadata">
<property name="text">
<string>Insert &amp;metadata as page at start of book</string>
</property>
</widget>
</item>
<item row="8" column="0" colspan="2">
<widget class="QCheckBox" name="opt_preprocess_html">
<property name="text">
<string>&amp;Preprocess input file to possibly improve structure detection</string>
</property>
</widget>
</item>
<item row="9" column="0" colspan="2">
<item row="10" column="0" colspan="2">
<widget class="XPathEdit" name="opt_page_breaks_before" native="true"/>
</item>
<item row="10" column="0" colspan="2">
<item row="11" column="0" colspan="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -71,26 +64,33 @@
</property>
</spacer>
</item>
<item row="6" column="0">
<item row="7" column="0">
<widget class="QCheckBox" name="opt_remove_footer">
<property name="text">
<string>Remove F&amp;ooter</string>
</property>
</widget>
</item>
<item row="4" column="0">
<item row="5" column="0">
<widget class="QCheckBox" name="opt_remove_header">
<property name="text">
<string>Remove H&amp;eader</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<item row="6" column="0" colspan="2">
<widget class="RegexEdit" name="opt_header_regex" native="true"/>
</item>
<item row="7" column="0" colspan="2">
<item row="8" column="0" colspan="2">
<widget class="RegexEdit" name="opt_footer_regex" native="true"/>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="opt_preprocess_html">
<property name="text">
<string>&amp;Preprocess input file to possibly improve structure detection</string>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>