Skip to content

WIP: Webcomic metadata extraction tool

ctk requested to merge metadata-extractor into master

Hello and apologies for the delayed christmas release!

So here's the vaporware I am working on; it is time for sharing and feedback.

For a webcomics directory, it will print to stdout, for each episode:

  • its directory name
  • its translated titles, as a mapping from p&c language code to title (extracted from SVG)
  • the filenames for the images: cover, title, comic pages and credits

The output has only one addition compared to the v2 API format: it includes translated titles in the "translations" field.

[
    {
        "directory": "ep01_Potion-of-Flight",
        "translations": {
            "ar": "حلقة ١ : جُرعةُ الطَيران",
            "bn": "গপ ১: ওড়ার যামিরণ",
            "br": "Rann 1: Dramm nijal",
            "ca": "Episodi 1: La Poció de Vol",
            "cn": "第1集:飞行魔药",
            "cs": "1. díl: Lektvar létání",
            "da": "Episode 1: Flyveeliksir",
            "de": "Episode 1: Der Flugtrank",
            "el": "Επεισόδιο 1: Φίλτρο αιώρησης",
            "en": "Episode 1: The Potion of Flight",
            "eo": "Ĉapitro 1a: La Sorĉotrinkaĵo flugiga",
            "es": "Episodio 1: Poción de vuelo",
            "fa": "قسمت اول: معجون پرواز",
            "fi": "Episodi 1: Lentoliemi",
            "fr": "Épisode 1 : Potion d'envol",
            "go": "Eqerouey 1 : Pocion avolante",
            "hu": "1. rész: A Repülő Bájital",
            "id": "Episode 1: Ramuan terbang",
            "io": "Epizodo 1 : La flugo-pociono",
            "it": "Episodio 1: La pozione per volare",
            "ja": "エピソード 1: 飛行薬",
            "jb": ".i 1 mo'o lisri le litki pe ja'e lo nu vofli",
            "kr": "제1 화: 비행의 물약",
            "kt": "Zixa 1 : Uliba ta tictalara",
            "la": "Episodium 1 : Potio ad evolandum",
            "ml": "എപിസോ 1 : പറകാ	ള മരം",
            "ms": "Episod 1 : Posyen terbang",
            "mx": "Episodio 1 : Poción de Vuelo",
            "nl": "Aflevering 1: De vliegdrank",
            "nn": "Episode 1: Flygetrylledrikken",
            "no": "Episode 1: Flyvetrylledrikken",
            "ns": "Folg 1: De Flaagdrunk",
            "ph": "Episode 1 : Salamangka ng Paglipad",
            "pl": "Odcinek 1: Eliksir lotu",
            "pt": "Episódio 1: A Poção de Voo",
            "ro": "Episodul 1 : Poţiunea Zborului",
            "ru": "Эпизод 1: Зелье полета",
            "si": "1වන කතාංගය: ඉමේ මායා වය",
            "sk": "Epizóda 1: Elixír lietania",
            "sr": "Епизода 1: Напитак за летење",
            "sv": "Episode 1: Flygelixir",
            "sz": "Tajla 1: Eliksir lŏtaniŏ",
            "uk": "Епізод 1: Зілля польоту",
            "vi": "Tập 1: Thuốc Lơ Lửng"
        },
        "filenames": {
            "cover": "Pepper-and-Carrot_by-David-Revoy_E01.jpg",
            "title": "Pepper-and-Carrot_by-David-Revoy_E01P00.jpg",
            "comic": [
                "Pepper-and-Carrot_by-David-Revoy_E01P01.jpg",
                "Pepper-and-Carrot_by-David-Revoy_E01P02.jpg",
                "Pepper-and-Carrot_by-David-Revoy_E01P03.jpg"
            ],
            "credits": "Pepper-and-Carrot_by-David-Revoy_E01P04.jpg"
        }
    },
    
]

If the environment variable UNICODE_JSON is set, the JSON strings will be output in Unicode. Otherwise they are ASCII-armored.

If inconsistencies are detected, they are explained in stderr, and the script exits with a non-zero error code.

WIP: this is most certainly usable, I just await feedback before removing the WIP, and could hardly say this is in a final perfected state.
Notably, I have a few ideas in stock to make sure all error messages explain how to fix issues, and to improve readability of the code, which is not good everywhere.

There can be interpretation mistakes on my part in here, too, and some of its reactions are still a bit arbitrary when the script encounters unexpected data.

RFC :)

Edited by ctk

Merge request reports