mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Merge from trunk
This commit is contained in:
commit
f939e9aaef
@ -28,7 +28,7 @@ class OldNewThing(BasicNewsRecipe):
|
|||||||
}
|
}
|
||||||
|
|
||||||
remove_attributes = ['width','height']
|
remove_attributes = ['width','height']
|
||||||
keep_only_tags = [dict(attrs={'class':['postsub','comment']})]
|
keep_only_tags = [dict(attrs={'class':'full-post'})]
|
||||||
|
remove_tags = [dict(attrs={'class':['post-attributes','post-tags','post-actions']})]
|
||||||
feeds = [(u'Posts', u'http://blogs.msdn.com/oldnewthing/rss.xml')]
|
feeds = [(u'Posts', u'http://blogs.msdn.com/oldnewthing/rss.xml')]
|
||||||
|
|
||||||
|
@ -153,6 +153,18 @@
|
|||||||
<Property Id="WixShellExecTarget" Value="[#{exe_map[calibre]}]" />
|
<Property Id="WixShellExecTarget" Value="[#{exe_map[calibre]}]" />
|
||||||
<CustomAction Id="LaunchApplication" BinaryKey="WixCA"
|
<CustomAction Id="LaunchApplication" BinaryKey="WixCA"
|
||||||
DllEntry="WixShellExec" Impersonate="yes"/>
|
DllEntry="WixShellExec" Impersonate="yes"/>
|
||||||
|
<InstallExecuteSequence>
|
||||||
|
<FileCost Suppress="yes" />
|
||||||
|
</InstallExecuteSequence>
|
||||||
|
<InstallUISequence>
|
||||||
|
<FileCost Suppress="yes" />
|
||||||
|
</InstallUISequence>
|
||||||
|
<AdminExecuteSequence>
|
||||||
|
<FileCost Suppress="yes" />
|
||||||
|
</AdminExecuteSequence>
|
||||||
|
<AdminUISequence>
|
||||||
|
<FileCost Suppress="yes" />
|
||||||
|
</AdminUISequence>
|
||||||
|
|
||||||
</Product>
|
</Product>
|
||||||
</Wix>
|
</Wix>
|
||||||
|
@ -2347,7 +2347,7 @@ class ITUNES(DriverBase):
|
|||||||
self.log.info(" add timestamp: %s" % metadata.timestamp)
|
self.log.info(" add timestamp: %s" % metadata.timestamp)
|
||||||
|
|
||||||
# Force the language declaration for iBooks 1.1
|
# Force the language declaration for iBooks 1.1
|
||||||
metadata.language = get_lang()
|
metadata.language = get_lang().replace('_', '-')
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
self.log.info(" rewriting language: <dc:language>%s</dc:language>" % metadata.language)
|
self.log.info(" rewriting language: <dc:language>%s</dc:language>" % metadata.language)
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ class CHMInput(InputFormatPlugin):
|
|||||||
metadata.add('identifier', mi.isbn, attrib={'scheme':'ISBN'})
|
metadata.add('identifier', mi.isbn, attrib={'scheme':'ISBN'})
|
||||||
if not metadata.language:
|
if not metadata.language:
|
||||||
oeb.logger.warn(u'Language not specified')
|
oeb.logger.warn(u'Language not specified')
|
||||||
metadata.add('language', get_lang())
|
metadata.add('language', get_lang().replace('_', '-'))
|
||||||
if not metadata.creator:
|
if not metadata.creator:
|
||||||
oeb.logger.warn('Creator not specified')
|
oeb.logger.warn('Creator not specified')
|
||||||
metadata.add('creator', _('Unknown'))
|
metadata.add('creator', _('Unknown'))
|
||||||
|
@ -151,6 +151,7 @@ cpalmdoc_do_compress(buffer *b, char *output) {
|
|||||||
for (j=0; j < temp.len; j++) *(output++) = (char)temp.data[j];
|
for (j=0; j < temp.len; j++) *(output++) = (char)temp.data[j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
PyMem_Free(temp.data);
|
||||||
return output - head;
|
return output - head;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,7 +169,9 @@ cpalmdoc_compress(PyObject *self, PyObject *args) {
|
|||||||
for (j = 0; j < input_len; j++)
|
for (j = 0; j < input_len; j++)
|
||||||
b.data[j] = (_input[j] < 0) ? _input[j]+256 : _input[j];
|
b.data[j] = (_input[j] < 0) ? _input[j]+256 : _input[j];
|
||||||
b.len = input_len;
|
b.len = input_len;
|
||||||
output = (char *)PyMem_Malloc(sizeof(char) * b.len);
|
// Make the output buffer larger than the input as sometimes
|
||||||
|
// compression results in a larger block
|
||||||
|
output = (char *)PyMem_Malloc(sizeof(char) * (int)(1.25*b.len));
|
||||||
if (output == NULL) return PyErr_NoMemory();
|
if (output == NULL) return PyErr_NoMemory();
|
||||||
j = cpalmdoc_do_compress(&b, output);
|
j = cpalmdoc_do_compress(&b, output);
|
||||||
if ( j == 0) return PyErr_NoMemory();
|
if ( j == 0) return PyErr_NoMemory();
|
||||||
|
@ -329,7 +329,7 @@ class HTMLInput(InputFormatPlugin):
|
|||||||
metadata.add('identifier', mi.isbn, attrib={'scheme':'ISBN'})
|
metadata.add('identifier', mi.isbn, attrib={'scheme':'ISBN'})
|
||||||
if not metadata.language:
|
if not metadata.language:
|
||||||
oeb.logger.warn(u'Language not specified')
|
oeb.logger.warn(u'Language not specified')
|
||||||
metadata.add('language', get_lang())
|
metadata.add('language', get_lang().replace('_', '-'))
|
||||||
if not metadata.creator:
|
if not metadata.creator:
|
||||||
oeb.logger.warn('Creator not specified')
|
oeb.logger.warn('Creator not specified')
|
||||||
metadata.add('creator', self.oeb.translate(__('Unknown')))
|
metadata.add('creator', self.oeb.translate(__('Unknown')))
|
||||||
|
@ -313,6 +313,8 @@ def search(title=None, author=None, publisher=None, isbn=None, isbndb_key=None,
|
|||||||
def sort_func(x, y):
|
def sort_func(x, y):
|
||||||
|
|
||||||
def cleanup_title(s):
|
def cleanup_title(s):
|
||||||
|
if s is None:
|
||||||
|
s = _('Unknown')
|
||||||
s = s.strip().lower()
|
s = s.strip().lower()
|
||||||
s = prefix_pat.sub(' ', s)
|
s = prefix_pat.sub(' ', s)
|
||||||
s = trailing_paren_pat.sub('', s)
|
s = trailing_paren_pat.sub('', s)
|
||||||
|
@ -1069,7 +1069,8 @@ class OPFCreator(MetaInformation):
|
|||||||
dc_attrs={'id':__appname__+'_id'}))
|
dc_attrs={'id':__appname__+'_id'}))
|
||||||
if getattr(self, 'pubdate', None) is not None:
|
if getattr(self, 'pubdate', None) is not None:
|
||||||
a(DC_ELEM('date', self.pubdate.isoformat()))
|
a(DC_ELEM('date', self.pubdate.isoformat()))
|
||||||
a(DC_ELEM('language', self.language if self.language else get_lang()))
|
a(DC_ELEM('language', self.language if self.language else
|
||||||
|
get_lang().replace('_', '-')))
|
||||||
if self.comments:
|
if self.comments:
|
||||||
a(DC_ELEM('description', self.comments))
|
a(DC_ELEM('description', self.comments))
|
||||||
if self.publisher:
|
if self.publisher:
|
||||||
@ -1194,7 +1195,8 @@ def metadata_to_opf(mi, as_string=True):
|
|||||||
factory(DC('identifier'), mi.isbn, scheme='ISBN')
|
factory(DC('identifier'), mi.isbn, scheme='ISBN')
|
||||||
if mi.rights:
|
if mi.rights:
|
||||||
factory(DC('rights'), mi.rights)
|
factory(DC('rights'), mi.rights)
|
||||||
factory(DC('language'), mi.language if mi.language and mi.language.lower() != 'und' else get_lang())
|
factory(DC('language'), mi.language if mi.language and mi.language.lower()
|
||||||
|
!= 'und' else get_lang().replace('_', '-'))
|
||||||
if mi.tags:
|
if mi.tags:
|
||||||
for tag in mi.tags:
|
for tag in mi.tags:
|
||||||
factory(DC('subject'), tag)
|
factory(DC('subject'), tag)
|
||||||
|
@ -131,7 +131,7 @@ class OEBReader(object):
|
|||||||
stream = cStringIO.StringIO(etree.tostring(opf))
|
stream = cStringIO.StringIO(etree.tostring(opf))
|
||||||
mi = MetaInformation(OPF(stream))
|
mi = MetaInformation(OPF(stream))
|
||||||
if not mi.language:
|
if not mi.language:
|
||||||
mi.language = get_lang()
|
mi.language = get_lang().replace('_', '-')
|
||||||
self.oeb.metadata.add('language', mi.language)
|
self.oeb.metadata.add('language', mi.language)
|
||||||
if not mi.title:
|
if not mi.title:
|
||||||
mi.title = self.oeb.translate(__('Unknown'))
|
mi.title = self.oeb.translate(__('Unknown'))
|
||||||
|
@ -103,7 +103,7 @@ class MetadataSingleDialog(ResizableDialog, Ui_MetadataSingleDialog):
|
|||||||
if _file:
|
if _file:
|
||||||
_file = os.path.abspath(_file)
|
_file = os.path.abspath(_file)
|
||||||
if not os.access(_file, os.R_OK):
|
if not os.access(_file, os.R_OK):
|
||||||
d = error_dialog(self.window, _('Cannot read'),
|
d = error_dialog(self, _('Cannot read'),
|
||||||
_('You do not have permission to read the file: ') + _file)
|
_('You do not have permission to read the file: ') + _file)
|
||||||
d.exec_()
|
d.exec_()
|
||||||
return
|
return
|
||||||
@ -112,14 +112,14 @@ class MetadataSingleDialog(ResizableDialog, Ui_MetadataSingleDialog):
|
|||||||
cf = open(_file, "rb")
|
cf = open(_file, "rb")
|
||||||
cover = cf.read()
|
cover = cf.read()
|
||||||
except IOError, e:
|
except IOError, e:
|
||||||
d = error_dialog(self.window, _('Error reading file'),
|
d = error_dialog(self, _('Error reading file'),
|
||||||
_("<p>There was an error reading from file: <br /><b>") + _file + "</b></p><br />"+str(e))
|
_("<p>There was an error reading from file: <br /><b>") + _file + "</b></p><br />"+str(e))
|
||||||
d.exec_()
|
d.exec_()
|
||||||
if cover:
|
if cover:
|
||||||
pix = QPixmap()
|
pix = QPixmap()
|
||||||
pix.loadFromData(cover)
|
pix.loadFromData(cover)
|
||||||
if pix.isNull():
|
if pix.isNull():
|
||||||
d = error_dialog(self.window,
|
d = error_dialog(self,
|
||||||
_("Not a valid picture"),
|
_("Not a valid picture"),
|
||||||
_file + _(" is not a valid picture"))
|
_file + _(" is not a valid picture"))
|
||||||
d.exec_()
|
d.exec_()
|
||||||
@ -162,7 +162,7 @@ class MetadataSingleDialog(ResizableDialog, Ui_MetadataSingleDialog):
|
|||||||
self.formats_changed = True
|
self.formats_changed = True
|
||||||
added = True
|
added = True
|
||||||
if bad_perms:
|
if bad_perms:
|
||||||
error_dialog(self.window, _('No permission'),
|
error_dialog(self, _('No permission'),
|
||||||
_('You do not have '
|
_('You do not have '
|
||||||
'permission to read the following files:'),
|
'permission to read the following files:'),
|
||||||
det_msg='\n'.join(bad_perms), show=True)
|
det_msg='\n'.join(bad_perms), show=True)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user