Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[yandere] "KeyError - '_ugoira_frame_index'" ig ugoira postprocessor exists #6154

Closed
kattjevfel opened this issue Sep 6, 2024 · 2 comments
Closed

Comments

@kattjevfel
Copy link
Contributor

When trying to download any image from yande.re I'm getting KeyError - '_ugoira_frame_index', even though it shouldn't run anything with ugoira at all.

katt@main ~ » gallery-dl --verbose https://yande.re/post/show/1189539
[gallery-dl][debug] Version 1.27.4
[gallery-dl][debug] Python 3.12.5 - Linux-6.10.8-zen1-1-zen-x86_64-with-glibc2.40
[gallery-dl][debug] requests 2.32.3 - urllib3 1.26.20
[gallery-dl][debug] Configuration Files ['${HOME}/.config/gallery-dl/config.json']
[gallery-dl][debug] Starting DownloadJob for 'https://yande.re/post/show/1189539'
[yandere][debug] Using MoebooruPostExtractor for 'https://yande.re/post/show/1189539'
[urllib3.connectionpool][debug] Starting new HTTPS connection (1): yande.re:443
[urllib3.connectionpool][debug] https://yande.re:443 "GET /post.json?tags=id%3A1189539 HTTP/1.1" 200 None
[postprocessor.ugoira][debug] using mkvmerge demuxer
[yandere][debug] Active postprocessor modules: [UgoiraPP]
[yandere][error] An unexpected error occurred: KeyError - '_ugoira_frame_index'. Please run gallery-dl again with the --verbose flag, copy its output and report this issue on https://github.com/mikf/gallery-dl/issues .
[yandere][debug] 
Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/gallery_dl/job.py", line 152, in run
    self.dispatch(msg)
  File "/usr/lib/python3.12/site-packages/gallery_dl/job.py", line 195, in dispatch
    self.handle_url(url, kwdict)
  File "/usr/lib/python3.12/site-packages/gallery_dl/job.py", line 305, in handle_url
    callback(pathfmt)
  File "/usr/lib/python3.12/site-packages/gallery_dl/postprocessor/ugoira.py", line 113, in prepare
    index = pathfmt.kwdict["_ugoira_frame_index"]
            ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
KeyError: '_ugoira_frame_index'

Minimal config to trigger this:

{
    "extractor": {
        "postprocessors": [
            {
                "ffmpeg-args": [
                    "-hide_banner",
                    "-c:v",
                    "libvpx-vp9",
                    "-lossless",
                    "1",
                    "-pix_fmt",
                    "yuv420p"
                ],
                "ffmpeg-twopass": false,
                "name": "ugoira"
            }
        ]
    }
}

This hasn't caused any issue in older versions, but do I have to set a whitelist for the extractor now?

@mikf
Copy link
Owner

mikf commented Sep 6, 2024

diff --git a/gallery_dl/postprocessor/ugoira.py b/gallery_dl/postprocessor/ugoira.py
index f053afa0..defde012 100644
--- a/gallery_dl/postprocessor/ugoira.py
+++ b/gallery_dl/postprocessor/ugoira.py
@@ -109,8 +109,11 @@ class UgoiraPP(PostProcessor):
                 pathfmt.set_extension(self.extension)
                 pathfmt.build_path()
         else:
+            index = pathfmt.kwdict.get("_ugoira_frame_index")
+            if index is None:
+                return
+
             pathfmt.build_path()
-            index = pathfmt.kwdict["_ugoira_frame_index"]
             frame = self._frames[index].copy()
             frame["index"] = index
             frame["path"] = pathfmt.realpath

@kattjevfel
Copy link
Contributor Author

kattjevfel commented Sep 6, 2024

That does work!

katt@main pkgbuilds/gallery-dl-git (master *%) » gallery-dl --verbose https://yande.re/post/show/1189539 --no-skip                                                                                  130 ↵
[gallery-dl][debug] Version 1.27.4
[gallery-dl][debug] Python 3.12.5 - Linux-6.10.8-zen1-1-zen-x86_64-with-glibc2.40
[gallery-dl][debug] requests 2.32.3 - urllib3 1.26.20
[gallery-dl][debug] Configuration Files ['${HOME}/.config/gallery-dl/config.json']
[gallery-dl][debug] Starting DownloadJob for 'https://yande.re/post/show/1189539'
[yandere][debug] Using MoebooruPostExtractor for 'https://yande.re/post/show/1189539'
[urllib3.connectionpool][debug] Starting new HTTPS connection (1): yande.re:443
[urllib3.connectionpool][debug] https://yande.re:443 "GET /post.json?tags=id%3A1189539 HTTP/1.1" 200 None
[yandere][debug] Using download archive '/mnt/jupiter/Temp/gallery-dl/archives/yandere.sqlite3'
[postprocessor.ugoira][debug] using mkvmerge demuxer
[yandere][debug] Active postprocessor modules: [ExecPP, UgoiraPP]
[urllib3.connectionpool][debug] Starting new HTTPS connection (1): files.yande.re:443
[urllib3.connectionpool][debug] https://files.yande.re:443 "GET /image/5804f591c55c73d2996147d90d729583/yande.re%201189539%20iris_black_games%20kurumi_noah%20lingerie%20vspo%21%20yahiro_%28heartseek000%29.jpg HTTP/1.1" 200 6596960
/mnt/jupiter/Temp/gallery-dl/yandere/yandere_1189539.jpg

mikf added a commit that referenced this issue Sep 9, 2024
fixes regression introduced in 07bd967

Files with a non-ugoira related 'frames' metadata field would cause an
exception when an ugoira post processor was active.
@mikf mikf closed this as completed Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants