-
-
Notifications
You must be signed in to change notification settings - Fork 66
Description
With manga_info type set to json
and additional keys present within the json, mangadex-dl will crash:
manga_info[dict_key] = data[dict_key]
~~~~^^^^^^^^^^
KeyError: 'test'
From what I read in the code is that for the json
output the existing file is read, and keys are refreshed.
I'm not fully sure what _ensure_manga_data
is supposed to do. as the code looks like trouble to my unknown eyes, as even if the keys would be present in
The refresh should rely on keys from the data object, not the existing_data. That way, additional data would be left alone (as this seems to be the intended way). Otherwise the data could just be overwritten, and the loop dropped.
Edit.: Thinking about it, the existing implementation could be like this due to the CSV format, in which they key-order is important. In that case the json format should be refactored accordingly, and/or additional checks be added.
Besides the crash, I find it a bit unusual that the default JSON output consists of a single object within an array. While this is technically valid JSON, I believe a single object is more commonly used (like in the mihon format, which I prefer for that reason).
I dunno in which configuration multiple will be placed within one manga_info.json, as my config results in one manga_info.json file per manga.
But then, wouldn't the mihon
format be incompatible with whatever configuration would yield that as a result for the json
format?