mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Fix #3047 (Metadata on device, fall back to file name)
This commit is contained in:
commit
444f76fc25
16
setup.py
16
setup.py
@ -60,17 +60,15 @@ if __name__ == '__main__':
|
|||||||
optional = []
|
optional = []
|
||||||
qmake = '/Volumes/sw/qt/bin/qmake' if isosx else 'qmake'
|
qmake = '/Volumes/sw/qt/bin/qmake' if isosx else 'qmake'
|
||||||
qmake = os.environ.get('QMAKE', qmake)
|
qmake = os.environ.get('QMAKE', qmake)
|
||||||
raw = subprocess.Popen([qmake, '-query'],
|
def qmake_query(arg=''):
|
||||||
|
return subprocess.Popen([qmake, '-query', arg],
|
||||||
stdout=subprocess.PIPE).stdout.read()
|
stdout=subprocess.PIPE).stdout.read()
|
||||||
qt_inc = qt_lib = None
|
qt_inc = qt_lib = None
|
||||||
for line in raw.splitlines():
|
qt_inc = qmake_query('QT_INSTALL_HEADERS').splitlines()[0]
|
||||||
q, _, w = line.partition(':')
|
qt_inc = qt_inc if qt_inc not in ('', '**Unknown**') and os.path.isdir(qt_inc) else None
|
||||||
if q == 'QT_INSTALL_HEADERS':
|
qt_lib = qmake_query('QT_INSTALL_LIBS').splitlines()[0]
|
||||||
qt_inc = w
|
qt_lib = qt_lib if qt_lib not in ('', '**Unknown**') and os.path.isdir(qt_lib) else None
|
||||||
elif q == 'QT_INSTALL_LIBS':
|
|
||||||
qt_lib = w
|
|
||||||
|
|
||||||
|
|
||||||
if iswindows:
|
if iswindows:
|
||||||
optional.append(Extension('calibre.plugins.winutil',
|
optional.append(Extension('calibre.plugins.winutil',
|
||||||
sources=['src/calibre/utils/windows/winutil.c'],
|
sources=['src/calibre/utils/windows/winutil.c'],
|
||||||
|
@ -34,7 +34,7 @@ class IREXDR1000(USBMS):
|
|||||||
|
|
||||||
MAIN_MEMORY_VOLUME_LABEL = 'IRex Digital Reader 1000 Main Memory'
|
MAIN_MEMORY_VOLUME_LABEL = 'IRex Digital Reader 1000 Main Memory'
|
||||||
|
|
||||||
EBOOK_DIR_MAIN = ''
|
EBOOK_DIR_MAIN = 'ebooks'
|
||||||
SUPPORTS_SUB_DIRS = True
|
SUPPORTS_SUB_DIRS = True
|
||||||
|
|
||||||
def delete_books(self, paths, end_session=True):
|
def delete_books(self, paths, end_session=True):
|
||||||
|
@ -8,6 +8,7 @@ for a particular device.
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import fnmatch
|
import fnmatch
|
||||||
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
from itertools import cycle
|
from itertools import cycle
|
||||||
|
|
||||||
@ -207,8 +208,9 @@ class USBMS(CLI, Device):
|
|||||||
if cls.settings().read_metadata or cls.MUST_READ_METADATA:
|
if cls.settings().read_metadata or cls.MUST_READ_METADATA:
|
||||||
mi = cls.metadata_from_path(path)
|
mi = cls.metadata_from_path(path)
|
||||||
else:
|
else:
|
||||||
from calibre.ebooks.metadata import MetaInformation
|
from calibre.ebooks.metadata.meta import metadata_from_filename
|
||||||
mi = MetaInformation(os.path.basename(path))
|
mi = metadata_from_filename(os.path.basename(path),
|
||||||
|
re.compile(r'^(?P<title>[ \S]+?)[ _]-[ _](?P<author>[ \S]+?)_+\d+'))
|
||||||
|
|
||||||
authors = authors_to_string(mi.authors)
|
authors = authors_to_string(mi.authors)
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ def get_metadata(stream, stream_type='lrf', use_libprs_metadata=False):
|
|||||||
# The regex is meant to match the standard format filenames are written
|
# The regex is meant to match the standard format filenames are written
|
||||||
# in: title_-_author_number.extension
|
# in: title_-_author_number.extension
|
||||||
base.smart_update(metadata_from_filename(name, re.compile(
|
base.smart_update(metadata_from_filename(name, re.compile(
|
||||||
r'^(?P<title>\S+?)_-_(?P<author>\S+?)_+\d+')))
|
r'^(?P<title>[ \S]+?)[ _]-[ _](?P<author>[ \S]+?)_+\d+')))
|
||||||
if base.title:
|
if base.title:
|
||||||
base.title = base.title.replace('_', ' ')
|
base.title = base.title.replace('_', ' ')
|
||||||
if base.authors:
|
if base.authors:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user