mirror of
https://github.com/janeczku/calibre-web
synced 2024-11-10 01:13:33 +00:00
Bugfix load metadata
Bugfix xchange author and title Better handling of incompatible iso-639 module on python3.12
This commit is contained in:
parent
6717683ac3
commit
1be0ff9620
@ -27,7 +27,6 @@ import importlib
|
|||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
import flask
|
import flask
|
||||||
import jinja2
|
|
||||||
from flask_babel import gettext as _
|
from flask_babel import gettext as _
|
||||||
|
|
||||||
from . import db, calibre_db, converter, uploader, constants, dep_check
|
from . import db, calibre_db, converter, uploader, constants, dep_check
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
import sys
|
||||||
|
|
||||||
from .iso_language_names import LANGUAGE_NAMES as _LANGUAGE_NAMES
|
from .iso_language_names import LANGUAGE_NAMES as _LANGUAGE_NAMES
|
||||||
from . import logger
|
from . import logger
|
||||||
@ -24,16 +25,20 @@ log = logger.create()
|
|||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from iso639 import languages, __version__
|
from iso639 import languages
|
||||||
|
# iso_version = importlib.metadata.version("iso639")
|
||||||
get = languages.get
|
get = languages.get
|
||||||
except ImportError:
|
|
||||||
from pycountry import languages as pyc_languages
|
|
||||||
try:
|
try:
|
||||||
|
if sys.version_info >= (3, 12):
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
__version__ = pkg_resources.get_distribution('pycountry').version + ' (PyCountry)'
|
except ImportError:
|
||||||
del pkg_resources
|
print("Python 3.12 isn't compatible with iso-639. Please install pycountry.")
|
||||||
except (ImportError, Exception):
|
except ImportError as ex:
|
||||||
__version__ = "? (PyCountry)"
|
from pycountry import languages as pyc_languages
|
||||||
|
#try:
|
||||||
|
# iso_version = importlib.metadata.version("pycountry") + ' (PyCountry)'
|
||||||
|
#except (ImportError, Exception):
|
||||||
|
# iso_version = "?" + ' (PyCountry)'
|
||||||
|
|
||||||
def _copy_fields(l):
|
def _copy_fields(l):
|
||||||
l.part1 = getattr(l, 'alpha_2', None)
|
l.part1 = getattr(l, 'alpha_2', None)
|
||||||
|
@ -93,7 +93,7 @@ var authors = new Bloodhound({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".form-group #bookAuthor").typeahead(
|
$(".form-group #authors").typeahead(
|
||||||
{
|
{
|
||||||
highlight: true,
|
highlight: true,
|
||||||
minLength: 1,
|
minLength: 1,
|
||||||
@ -262,7 +262,7 @@ $("#btn-upload-cover").on("change", function () {
|
|||||||
$("#xchange").click(function () {
|
$("#xchange").click(function () {
|
||||||
this.blur();
|
this.blur();
|
||||||
var title = $("#title").val();
|
var title = $("#title").val();
|
||||||
$("#title").val($("#bookAuthor").val());
|
$("#title").val($("#authors").val());
|
||||||
$("#bookAuthor").val(title);
|
$("#authors").val(title);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -38,11 +38,11 @@ $(function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function populateForm (book) {
|
function populateForm (book) {
|
||||||
tinymce.get("comments").setContent(book.comments);
|
tinymce.get("comments").setContent(book.description);
|
||||||
var uniqueTags = getUniqueValues('tags', book)
|
var uniqueTags = getUniqueValues('tags', book)
|
||||||
var uniqueLanguages = getUniqueValues('languages', book)
|
var uniqueLanguages = getUniqueValues('languages', book)
|
||||||
var ampSeparatedAuthors = (book.authors || []).join(" & ");
|
var ampSeparatedAuthors = (book.authors || []).join(" & ");
|
||||||
$("#bookAuthor").val(ampSeparatedAuthors);
|
$("#authors").val(ampSeparatedAuthors);
|
||||||
$("#title").val(book.title);
|
$("#title").val(book.title);
|
||||||
$("#tags").val(uniqueTags.join(", "));
|
$("#tags").val(uniqueTags.join(", "));
|
||||||
$("#languages").val(uniqueLanguages.join(", "));
|
$("#languages").val(uniqueLanguages.join(", "));
|
||||||
|
@ -37,6 +37,7 @@ beautifulsoup4>=4.0.1,<4.13.0
|
|||||||
faust-cchardet>=2.1.18,<2.1.20
|
faust-cchardet>=2.1.18,<2.1.20
|
||||||
py7zr>=0.15.0,<0.21.0
|
py7zr>=0.15.0,<0.21.0
|
||||||
mutagen>=1.40.0,<1.50.0
|
mutagen>=1.40.0,<1.50.0
|
||||||
|
pycountry>=20.0.0,<25.0.0
|
||||||
|
|
||||||
# Comics
|
# Comics
|
||||||
natsort>=2.2.0,<8.5.0
|
natsort>=2.2.0,<8.5.0
|
||||||
|
@ -3,7 +3,7 @@ Babel>=1.3,<3.0
|
|||||||
Flask-Babel>=0.11.1,<4.1.0
|
Flask-Babel>=0.11.1,<4.1.0
|
||||||
Flask-Principal>=0.3.2,<0.5.1
|
Flask-Principal>=0.3.2,<0.5.1
|
||||||
Flask>=1.0.2,<3.1.0
|
Flask>=1.0.2,<3.1.0
|
||||||
iso-639>=0.4.5,<0.5.0
|
# iso-639>=0.4.5,<0.5.0 # alternative pycountry
|
||||||
PyPDF>=3.15.6,<4.3.0
|
PyPDF>=3.15.6,<4.3.0
|
||||||
pytz>=2016.10
|
pytz>=2016.10
|
||||||
requests>=2.28.0,<2.32.0
|
requests>=2.28.0,<2.32.0
|
||||||
|
Loading…
Reference in New Issue
Block a user