Skip to content
This repository has been archived by the owner on Mar 15, 2020. It is now read-only.

Commit

Permalink
Merge pull request #33 from rupor-github/hotfix
Browse files Browse the repository at this point in the history
GUI hotfix
  • Loading branch information
dnkorpushov committed Dec 14, 2017
2 parents 30193b4 + 4d2b1dd commit 77a042d
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 22 deletions.
2 changes: 1 addition & 1 deletion fb2mobi-gui.py
Expand Up @@ -466,7 +466,7 @@ def process(self, mode):
i += 1

if errors > 0:
QMessageBox.warning(self, _translate('fb2mobi-gui', 'Error'), _translate('fb2mobi-gui', 'Error while sending file(s). Check log for details.'))
QMessageBox.warning(self, _translate('fb2mobi-gui', 'Error'), _translate('fb2mobi-gui', 'Error while converting file(s). Check log for details.'))


if mode == PROCESS_MODE_KINDLE:
Expand Down
16 changes: 13 additions & 3 deletions fb2mobi_ru.ts
Expand Up @@ -416,17 +416,17 @@
<translation type="obsolete">Обработка файла: {0}</translation>
</message>
<message>
<location filename="fb2mobi-gui.py" line="974"/>
<location filename="fb2mobi-gui.py" line="995"/>
<source>Select files</source>
<translation>Выберите файлы</translation>
</message>
<message>
<location filename="fb2mobi-gui.py" line="976"/>
<source>Fb2 files (*.fb2 *.fb2.zip *.zip)</source>
<translation>Файлы fb2 (*.fb2 *.fb2.zip *.zip)</translation>
<translation type="obsolete">Файлы fb2 (*.fb2 *.fb2.zip *.zip)</translation>
</message>
<message>
<location filename="fb2mobi-gui.py" line="976"/>
<location filename="fb2mobi-gui.py" line="997"/>
<source>All files (*.*)</source>
<translation>Все файлы (*.*)</translation>
</message>
Expand Down Expand Up @@ -510,5 +510,15 @@
<source>Kindle connected to {0}</source>
<translation>Kindle подключен как {0}</translation>
</message>
<message>
<location filename="fb2mobi-gui.py" line="472"/>
<source>Error while converting file(s). Check log for details.</source>
<translation type="unfinished">Возникла ошибка при конвертации файлов. Детали смотрите в лог-файле.</translation>
</message>
<message>
<location filename="fb2mobi-gui.py" line="997"/>
<source>Ebook files (*.fb2 *.fb2.zip *.zip *.epub)</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>
40 changes: 23 additions & 17 deletions ui/ebookmeta.py
Expand Up @@ -55,19 +55,22 @@ def __init__(self, file):
if os.path.splitext(self.file)[1].lower() == '.zip':
self.is_zip = True

if self.book_type == 'fb2':
if self.is_zip:
with ZipFile(self.file) as myzip:
# TODO - warn here if len(myzip.infolist) > 1?
self.zip_info = myzip.infolist()[0]
with myzip.open(self.zip_info, 'r') as myfile:
self.tree = etree.parse(BytesIO(myfile.read()), parser=etree.XMLParser(recover=True))
self.encoding = self.tree.docinfo.encoding
else:
self.tree = etree.parse(self.file, parser=etree.XMLParser(recover=True))
self.encoding = self.tree.docinfo.encoding
elif self.book_type == 'epub':
pass
try:
if self.book_type == 'fb2':
if self.is_zip:
with ZipFile(self.file) as myzip:
# TODO - warn here if len(myzip.infolist) > 1?
self.zip_info = myzip.infolist()[0]
with myzip.open(self.zip_info, 'r') as myfile:
self.tree = etree.parse(BytesIO(myfile.read()), parser=etree.XMLParser(recover=True))
self.encoding = self.tree.docinfo.encoding
else:
self.tree = etree.parse(self.file, parser=etree.XMLParser(recover=True))
self.encoding = self.tree.docinfo.encoding
elif self.book_type == 'epub':
pass
except:
self.book_type = ''

def get_first_series(self):
series_name = ''
Expand Down Expand Up @@ -129,10 +132,13 @@ def get_autors(self):


def get(self):
if self.book_type == 'fb2':
self._get_fb2_metadata()
elif self.book_type == 'epub':
self._get_epub_metadata()
try:
if self.book_type == 'fb2':
self._get_fb2_metadata()
elif self.book_type == 'epub':
self._get_epub_metadata()
except:
self.book_type = ''


def _get_epub_metadata(self):
Expand Down
Binary file modified ui/locale/fb2mobi_ru.qm
Binary file not shown.
2 changes: 1 addition & 1 deletion version.py
Expand Up @@ -4,5 +4,5 @@

WINDOWS = platform.system().lower() == "windows"

VERSION = u'3.6.44'
VERSION = u'3.6.45'

0 comments on commit 77a042d

Please sign in to comment.