Made kindlegen working on windows (including paths containing umlauts)

Added back buttons on edit mail, edit user, and edit book
This commit is contained in:
OzzieIsaacs 2016-11-12 10:52:59 +01:00
parent bbf6d9b026
commit b86864b407
9 changed files with 155 additions and 133 deletions

1
.gitignore vendored
View File

@ -20,3 +20,4 @@ config.ini
.idea/
*.bak
*.log.*

3
babel.cfg Normal file
View File

@ -0,0 +1,3 @@
[python: **.py]
[jinja2: **/templates/**.*ml]
extensions=jinja2.ext.autoescape,jinja2.ext.with_

View File

@ -30,7 +30,10 @@ def update_download(book_id, user_id):
ub.session.commit()
def make_mobi(book_id):
kindlegen = os.path.join(config.MAIN_DIR, "vendor", "kindlegen")
if sys.platform =="win32":
kindlegen = os.path.join(config.MAIN_DIR, "vendor", u"kindlegen.exe")
else:
kindlegen = os.path.join(config.MAIN_DIR, "vendor", u"kindlegen")
if not os.path.exists(kindlegen):
app.logger.error("make_mobi: kindlegen binary not found in: %s" % kindlegen)
return None
@ -41,9 +44,10 @@ def make_mobi(book_id):
return None
file_path = os.path.join(config.DB_ROOT, book.path, data.name)
if os.path.exists(file_path + ".epub"):
check = subprocess.call([kindlegen, file_path + ".epub"], stdout=subprocess.PIPE)
if os.path.exists(file_path + u".epub"):
p = subprocess.Popen((kindlegen + " \"" + file_path + u".epub\" ").encode(sys.getfilesystemencoding()), shell=True, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, stdin=subprocess.PIPE)
check = p.wait()
if not check or check < 2:
book.data.append(db.Data(
name=book.data[0].name,

View File

@ -103,6 +103,7 @@
</label>
</div>
<button type="submit" class="btn btn-default">{{_('Submit')}}</button>
<a href="{{ url_for('show_book',id=book.id) }}" class="btn btn-default">{{_('Back')}}</a>
</form>
</div>
{% endif %}

View File

@ -28,6 +28,7 @@
<input type="text" class="form-control" name="mail_from" id="mail_from" value="{{content.mail_from}}">
</div>
<button type="submit" class="btn btn-default">{{_('Submit')}}</button>
<a href="{{ url_for('user_list') }}" class="btn btn-default">{{_('Back')}}</a>
</form>
</div>

View File

@ -91,6 +91,9 @@
</div>
{% endif %}
<button type="submit" class="btn btn-default">{{_('Submit')}}</button>
{% if not profile %}
<a href="{{ url_for('user_list') }}" class="btn btn-default">{{_('Back')}}</a>
{% endif %}
</form>
{% if downloads %}

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2016-11-09 18:52+0100\n"
"POT-Creation-Date: 2016-11-12 09:44+0100\n"
"PO-Revision-Date: 2016-07-12 19:54+0200\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: de\n"
@ -18,251 +18,253 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.3.4\n"
#: cps/helper.py:76 cps/templates/detail.html:113
#: cps/helper.py:80 cps/templates/detail.html:113
msgid "Send to Kindle"
msgstr "An Kindle senden"
#: cps/helper.py:77
#: cps/helper.py:81
msgid "This email has been sent via calibre web."
msgstr "Die E-Mail wurde via calibre-web versendet"
#: cps/helper.py:99 cps/helper.py:114
#: cps/helper.py:103 cps/helper.py:118
msgid "Could not find any formats suitable for sending by email"
msgstr "Konnte keine Formate finden welche für das versenden per E-Mail geeignet sind"
msgstr ""
"Konnte keine Formate finden welche für das versenden per E-Mail geeignet "
"sind"
#: cps/helper.py:108
#: cps/helper.py:112
msgid "Could not convert epub to mobi"
msgstr "Konnte .epub nicht nach .mobi convertieren"
#: cps/helper.py:138
#: cps/helper.py:142
#, python-format
msgid "Failed to send mail: %s"
msgstr "E-Mail: %s konnte nicht gesendet werden"
#: cps/helper.py:158
#: cps/helper.py:162
msgid "The requested file could not be read. Maybe wrong permissions?"
msgstr "Die angeforderte Datei konnte nicht gelesen werden. Falsche Dateirechte?"
#: cps/web.py:633
#: cps/web.py:639
msgid "Latest Books"
msgstr "Letzte Bücher"
#: cps/web.py:655
#: cps/web.py:661
msgid "Hot Books (most downloaded)"
msgstr "Beliebte Bücher (die meisten Downloads)"
#: cps/templates/index.xml:41 cps/web.py:662
#: cps/templates/index.xml:41 cps/web.py:668
msgid "Random Books"
msgstr "Zufällige Bücher"
#: cps/web.py:673
#: cps/web.py:679
msgid "Author list"
msgstr "Autorenliste"
#: cps/web.py:689
#: cps/web.py:695
#, python-format
msgid "Author: %(nam)s"
msgstr "Autor: %(nam)s"
#: cps/templates/index.xml:65 cps/web.py:700
#: cps/templates/index.xml:65 cps/web.py:706
msgid "Series list"
msgstr "Liste Serien"
#: cps/web.py:708
#: cps/web.py:714
#, python-format
msgid "Series: %(serie)s"
msgstr "Serie: %(serie)s"
#: cps/web.py:710 cps/web.py:790 cps/web.py:908 cps/web.py:1518
#: cps/web.py:716 cps/web.py:796 cps/web.py:914 cps/web.py:1524
msgid "Error opening eBook. File does not exist or file is not accessible:"
msgstr ""
"Buch öffnen fehlgeschlagen. Datei existiert nicht, oder ist nicht "
"zugänglich."
#: cps/web.py:736
#: cps/web.py:742
msgid "Available languages"
msgstr "Verfügbare Sprachen"
#: cps/web.py:748
#: cps/web.py:754
#, python-format
msgid "Language: %(name)s"
msgstr "Sprache: %(name)s"
#: cps/templates/index.xml:57 cps/web.py:759
#: cps/templates/index.xml:57 cps/web.py:765
msgid "Category list"
msgstr "Kategorieliste"
#: cps/web.py:766
#: cps/web.py:772
#, python-format
msgid "Category: %(name)s"
msgstr "Kategorie: %(name)s"
#: cps/web.py:804
#: cps/web.py:810
msgid "Statistics"
msgstr "Statistiken"
#: cps/web.py:892 cps/web.py:899 cps/web.py:906
#: cps/web.py:898 cps/web.py:905 cps/web.py:912
msgid "Read a Book"
msgstr "Lese ein Buch"
#: cps/web.py:945 cps/web.py:1173
#: cps/web.py:951 cps/web.py:1179
msgid "Please fill out all fields!"
msgstr "Bitte alle Felder ausfüllen!"
#: cps/web.py:961
#: cps/web.py:967
msgid "An unknown error occured. Please try again later."
msgstr "Es ist ein unbekannter Fehler aufgetreten. Bitte später erneut versuchen."
#: cps/web.py:966
#: cps/web.py:972
msgid "This username or email address is already in use."
msgstr "Der Benutzername oder die E-Mailadresse ist in bereits in Benutzung."
#: cps/web.py:969
#: cps/web.py:975
msgid "register"
msgstr "Registieren"
#: cps/web.py:984
#: cps/web.py:990
#, python-format
msgid "you are now logged in as: '%(nickname)s'"
msgstr "Du bist nun eingeloggt als '%(nickname)s'"
#: cps/web.py:987
#: cps/web.py:993
msgid "Wrong Username or Password"
msgstr "Flascher Benutzername oder Passwort"
#: cps/web.py:989
#: cps/web.py:995
msgid "login"
msgstr "Login"
#: cps/web.py:1005
#: cps/web.py:1011
msgid "Please configure the SMTP mail settings first..."
msgstr "Bitte zuerst die SMTP Mail Einstellung konfigurieren ..."
#: cps/web.py:1009
#: cps/web.py:1015
#, python-format
msgid "Book successfully send to %(kindlemail)s"
msgstr "Buch erfolgreich versandt an %(kindlemail)s"
#: cps/web.py:1012
#: cps/web.py:1018
#, python-format
msgid "There was an error sending this book: %(res)s"
msgstr "Beim Senden des Buchs trat ein Fehler auf: %(res)s"
#: cps/web.py:1014
#: cps/web.py:1020
msgid "Please configure your kindle email address first..."
msgstr "Bitte die Kindle E-Mail Adresse zuuerst konfigurieren..."
#: cps/web.py:1029
#: cps/web.py:1035
#, python-format
msgid "Book has been added to shelf: %(sname)s"
msgstr "Das Buch wurde dem Bücherregal: %(sname)s hinzugefügt"
#: cps/web.py:1048
#: cps/web.py:1054
#, python-format
msgid "Book has been removed from shelf: %(sname)s"
msgstr "Das Buch wurde aus dem Bücherregal: %(sname)s entfernt"
#: cps/web.py:1064
#: cps/web.py:1070
#, python-format
msgid "A shelf with the name '%(title)s' already exists."
msgstr "Es existiert bereits ein Bücheregal mit dem Titel '%(title)s'"
#: cps/web.py:1069
#: cps/web.py:1075
#, python-format
msgid "Shelf %(title)s created"
msgstr "Bücherregal %(title)s erzeugt"
#: cps/web.py:1071
#: cps/web.py:1077
msgid "There was an error"
msgstr "Es trat ein Fehler auf"
#: cps/web.py:1072 cps/web.py:1074
#: cps/web.py:1078 cps/web.py:1080
msgid "create a shelf"
msgstr "Bücherregal erzeugen"
#: cps/web.py:1090
#: cps/web.py:1096
#, python-format
msgid "successfully deleted shelf %(name)s"
msgstr "Bücherregal %(name)s erfolgreich gelöscht"
#: cps/web.py:1107
#: cps/web.py:1113
#, python-format
msgid "Shelf: '%(name)s'"
msgstr "Bücherregal: '%(name)s'"
#: cps/web.py:1144
#: cps/web.py:1150
msgid "Found an existing account for this email address."
msgstr "Es existiert ein Benutzerkonto für diese E-Mailadresse"
#: cps/web.py:1145 cps/web.py:1147
#: cps/web.py:1151 cps/web.py:1153
#, python-format
msgid "%(name)s's profile"
msgstr "%(name)s's Profil"
#: cps/web.py:1146
#: cps/web.py:1152
msgid "Profile updated"
msgstr "Profil aktualisiert"
#: cps/web.py:1155
#: cps/web.py:1161
msgid "User list"
msgstr "Benutzerliste"
#: cps/templates/user_list.html:32 cps/web.py:1174
#: cps/templates/user_list.html:32 cps/web.py:1180
msgid "Add new user"
msgstr "Neuen Benutzer hinzufügen"
#: cps/web.py:1207
#: cps/web.py:1213
#, python-format
msgid "User '%(user)s' created"
msgstr "Benutzer '%(user)s' angelegt"
#: cps/web.py:1211
#: cps/web.py:1217
msgid "Found an existing account for this email address or nickname."
msgstr ""
"Es existiert ein Benutzerkonto für diese Emailadresse oder den "
"Benutzernamen"
#: cps/web.py:1232
#: cps/web.py:1238
msgid "Mail settings updated"
msgstr "E-Mail Einstellungen aktualisiert"
#: cps/web.py:1235
#: cps/web.py:1241
msgid "Edit mail settings"
msgstr "E-Mail Einstellungen editieren"
#: cps/web.py:1257
#: cps/web.py:1263
#, python-format
msgid "User '%(nick)s' deleted"
msgstr "Benutzer '%(nick)s' gelöscht"
#: cps/web.py:1312
#: cps/web.py:1318
#, python-format
msgid "User '%(nick)s' updated"
msgstr "Benutzer '%(nick)s' aktualisiert"
#: cps/web.py:1315
#: cps/web.py:1321
msgid "An unknown error occured."
msgstr "Es ist ein unbekanter Fehler aufgetreten"
#: cps/web.py:1316
#: cps/web.py:1322
#, python-format
msgid "Edit User %(nick)s"
msgstr "Benutzer %(nick)s bearbeiten"
#: cps/web.py:1550
#: cps/web.py:1556
#, python-format
msgid "Failed to create path %s (Permission denied)."
msgstr ""
msgstr "Fehler beim Erzeugen des Pfads %s (Zugriff verweigert)"
#: cps/web.py:1555
#: cps/web.py:1561
#, python-format
msgid "Failed to store file %s (Permission denied)."
msgstr ""
msgstr "Fehler beim speichern der Datei %s (Zugriff verweigert)"
#: cps/web.py:1560
#: cps/web.py:1566
#, python-format
msgid "Failed to delete file %s (Permission denied)."
msgstr ""
msgstr "Fehler beim Löschen von Datei %s (Zugriff verweigert)"
#: cps/templates/detail.html:38
msgid "Book"
@ -350,6 +352,11 @@ msgstr "Buch nach Bearbeitung ansehen"
msgid "Submit"
msgstr "Abschicken"
#: cps/templates/edit_book.html:106 cps/templates/email_edit.html:31
#: cps/templates/user_edit.html:95
msgid "Back"
msgstr "Zurück"
#: cps/templates/email_edit.html:7 cps/templates/user_list.html:36
msgid "SMTP hostname"
msgstr "SMTP Hostname"
@ -424,7 +431,7 @@ msgstr "Bücher nach Kategorien sortiert"
#: cps/templates/index.xml:70
msgid "Books ordered by series"
msgstr ""
msgstr "Bücher nach Reihen geordnet"
#: cps/templates/layout.html:46
msgid "Toggle navigation"
@ -560,10 +567,6 @@ msgstr "Bücher in dieser Bibliothek"
msgid "Authors in this Library"
msgstr "Autoren in dieser Bibliothek"
#: cps/templates/stats.html:6
msgid "Version"
msgstr "Version"
#: cps/templates/user_edit.html:23
msgid "Kindle E-Mail"
msgstr "Kindle E-Mail"
@ -620,7 +623,7 @@ msgstr "Passwort ändern erlauben"
msgid "Delete this user"
msgstr "Benutzer löschen"
#: cps/templates/user_edit.html:97
#: cps/templates/user_edit.html:100
msgid "Recent Downloads"
msgstr "Letzte Downloads"
@ -671,3 +674,6 @@ msgstr "SMTP Einstellungen ändern"
msgid "Latin"
msgstr "Latein"
#~ msgid "Version"
#~ msgstr "Version"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2016-11-09 18:52+0100\n"
"POT-Creation-Date: 2016-11-12 09:44+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -17,244 +17,244 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.3.4\n"
#: cps/helper.py:76 cps/templates/detail.html:113
#: cps/helper.py:80 cps/templates/detail.html:113
msgid "Send to Kindle"
msgstr ""
#: cps/helper.py:77
#: cps/helper.py:81
msgid "This email has been sent via calibre web."
msgstr ""
#: cps/helper.py:99 cps/helper.py:114
#: cps/helper.py:103 cps/helper.py:118
msgid "Could not find any formats suitable for sending by email"
msgstr ""
#: cps/helper.py:108
#: cps/helper.py:112
msgid "Could not convert epub to mobi"
msgstr ""
#: cps/helper.py:138
#: cps/helper.py:142
#, python-format
msgid "Failed to send mail: %s"
msgstr ""
#: cps/helper.py:158
#: cps/helper.py:162
msgid "The requested file could not be read. Maybe wrong permissions?"
msgstr ""
#: cps/web.py:633
#: cps/web.py:639
msgid "Latest Books"
msgstr ""
#: cps/web.py:655
#: cps/web.py:661
msgid "Hot Books (most downloaded)"
msgstr ""
#: cps/templates/index.xml:41 cps/web.py:662
#: cps/templates/index.xml:41 cps/web.py:668
msgid "Random Books"
msgstr ""
#: cps/web.py:673
#: cps/web.py:679
msgid "Author list"
msgstr ""
#: cps/web.py:689
#: cps/web.py:695
#, python-format
msgid "Author: %(nam)s"
msgstr ""
#: cps/templates/index.xml:65 cps/web.py:700
#: cps/templates/index.xml:65 cps/web.py:706
msgid "Series list"
msgstr ""
#: cps/web.py:708
#: cps/web.py:714
#, python-format
msgid "Series: %(serie)s"
msgstr ""
#: cps/web.py:710 cps/web.py:790 cps/web.py:908 cps/web.py:1518
#: cps/web.py:716 cps/web.py:796 cps/web.py:914 cps/web.py:1524
msgid "Error opening eBook. File does not exist or file is not accessible:"
msgstr ""
#: cps/web.py:736
#: cps/web.py:742
msgid "Available languages"
msgstr ""
#: cps/web.py:748
#: cps/web.py:754
#, python-format
msgid "Language: %(name)s"
msgstr ""
#: cps/templates/index.xml:57 cps/web.py:759
#: cps/templates/index.xml:57 cps/web.py:765
msgid "Category list"
msgstr ""
#: cps/web.py:766
#: cps/web.py:772
#, python-format
msgid "Category: %(name)s"
msgstr ""
#: cps/web.py:804
#: cps/web.py:810
msgid "Statistics"
msgstr ""
#: cps/web.py:892 cps/web.py:899 cps/web.py:906
#: cps/web.py:898 cps/web.py:905 cps/web.py:912
msgid "Read a Book"
msgstr ""
#: cps/web.py:945 cps/web.py:1173
#: cps/web.py:951 cps/web.py:1179
msgid "Please fill out all fields!"
msgstr ""
#: cps/web.py:961
#: cps/web.py:967
msgid "An unknown error occured. Please try again later."
msgstr ""
#: cps/web.py:966
#: cps/web.py:972
msgid "This username or email address is already in use."
msgstr ""
#: cps/web.py:969
#: cps/web.py:975
msgid "register"
msgstr ""
#: cps/web.py:984
#: cps/web.py:990
#, python-format
msgid "you are now logged in as: '%(nickname)s'"
msgstr ""
#: cps/web.py:987
#: cps/web.py:993
msgid "Wrong Username or Password"
msgstr ""
#: cps/web.py:989
#: cps/web.py:995
msgid "login"
msgstr ""
#: cps/web.py:1005
#: cps/web.py:1011
msgid "Please configure the SMTP mail settings first..."
msgstr ""
#: cps/web.py:1009
#: cps/web.py:1015
#, python-format
msgid "Book successfully send to %(kindlemail)s"
msgstr ""
#: cps/web.py:1012
#: cps/web.py:1018
#, python-format
msgid "There was an error sending this book: %(res)s"
msgstr ""
#: cps/web.py:1014
#: cps/web.py:1020
msgid "Please configure your kindle email address first..."
msgstr ""
#: cps/web.py:1029
#: cps/web.py:1035
#, python-format
msgid "Book has been added to shelf: %(sname)s"
msgstr ""
#: cps/web.py:1048
#: cps/web.py:1054
#, python-format
msgid "Book has been removed from shelf: %(sname)s"
msgstr ""
#: cps/web.py:1064
#: cps/web.py:1070
#, python-format
msgid "A shelf with the name '%(title)s' already exists."
msgstr ""
#: cps/web.py:1069
#: cps/web.py:1075
#, python-format
msgid "Shelf %(title)s created"
msgstr ""
#: cps/web.py:1071
#: cps/web.py:1077
msgid "There was an error"
msgstr ""
#: cps/web.py:1072 cps/web.py:1074
#: cps/web.py:1078 cps/web.py:1080
msgid "create a shelf"
msgstr ""
#: cps/web.py:1090
#: cps/web.py:1096
#, python-format
msgid "successfully deleted shelf %(name)s"
msgstr ""
#: cps/web.py:1107
#: cps/web.py:1113
#, python-format
msgid "Shelf: '%(name)s'"
msgstr ""
#: cps/web.py:1144
#: cps/web.py:1150
msgid "Found an existing account for this email address."
msgstr ""
#: cps/web.py:1145 cps/web.py:1147
#: cps/web.py:1151 cps/web.py:1153
#, python-format
msgid "%(name)s's profile"
msgstr ""
#: cps/web.py:1146
#: cps/web.py:1152
msgid "Profile updated"
msgstr ""
#: cps/web.py:1155
#: cps/web.py:1161
msgid "User list"
msgstr ""
#: cps/templates/user_list.html:32 cps/web.py:1174
#: cps/templates/user_list.html:32 cps/web.py:1180
msgid "Add new user"
msgstr ""
#: cps/web.py:1207
#: cps/web.py:1213
#, python-format
msgid "User '%(user)s' created"
msgstr ""
#: cps/web.py:1211
#: cps/web.py:1217
msgid "Found an existing account for this email address or nickname."
msgstr ""
#: cps/web.py:1232
#: cps/web.py:1238
msgid "Mail settings updated"
msgstr ""
#: cps/web.py:1235
#: cps/web.py:1241
msgid "Edit mail settings"
msgstr ""
#: cps/web.py:1257
#: cps/web.py:1263
#, python-format
msgid "User '%(nick)s' deleted"
msgstr ""
#: cps/web.py:1312
#: cps/web.py:1318
#, python-format
msgid "User '%(nick)s' updated"
msgstr ""
#: cps/web.py:1315
#: cps/web.py:1321
msgid "An unknown error occured."
msgstr ""
#: cps/web.py:1316
#: cps/web.py:1322
#, python-format
msgid "Edit User %(nick)s"
msgstr ""
#: cps/web.py:1550
#: cps/web.py:1556
#, python-format
msgid "Failed to create path %s (Permission denied)."
msgstr ""
#: cps/web.py:1555
#: cps/web.py:1561
#, python-format
msgid "Failed to store file %s (Permission denied)."
msgstr ""
#: cps/web.py:1560
#: cps/web.py:1566
#, python-format
msgid "Failed to delete file %s (Permission denied)."
msgstr ""
@ -345,6 +345,11 @@ msgstr ""
msgid "Submit"
msgstr ""
#: cps/templates/edit_book.html:106 cps/templates/email_edit.html:31
#: cps/templates/user_edit.html:95
msgid "Back"
msgstr ""
#: cps/templates/email_edit.html:7 cps/templates/user_list.html:36
msgid "SMTP hostname"
msgstr ""
@ -555,10 +560,6 @@ msgstr ""
msgid "Authors in this Library"
msgstr ""
#: cps/templates/stats.html:6
msgid "Version"
msgstr ""
#: cps/templates/user_edit.html:23
msgid "Kindle E-Mail"
msgstr ""
@ -584,11 +585,11 @@ msgid "Show language selection"
msgstr ""
#: cps/templates/user_edit.html:58
msgid "Show Series Selection"
msgid "Show series selection"
msgstr ""
#: cps/templates/user_edit.html:62
msgid "Show Category Selection"
msgid "Show category selection"
msgstr ""
#: cps/templates/user_edit.html:67
@ -615,7 +616,7 @@ msgstr ""
msgid "Delete this user"
msgstr ""
#: cps/templates/user_edit.html:97
#: cps/templates/user_edit.html:100
msgid "Recent Downloads"
msgstr ""
@ -663,3 +664,5 @@ msgstr ""
msgid "Change SMTP settings"
msgstr ""
msgid "Latin"
msgstr ""