diff --git a/src/calibre/devices/htc_td2/driver.py b/src/calibre/devices/htc_td2/driver.py index fc3a0d1839..9a83e32961 100644 --- a/src/calibre/devices/htc_td2/driver.py +++ b/src/calibre/devices/htc_td2/driver.py @@ -4,7 +4,6 @@ __license__ = 'GPL v3' __copyright__ = '2009, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import os from calibre.devices.usbms.driver import USBMS class HTC_TD2(USBMS): @@ -13,7 +12,7 @@ class HTC_TD2(USBMS): gui_name = 'HTC TD2' description = _('Communicate with HTC TD2 phones.') author = 'Charles Haley' - supported_platforms = ['windows'] + supported_platforms = ['osx', 'linux'] # Ordered list of supported formats FORMATS = ['epub', 'pdf'] @@ -31,8 +30,7 @@ class HTC_TD2(USBMS): VENDOR_NAME = [''] WINDOWS_MAIN_MEM = [''] -# OSX_MAIN_MEM = 'HTC TD2 Phone Media' -# MAIN_MEMORY_VOLUME_LABEL = 'HTC Phone Internal Memory' + MAIN_MEMORY_VOLUME_LABEL = 'HTC Phone Internal Memory' SUPPORTS_SUB_DIRS = True diff --git a/src/calibre/devices/usbms/books.py b/src/calibre/devices/usbms/books.py index 6c88f7247d..eca9a27096 100644 --- a/src/calibre/devices/usbms/books.py +++ b/src/calibre/devices/usbms/books.py @@ -11,6 +11,7 @@ import time from calibre.ebooks.metadata import MetaInformation from calibre.devices.mime import mime_type_ext from calibre.devices.interface import BookList as _BookList +from calibre.constants import filesystem_encoding class Book(MetaInformation): @@ -51,7 +52,7 @@ class Book(MetaInformation): spath = unicode(self.path) except: try: - spath = self.path.decode('utf-8') + spath = self.path.decode(filesystem_encoding) except: spath = self.path if not isinstance(other.path, unicode): @@ -59,7 +60,7 @@ class Book(MetaInformation): opath = unicode(other.path) except: try: - opath = other.path.decode('utf-8') + opath = other.path.decode(filesystem_encoding) except: opath = other.path diff --git a/src/calibre/devices/usbms/driver.py b/src/calibre/devices/usbms/driver.py index 8cb70f410b..0d3779a309 100644 --- a/src/calibre/devices/usbms/driver.py +++ b/src/calibre/devices/usbms/driver.py @@ -14,7 +14,6 @@ import os import re import json from itertools import cycle -from calibre.utils.date import now from calibre.devices.usbms.cli import CLI from calibre.devices.usbms.device import Device @@ -38,7 +37,6 @@ class USBMS(CLI, Device): def books(self, oncard=None, end_session=True): from calibre.ebooks.metadata.meta import path_to_ext - start_time = now() bl = BookList() metadata = BookList() need_sync = False @@ -58,16 +56,13 @@ class USBMS(CLI, Device): self.EBOOK_DIR_CARD_B if oncard == 'cardb' else \ self.get_main_ebook_dir() - #print 'after booklist get', now() - start_time bl, need_sync = self.parse_metadata_cache(prefix, self.METADATA_CACHE) - #print 'after parse_metadata_cache', now() - start_time # make a dict cache of paths so the lookup in the loop below is faster. bl_cache = {} for idx,b in enumerate(bl): bl_cache[b.path] = idx self.count_found_in_bl = 0 - #print 'after make cache', now() - start_time def update_booklist(filename, path, prefix): changed = False @@ -122,7 +117,6 @@ class USBMS(CLI, Device): self.sync_booklists((metadata, None, None)) self.report_progress(1.0, _('Getting list of books on device...')) - #print 'at return', now() - start_time return metadata def upload_books(self, files, names, on_card=None, end_session=True, @@ -218,7 +212,6 @@ class USBMS(CLI, Device): self.report_progress(1.0, _('Removing books from device metadata listing...')) def sync_booklists(self, booklists, end_session=True): - print 'in sync_booklists' if not os.path.exists(self._main_prefix): os.makedirs(self._main_prefix) @@ -270,7 +263,6 @@ class USBMS(CLI, Device): @classmethod def metadata_from_path(cls, path): - print 'here' return cls.metadata_from_formats([path]) @classmethod diff --git a/src/calibre/ebooks/metadata/__init__.py b/src/calibre/ebooks/metadata/__init__.py index c6f08b6f0f..60dffc0cf7 100644 --- a/src/calibre/ebooks/metadata/__init__.py +++ b/src/calibre/ebooks/metadata/__init__.py @@ -10,7 +10,7 @@ import os, mimetypes, sys, re from urllib import unquote, quote from urlparse import urlparse -from calibre import relpath +from calibre import relpath, prints from calibre.utils.config import tweaks from calibre.utils.date import isoformat @@ -254,14 +254,13 @@ class MetaInformation(object): setattr(self, x, getattr(mi, x, None)) def print_all_attributes(self): - print 'here' for x in ('author_sort', 'title_sort', 'comments', 'category', 'publisher', 'series', 'series_index', 'rating', 'isbn', 'language', 'application_id', 'manifest', 'toc', 'spine', 'guide', 'cover', 'book_producer', 'timestamp', 'lccn', 'lcc', 'ddc', 'pubdate', 'rights', 'publication_type', 'uuid', ): - print x, getattr(self, x, 'None') + prints(x, getattr(self, x, 'None')) def smart_update(self, mi): ''' diff --git a/src/calibre/gui2/library.py b/src/calibre/gui2/library.py index 9fa77a02ba..cdebf65489 100644 --- a/src/calibre/gui2/library.py +++ b/src/calibre/gui2/library.py @@ -17,7 +17,7 @@ from PyQt4.QtCore import QAbstractTableModel, QVariant, Qt, pyqtSignal, \ SIGNAL, QObject, QSize, QModelIndex, QDate from calibre import strftime -from calibre.ebooks.metadata import string_to_authors, fmt_sidx, authors_to_string +from calibre.ebooks.metadata import fmt_sidx, authors_to_string from calibre.ebooks.metadata.meta import set_metadata as _set_metadata from calibre.gui2 import NONE, TableView, config, error_dialog, UNDEFINED_QDATE from calibre.gui2.dialogs.comments_dialog import CommentsDialog diff --git a/src/calibre/gui2/main.py b/src/calibre/gui2/main.py index c261c38dcf..c47c821913 100644 --- a/src/calibre/gui2/main.py +++ b/src/calibre/gui2/main.py @@ -73,7 +73,7 @@ def get_library_path(): except: error_dialog(None, _('Failed to create library'), _('Failed to create calibre library at: %r. Aborting.')%library_path, - det_msg = traceback.print_exc(), show=True) + det_msg=traceback.format_exc(), show=True) library_path = None return library_path diff --git a/src/calibre/manual/conversion.rst b/src/calibre/manual/conversion.rst index 6180f2a3ed..acaf5ab238 100644 --- a/src/calibre/manual/conversion.rst +++ b/src/calibre/manual/conversion.rst @@ -533,3 +533,17 @@ The .cbc file will then contain:: |app| will automatically convert this .cbc file into a e-book with a Table of Contents pointing to each entry in comics.txt. + +EPUB advanced formatting demo +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Various advanced formatting for EPUB files is demonstrated in this `demo file `_. +The file was created from hand coded HTML using calibre and is meant to be used as a template for your own EPUB creation efforts. + +The source HTML it was created from is available `here `_. The settings used to create the +EPUB from the ZIP file are:: + + ebook-convert demo.zip .epub -vv --authors "Kovid Goyal" --language en --level1-toc '//*[@class="title"]' --disable-font-rescaling --page-breaks-before / --no-default-epub-cover + +Note that because this file explores the potential of EPUB, most of the advanced formatting is not going to work on readers less capable than |app|'s builtin EPUB viewer. + diff --git a/src/calibre/web/feeds/news.py b/src/calibre/web/feeds/news.py index 4bf7950d7f..46e8cd005d 100644 --- a/src/calibre/web/feeds/news.py +++ b/src/calibre/web/feeds/news.py @@ -1266,7 +1266,7 @@ class BasicNewsRecipe(Recipe): feed = Feed() msg = 'Failed feed: %s'%(title if title else url) feed.populate_from_preparsed_feed(msg, []) - feed.description = unicode(err) + feed.description = repr(err) parsed_feeds.append(feed) self.log.exception(msg)