This commit is contained in:
Kovid Goyal 2012-04-10 19:22:27 +05:30
parent 396ad1c9dd
commit ad764f3cd9
2 changed files with 8 additions and 3 deletions

View File

@ -413,8 +413,14 @@ class USBMS(CLI, Device):
return '(.+?)'
s = set()
f = functools.partial(replfunc, seen=s)
template = None
try:
template = cls.save_template().rpartition('/')[2]
return re.compile(re.sub('{([^}]*)}', f, template) + '([_\d]*$)')
except:
prints(u'Failed to parse template: %r'%template)
template = u'{title} - {authors}'
return re.compile(re.sub('{([^}]*)}', f, template) + '([_\d]*$)')
@classmethod
def path_to_unicode(cls, path):

View File

@ -63,7 +63,6 @@ class MOBIFile(object):
self.raw_text = b''.join(r.raw for r in self.text_records)
self.header = self.mf.mobi8_header
self.kf8_records = mf.records[offset:]
self.extract_resources()
self.read_fdst()