Snd-R / komf

Komga and Kavita metadata fetcher
MIT License
323 stars 19 forks source link

[Feature Request] Optionally Respect Existing Covers #70

Closed kanjieater closed 1 year ago

kanjieater commented 1 year ago

Komga allows you to provide covers via an external image file next to your archive. It would be convenient to still allow users to provide their own custom covers where they are able to, without having Komf remove them.

Could we allow for an option to only get the covers if a cover doesn't exist already?

eswiig commented 1 year ago

Yes please, or an option / checkbox to "overwrite current cover"

Sometimes I want the new cover, sometimes not.

eswiig commented 1 year ago

added configuration option to not override existing cover in Komga. Defaults to always override cover (komga.metadataUpdate.default.overrideExistingCovers=true)

how/where do we add this? in /config/application.yml? if so, how?

add override.ExistingCovers=false to metadataUpdate under postProcessing?

Snd-R commented 1 year ago

I forgot to push commit with example config update in readme, it's now in example config under metadata update section

komga:
  metadataUpdate:
    default:
      overrideExistingCovers: false
kanjieater commented 1 year ago

File system: image

Komga: image

I'm clicking on auto-identify but the file system stays the same. The book covers are never added locally to the file system or reflected in komga.

logs:

15:51:08.106 [main] INFO io.javalin.Javalin -- Starting Javalin ...
15:51:08.194 [main] INFO io.javalin.Javalin -- Listening on http://localhost:8085/
15:51:08.199 [main] INFO io.javalin.Javalin -- You are running Javalin 5.4.2 (released March 6, 2023).
15:51:08.201 [main] INFO io.javalin.Javalin -- Javalin started in 98ms \o/
15:51:12.592 [OkHttp http://localhost:8443/...] INFO org.snd.mediaserver.komga.KomgaEventListener -- connected to komga on http://localhost:8443/
15:51:48.180 [JettyServerThreadPool-32] INFO org.jooq.impl.DefaultExecuteContext.logVersionSupport -- Version                  : Database version is supported by dialect SQLITE: 3.40.1
15:51:48.215 [JettyServerThreadPool-32] INFO org.snd.mediaserver.MetadataService -- using ANILIST from previous manual identification for �A�z�t MediaServerSeriesId(id=0CB2GDWVP0J84)
15:51:48.605 [JettyServerThreadPool-32] INFO org.snd.mediaserver.MetadataService -- launching metadata aggregation using [MANGA_UPDATES, KODANSHA, BOOK_WALKER, MAL, NAUTILJON, VIZ, YEN_PRESS, COMIC_VINE, MANGADEX, BANGUMI]
15:51:48.608 [komf-meta-service-2] INFO org.snd.mediaserver.MetadataService -- searching "Onmyouji" using KODANSHA
15:51:48.608 [komf-meta-service-4] INFO org.snd.mediaserver.MetadataService -- searching "Onmyouji" using MAL
15:51:48.608 [komf-meta-service-3] INFO org.snd.mediaserver.MetadataService -- searching "Onmyouji" using BOOK_WALKER
15:51:48.608 [komf-meta-service-1] INFO org.snd.mediaserver.MetadataService -- searching "Onmyouji" using MANGA_UPDATES
15:51:49.068 [komf-meta-service-4] INFO org.snd.mediaserver.MetadataService -- found match: "Onmyouji" from MAL  ProviderSeriesId(id=15079)
15:51:49.069 [komf-meta-service-4] INFO org.snd.mediaserver.MetadataService -- searching "Onmyouji" using NAUTILJON
15:51:49.183 [komf-meta-service-2] INFO org.snd.mediaserver.MetadataService -- searching "�A�z�t" using KODANSHA
15:51:49.360 [komf-meta-service-1] INFO org.snd.mediaserver.MetadataService -- found match: "Onmyouji" from MANGA_UPDATES  ProviderSeriesId(id=41346530471)
15:51:49.361 [komf-meta-service-1] INFO org.snd.mediaserver.MetadataService -- searching "Onmyouji" using VIZ
15:51:49.379 [komf-meta-service-2] INFO org.snd.mediaserver.MetadataService -- searching "Onmyouji" using YEN_PRESS
15:51:49.461 [komf-meta-service-1] INFO org.snd.mediaserver.MetadataService -- searching "�A�z�t" using VIZ
15:51:49.524 [komf-meta-service-1] INFO org.snd.mediaserver.MetadataService -- searching "Onmyouji" using COMIC_VINE
15:51:49.588 [komf-meta-service-2] INFO org.snd.mediaserver.MetadataService -- searching "�A�z�t" using YEN_PRESS
15:51:49.689 [komf-meta-service-2] INFO org.snd.mediaserver.MetadataService -- searching "Onmyouji" using MANGADEX
15:51:49.728 [komf-meta-service-3] INFO org.snd.mediaserver.MetadataService -- searching "�A�z�t" using BOOK_WALKER
15:51:49.820 [komf-meta-service-2] INFO org.snd.mediaserver.MetadataService -- searching "�A�z�t" using MANGADEX
15:51:49.851 [komf-meta-service-1] INFO org.snd.mediaserver.MetadataService -- searching "�A�z�t" using COMIC_VINE
15:51:50.070 [komf-meta-service-1] INFO org.snd.mediaserver.MetadataService -- searching "Onmyouji" using BANGUMI
15:51:50.310 [komf-meta-service-1] INFO org.snd.mediaserver.MetadataService -- searching "�A�z�t" using BANGUMI
15:51:50.661 [komf-meta-service-4] INFO org.snd.mediaserver.MetadataService -- found match: "Onmyoji - Celui qui parle aux demons" from NAUTILJON  ProviderSeriesId(id=onmyoji - celui qui parle aux demons)
15:51:50.901 [komf-meta-service-2] INFO org.snd.mediaserver.MetadataService -- found match: "The Master of Shade and Light" from MANGADEX  ProviderSeriesId(id=9f1fb707-872a-4824-b12b-27a2894db9ed)
15:51:53.165 [komf-meta-service-1] INFO org.snd.mediaserver.MetadataService -- found match: "�A�z�t" from BANGUMI  ProviderSeriesId(id=101600)
15:51:53.171 [JettyServerThreadPool-32] INFO org.snd.mediaserver.MetadataUpdateService -- updating series �A�z�t
15:51:53.207 [JettyServerThreadPool-32] INFO org.snd.mediaserver.MetadataUpdateService -- updating book [�����сE�����q] �A�z�t - ��01��
15:51:53.244 [JettyServerThreadPool-32] INFO org.snd.mediaserver.MetadataUpdateService -- updating book [�����сE�����q] �A�z�t - ��02��
15:51:53.299 [JettyServerThreadPool-32] INFO org.snd.mediaserver.MetadataUpdateService -- updating book [�����сE�����q] �A�z�t - ��03��
15:51:53.325 [JettyServerThreadPool-32] INFO org.snd.mediaserver.MetadataUpdateService -- updating book [�����сE�����q] �A�z�t - ��04��
15:51:53.358 [JettyServerThreadPool-32] INFO org.snd.mediaserver.MetadataUpdateService -- updating book [�����сE�����q] �A�z�t - ��05��
15:51:53.390 [JettyServerThreadPool-32] INFO org.snd.mediaserver.MetadataUpdateService -- updating book [�����сE�����q] �A�z�t - ��06��
15:51:53.444 [JettyServerThreadPool-32] INFO org.snd.mediaserver.MetadataUpdateService -- updating book [�����сE�����q] �A�z�t - ��07��
15:51:53.484 [JettyServerThreadPool-32] INFO org.snd.mediaserver.MetadataUpdateService -- updating book [�����сE�����q] �A�z�t - ��08��
15:51:53.518 [JettyServerThreadPool-32] INFO org.snd.mediaserver.MetadataUpdateService -- updating book [�����сE�����q] �A�z�t - ��09��
15:51:53.544 [JettyServerThreadPool-32] INFO org.snd.mediaserver.MetadataUpdateService -- updating book [�����сE�����q] �A�z�t - ��10��
15:51:53.573 [JettyServerThreadPool-32] INFO org.snd.mediaserver.MetadataUpdateService -- updating book [�����сE�����q] �A�z�t - ��11��
15:51:53.613 [JettyServerThreadPool-32] INFO org.snd.mediaserver.MetadataUpdateService -- updating book [�����сE�����q] �A�z�t - ��12��
15:51:53.650 [JettyServerThreadPool-32] INFO org.snd.mediaserver.MetadataUpdateService -- updating book [�����сE�����q] �A�z�t - ��13��
15:51:53.676 [JettyServerThreadPool-32] INFO org.snd.mediaserver.MetadataService -- finished metadata update of series "�A�z�t" MediaServerSeriesId(id=0CB2GDWVP0J84)
komga:
  baseUri: "http://localhost:8444"
  komgaUser: "xxxxxxx@gmail.com"
  komgaPassword: "xxxxxxxxx"
  eventListener:
    enabled: true
    libraries:
    - "0655D962FQ2XD"
    - "066VFKT01DSCM"
    - "0773MK8QSH3E7"
    - "067QDWMET3D76"
    - "08B4257E9ZYNX"
  metadataUpdate:
    default:
      overrideExistingCovers: false
      bookCovers: true
      seriesCovers: true
      aggregate: true
      mergeTags: false
      mergeGenres: false
      postProcessing:
        scoreTag: true
        seriesTitleLanguage: "ja"
        alternativeSeriesTitles: true
        alternativeSeriesTitleLanguages:
        - "ja"
        - "ja-ro"
        - "en"
        readingDirectionValue: "RIGHT_TO_LEFT"
        languageValue: "ja"
    library:
      "0655D962FQ2XD":
        aggregate: true
        mergeTags: false
        mergeGenres: false
        postProcessing:
          scoreTag: true
          seriesTitleLanguage: "ja"
          alternativeSeriesTitles: true
          alternativeSeriesTitleLanguages:
          - "ja"
          - "ja-ro"
          - "en"
          readingDirectionValue: "RIGHT_TO_LEFT"
          languageValue: "ja"
      "066VFKT01DSCM":
        postProcessing:
          scoreTag: true
          seriesTitleLanguage: "ja"
          alternativeSeriesTitles: true
          alternativeSeriesTitleLanguages:
          - "ja"
          - "ja-ro"
          - "en"
          readingDirectionValue: "RIGHT_TO_LEFT"
          languageValue: "ja"
      "0773MK8QSH3E7":
        aggregate: true
        mergeTags: true
        mergeGenres: true
        postProcessing:
          scoreTag: true
          alternativeSeriesTitles: true
          alternativeSeriesTitleLanguages:
          - "ja"
          - "ja-ro"
          - "en"
          readingDirectionValue: "LEFT_TO_RIGHT"
          languageValue: "ja"
      "067QDWMET3D76":
        aggregate: true
        mergeTags: true
        mergeGenres: true
        postProcessing:
          scoreTag: true
          alternativeSeriesTitles: true
          alternativeSeriesTitleLanguages:
          - "ja"
          - "ja-ro"
          - "en"
          readingDirectionValue: "RIGHT_TO_LEFT"
          languageValue: "ja"
      "08B4257E9ZYNX":
        libraryType: "COMIC"
        aggregate: true
        mergeTags: true
        mergeGenres: true
        postProcessing:
          scoreTag: true
          seriesTitle: true
          alternativeSeriesTitles: true
          readingDirectionValue: "LEFT_TO_RIGHT"
          languageValue: "en"
metadataProviders:
  malClientId: xxxx
  comicVineApiKey: xxxx
  defaultProviders:
    mangaUpdates:
      priority: 2
      enabled: true
      seriesMetadata:
        ageRating: true
    mal:
      priority: 5
      enabled: true
    nautiljon:
      priority: 6
      enabled: true
    aniList:
      priority: 1
      enabled: true
    yenPress:
      priority: 8
      enabled: true
    kodansha:
      priority: 3
      enabled: true
    viz:
      priority: 7
      enabled: true
    bookWalker:
      priority: 4
      enabled: true
    mangaDex:
      enabled: true
    bangumi:
      priority: 11
      enabled: true
    comicVine:
      priority: 9
      enabled: true
Snd-R commented 1 year ago

It will not update sidecar covers for series And it can't detect volume number from your filenames so it won't update book covers

I'll need to add filename parsing for japanese titles like in your screenshot

Snd-R commented 1 year ago

or to make it simpler just fallback to a more lenient book number regex if volume number wasn't found https://github.com/Snd-R/komf/blob/master/src/main/kotlin/org/snd/mediaserver/MetadataService.kt#L241 https://github.com/Snd-R/komf/blob/master/src/main/kotlin/org/snd/metadata/BookNameParser.kt

kanjieater commented 1 year ago

It will not update sidecar covers for series And it can't detect volume number from your filenames so it won't update book covers

I'll need to add filename parsing for japanese titles like in your screenshot

Ok gotcha - That's what I was requesting with this feature. Basically download covers if they don't already exists. I think the solutions you mentioned seem good for fixing this, just curious how this is implemented at present. So is there a way to get them to download now with feature if I were to modify something on my end?

Probably not a good fit, but it might give you some ideas of how I've done something similar. https://github.com/kanjieater/ComicEater/blob/master/lib/covers.js

The covers I download currently come from Google Images with a site query for bookmeter, which sources it's images from Amazon. I found this was a reliable way to get most of the Japanese covers. There's a few simple regex's in there to make sure metadata of the image matches metadata of the archive.

Basically hoping Komf can fill in the last ~10% or so that don't work from ComicEater, which only does work during "pre-komga ingestion" (because I haven't done anything with SSE).

