Thread: Massen-Import
View Single Post
Old 03-25-2022, 09:08 AM   #3
feuille
Connoisseur
feuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enough
 
Posts: 62
Karma: 666
Join Date: May 2020
Location: Germany
Device: android smartphone + tablet
Teillösung

Ich könnte auf die Schnelle zumindest eine Teillösung anbieten:

Man kann in den Calibre-Einstellungen steuern, ob der Dateiname oder ob die Metadaten des Formats als Metadatenquelle verwendet werden sollen:

Einstellungen -> Importieren/Exportieren -> Hinzufügen von Büchern -> Registerkarte "Einlesen von Metadaten" -> Kontrollkästchen "Metadaten aus Dateiinhalt statt Dateinamen lesen" nicht anhaken.

Für eine präzise Steuerung der Extraktion der Metadaten aus dem Dateinamen (Titel, Autoren, Serie, Verlag, ...) kann dann ein Regulärer Ausdruck angegeben werden.

Der würde für "Eisenbahn Journal - Monatsheft - 1982 01 Coverlok BR 65 1073.pdf" z. B. lauten:

(?P<series>(Eisenbahn Journal) \- (Monatsheft)) \- (?P<published>([0-9]{4})) ([0-9]{2}) (?P<title>.+)

Das ergibt dann für "Eisenbahn Journal - Monatsheft - 1982 01 Coverlok BR 65 1073.pdf":

title = "Coverlok BR 65 1073"
authors = "unbekannt"
series = "Eisenbahn Journal - Monatsheft"
published = "1982-03-15"

Vielleicht kann man noch etwas aus dem Regex rauskitzeln (Serien-Index aus "Jahr.Monat" oder Erscheinungsdatum aus "01.Monat.Jahr"), habe ich jetzt nicht weiter verfolgt. Der wird in calibre/src/calibre/gui2/widgets.py einfach in ein re.compile geschmissen und das Ergebnis (mit den benannten Referenzen, die genau den Feldnamen entpsrechen) in die Struktur "mi", die Quelle der Metadaten, gepackt.

Weitere Informationen über Reguläre Ausdrücke in Calibre: https://manual.calibre-ebook.com/de/regexp.html

Die konstanten Daten wie Verlag, Sprache etc. könnte man dann über Metadaten-Bearbeiten erledigen: Betreffende Bücher markieren -> Rechtsklick -> Metadaten bearbeiten -> Metadaten gleichzeitig bearbeiten -> Register Gundmetadaten.

Man könnte auch mit Suchen & Ersetzen (dem 3. Register in diesem Dialog) noch etwas nacharbeiten, z. B. "Eisenbahn Journal - Monatsheft" in "Eisenbahn Journal.Monatsheft" ändern, dann hat man eine Serie mit Unterserie, die Calibre verwalten kann.

Information über die DB-Struktur findet man im Quellcode: https://github.com/kovidgoyal/calibre und im Developer-Forum..

Von einer Manipulation der .opf-Dateien nach dem Motto "von hinten durch die Brust ins Auge" würde ich abraten.

Viel Erfolg!

Google Translated
Translation types
Text translation
Source text
2,212 / 5,000
Translation results
I could offer at least a partial solution:

You can control in the caliber settings whether the filename or the metadata of the format should be used as the metadata source:

Settings -> Import/Export -> Add books -> Tab "Read metadata" -> uncheck "Read metadata from file content instead of file name" check box.

A regular expression can then be specified for precise control of the extraction of metadata from the file name (title, authors, series, publisher, ...).

The would for "Railway Journal - Monthly - 1982 01 Coverlok BR 65 1073.pdf" e.g. B. are:

(?P<series>(Eisenbahn Journal) \- (Monthly)) \- (?P<published>([0-9]{4})) ([0-9]{2}) (?P<title >.+)

This results in "Eisenbahn Journal - Jahresheft - 1982 01 Coverlok BR 65 1073.pdf":

title = "Cover locomotive BR 65 1073"
authors = "unknown"
series = "Railway Journal - Monthly"
published = "1982-03-15"

Maybe you can tease out something else from the regex (series index from "year.month" or release date from "01.month.year"), I haven't pursued it any further now. This is simply thrown into a re.compile in calibre/src/calibre/gui2/widgets.py and the result (with the named references that exactly match the field names) is packed into the "mi" structure, the source of the metadata.

More information about regular expressions in caliber: https://manual.calibre-ebook.com/en/regexp.html

The constant data such as publisher, language, etc. could then be edited via Metadata: Mark the relevant books -> Right-click -> Edit metadata -> Edit metadata simultaneously -> Register basic metadata.

You could also rework something with Find & Replace (the 3rd tab in this dialog), e.g. For example, change "Railway Journal - Monthly" to "Railway Journal.Monthly" and you'll have a series with sub-series that caliber can manage.

Information about the DB structure can be found in the source code: https://github.com/kovidgoyal/calibre and in the developer forum..

I would advise against manipulating the .opf files along the lines of "from behind through the chest into the eye".

I wish you success!

Last edited by theducks; 03-25-2022 at 10:27 AM. Reason: Translated from German
feuille is offline   Reply With Quote