comictagger/testing/comicdata.py

156 lines
4.3 KiB
Python
Raw Normal View History

from __future__ import annotations
import comicapi.genericmetadata
from comicapi import utils
search_results = [
Convert ComicIssue into GenericMetadata I could not find a good reason for ComicIssue to exist other than that it had more attributes than GenericMetadata, so it has been replaced. New attributes for GenericMetadata: series_id: a string uniquely identifying the series to tag_origin series_aliases: alternate series names that are not the canonical name title_aliases: alternate issue titles that are not the canonical name alternate_images: a list of urls to alternate cover images Updated attributes for GenericMetadata: genre -> genres: str -> list[str] comments -> description: str -> str story_arc -> story_arcs: str -> list[str] series_group -> series_groups: str -> list[str] character -> characters: str -> list[str] team -> teams: str -> list[str] location -> locations: str -> list[str] tag_origin -> tag_origin: str -> TagOrigin (tuple[str, str]) ComicSeries has been relocated to the ComicAPI package, currently has no usage within ComicAPI. CreditMetadata has been renamed to Credit and has replaced Credit from ComicTalker. fetch_series has been added to ComicTalker, this is currently only used in the GUI when a series is selected and does not already contain the needed fields, this function should always be cached. A new split function has been added to ComicAPI, all uses of split on single characters have been updated to use this cleanup_html and the corresponding setting are now only used in ComicTagger proper, for display we want any html directly from the upstream. When applying the metadata we then strip the description of any html. A new conversion has been added to the MetadataFormatter: j: joins any lists into a string with ', '. Note this is a valid operation on strings as well, it will add ', ' in between every character. parse_settings now assigns the given ComicTaggerPaths object to the result ensuring that the correct path is always used.
2023-08-02 09:00:04 -07:00
comicapi.genericmetadata.ComicSeries(
count_of_issues=1,
count_of_volumes=1,
description="this is a description",
id="1",
image_url="https://test.org/image/1",
name="test",
2022-10-05 16:34:32 -07:00
publisher="test",
2022-10-15 15:20:50 -07:00
start_year=0,
aliases=[],
2023-03-01 16:23:56 -08:00
genres=[],
format=None,
),
Convert ComicIssue into GenericMetadata I could not find a good reason for ComicIssue to exist other than that it had more attributes than GenericMetadata, so it has been replaced. New attributes for GenericMetadata: series_id: a string uniquely identifying the series to tag_origin series_aliases: alternate series names that are not the canonical name title_aliases: alternate issue titles that are not the canonical name alternate_images: a list of urls to alternate cover images Updated attributes for GenericMetadata: genre -> genres: str -> list[str] comments -> description: str -> str story_arc -> story_arcs: str -> list[str] series_group -> series_groups: str -> list[str] character -> characters: str -> list[str] team -> teams: str -> list[str] location -> locations: str -> list[str] tag_origin -> tag_origin: str -> TagOrigin (tuple[str, str]) ComicSeries has been relocated to the ComicAPI package, currently has no usage within ComicAPI. CreditMetadata has been renamed to Credit and has replaced Credit from ComicTalker. fetch_series has been added to ComicTalker, this is currently only used in the GUI when a series is selected and does not already contain the needed fields, this function should always be cached. A new split function has been added to ComicAPI, all uses of split on single characters have been updated to use this cleanup_html and the corresponding setting are now only used in ComicTagger proper, for display we want any html directly from the upstream. When applying the metadata we then strip the description of any html. A new conversion has been added to the MetadataFormatter: j: joins any lists into a string with ', '. Note this is a valid operation on strings as well, it will add ', ' in between every character. parse_settings now assigns the given ComicTaggerPaths object to the result ensuring that the correct path is always used.
2023-08-02 09:00:04 -07:00
comicapi.genericmetadata.ComicSeries(
count_of_issues=1,
count_of_volumes=1,
description="this is a description",
id="2",
image_url="https://test.org/image/2",
name="test 2",
2022-10-05 16:34:32 -07:00
publisher="test",
2022-10-15 15:20:50 -07:00
start_year=0,
aliases=[],
2023-03-01 16:23:56 -08:00
genres=[],
format=None,
),
]
alt_covers = [
{"issue_id": 1, "url_list": ["https://test.org/image/1"]},
{"issue_id": 2, "url_list": ["https://test.org/image/2"]},
]
select_details = [
{
"issue_id": 1,
"image_url": "https://test.org/image/1",
"thumb_image_url": "https://test.org/thumb/1",
"cover_date": "1998",
"site_detail_url": "https://test.org/1",
},
{
"issue_id": 2,
"image_url": "https://test.org/image/2",
"thumb_image_url": "https://test.org/thumb/2",
"cover_date": "1998",
"site_detail_url": "https://test.org/2",
},
]
# Used to test GenericMetadata.overlay
metadata = [
(
comicapi.genericmetadata.GenericMetadata(series="test", issue="2", title="never"),
comicapi.genericmetadata.md_test.replace(series="test", issue="2", title="never"),
),
(
comicapi.genericmetadata.GenericMetadata(series="", issue="2", title="never"),
comicapi.genericmetadata.md_test.replace(series=None, issue="2", title="never"),
),
(
comicapi.genericmetadata.GenericMetadata(series="", issue="", title="never"),
comicapi.genericmetadata.md_test.replace(series=None, issue=None, title="never"),
),
(
comicapi.genericmetadata.GenericMetadata(series="", issue=None, title="never"),
comicapi.genericmetadata.md_test.replace(series=None, issue="1", title="never"),
),
(
comicapi.genericmetadata.GenericMetadata(),
comicapi.genericmetadata.md_test.copy(),
),
]
metadata_keys = [
(
comicapi.genericmetadata.GenericMetadata(),
{
"issue_count": 6,
"issue_number": "1",
"month": 10,
"series": "Cory Doctorow's Futuristic Tales of the Here and Now",
"year": 2007,
},
),
(
comicapi.genericmetadata.GenericMetadata(series="test"),
{
"issue_count": 6,
"issue_number": "1",
"month": 10,
"series": "test",
"year": 2007,
},
),
(
comicapi.genericmetadata.GenericMetadata(series="test", issue="3"),
{
"issue_count": 6,
"issue_number": "3",
"month": 10,
"series": "test",
"year": 2007,
},
),
]
credits = [
(comicapi.genericmetadata.md_test, "writer", "Dara Naraghi"),
(comicapi.genericmetadata.md_test, "writeR", "Dara Naraghi"),
(
comicapi.genericmetadata.md_test.replace(
credits=[{"person": "Dara Naraghi", "role": "writer"}, {"person": "Dara Naraghi", "role": "writer"}]
),
"writeR",
"Dara Naraghi",
),
]
imprints = [
("marvel", ("", "Marvel")),
("marvel comics", ("", "Marvel")),
("aircel", ("Aircel Comics", "Marvel")),
("nothing", ("", "nothing")),
]
additional_imprints = [
("test", ("Test", "Marvel")),
("temp", ("Temp", "DC Comics")),
]
all_imprints = imprints + additional_imprints
seed_imprints = {
2023-02-04 15:02:21 -08:00
"Marvel": utils.ImprintDict("Marvel", {"marvel comics": "", "aircel": "Aircel Comics"}),
}
additional_seed_imprints = {
"Marvel": utils.ImprintDict("Marvel", {"test": "Test"}),
"DC Comics": utils.ImprintDict("DC Comics", {"temp": "Temp"}),
}
all_seed_imprints = {
"Marvel": seed_imprints["Marvel"].copy(),
"DC Comics": additional_seed_imprints["DC Comics"].copy(),
}
all_seed_imprints["Marvel"].update(additional_seed_imprints["Marvel"])
conflicting_seed_imprints = {"Marvel": {"test": "Never"}}