Snd-R commented 1 year ago

Currently before cover upload it checks if there's already a cover uploaded to komga To fetch or update book metadata komf needs to associate your books from komga with books found in metadata provider. To do this it checks book filename and extracts the number. If it can't parse book number it won't fetch or update any metadata for that book

kanjieater commented 1 year ago

Ah thanks for explaining. Should I make a new issue for japanese regex naming or reopen this issue for this feature to support it?

Snd-R commented 1 year ago

Better create a separate issue and describe what kind of titles you're using

kanjieater commented 1 year ago

Couldn't post to discord as it was too long, but this still isn't working for me, here's the config:


komga:
  baseUri: "http://x:x"
  komgaUser: "x@x.com"
  komgaPassword: "x"
  eventListener:
    enabled: true
    libraries:
    - "0655D962FQ2XD"
    - "066VFKT01DSCM"
    - "0773MK8QSH3E7"
    - "067QDWMET3D76"
    - "08B4257E9ZYNX"
  metadataUpdate:
    default:
      overrideExistingCovers: false
      bookCovers: true
      seriesCovers: true
      aggregate: true
      mergeTags: false
      mergeGenres: false
      postProcessing:
        scoreTag: true
        seriesTitleLanguage: "ja"
        alternativeSeriesTitles: true
        alternativeSeriesTitleLanguages:
        - "ja"
        - "ja-ro"
        - "en"
        readingDirectionValue: "RIGHT_TO_LEFT"
        languageValue: "ja"
    library:
      "0655D962FQ2XD":
        aggregate: true
        mergeTags: false
        mergeGenres: false
        postProcessing:
          scoreTag: true
          seriesTitleLanguage: "ja"
          alternativeSeriesTitles: true
          alternativeSeriesTitleLanguages:
          - "ja"
          - "ja-ro"
          - "en"
          readingDirectionValue: "RIGHT_TO_LEFT"
          languageValue: "ja"
      "066VFKT01DSCM":
        postProcessing:
          scoreTag: true
          seriesTitleLanguage: "ja"
          alternativeSeriesTitles: true
          alternativeSeriesTitleLanguages:
          - "ja"
          - "ja-ro"
          - "en"
          readingDirectionValue: "RIGHT_TO_LEFT"
          languageValue: "ja"
      "0773MK8QSH3E7":
        aggregate: true
        mergeTags: true
        mergeGenres: true
        postProcessing:
          scoreTag: true
          alternativeSeriesTitles: true
          alternativeSeriesTitleLanguages:
          - "ja"
          - "ja-ro"
          - "en"
          readingDirectionValue: "LEFT_TO_RIGHT"
          languageValue: "ja"
      "067QDWMET3D76":
        aggregate: true
        mergeTags: true
        mergeGenres: true
        postProcessing:
          scoreTag: true
          alternativeSeriesTitles: true
          alternativeSeriesTitleLanguages:
          - "ja"
          - "ja-ro"
          - "en"
          readingDirectionValue: "RIGHT_TO_LEFT"
          languageValue: "ja"
      "08B4257E9ZYNX":
        libraryType: "COMIC"
        aggregate: true
        mergeTags: true
        mergeGenres: true
        postProcessing:
          scoreTag: true
          seriesTitle: true
          alternativeSeriesTitles: true
          readingDirectionValue: "LEFT_TO_RIGHT"
          languageValue: "en"
metadataProviders:
  malClientId: x
  comicVineApiKey: x
  defaultProviders:
    mangaUpdates:
      priority: 2
      enabled: true
      seriesMetadata:
        ageRating: true
    mal:
      priority: 5
      enabled: true
    nautiljon:
      priority: 6
      enabled: true
    aniList:
      priority: 1
      enabled: true
    yenPress:
      priority: 8
      enabled: true
    kodansha:
      priority: 3
      enabled: true
    viz:
      priority: 7
      enabled: true
    bookWalker:
      priority: 4
      enabled: true
    mangaDex:
      enabled: true
    bangumi:
      priority: 11
      enabled: true
    comicVine:
      priority: 9
      enabled: true