2022-07-11 16:10:31 -07:00
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
import comicapi.genericmetadata
|
|
|
|
from comicapi import utils
|
|
|
|
|
|
|
|
search_results = [
|
2023-08-05 03:02:12 -07:00
|
|
|
dict(
|
2022-07-11 16:10:31 -07:00
|
|
|
count_of_issues=1,
|
2023-05-12 13:48:45 -07:00
|
|
|
count_of_volumes=1,
|
2022-07-11 16:10:31 -07:00
|
|
|
description="this is a description",
|
2022-12-23 00:09:19 -08:00
|
|
|
id="1",
|
2022-10-23 14:40:15 -07:00
|
|
|
image_url="https://test.org/image/1",
|
2022-07-11 16:10:31 -07:00
|
|
|
name="test",
|
2022-10-05 16:34:32 -07:00
|
|
|
publisher="test",
|
2022-10-15 15:20:50 -07:00
|
|
|
start_year=0,
|
2022-11-03 16:32:35 -07:00
|
|
|
aliases=[],
|
2023-05-22 16:27:58 -07:00
|
|
|
format=None,
|
2022-07-11 16:10:31 -07:00
|
|
|
),
|
2023-08-05 03:02:12 -07:00
|
|
|
dict(
|
2022-07-11 16:10:31 -07:00
|
|
|
count_of_issues=1,
|
2023-05-12 13:48:45 -07:00
|
|
|
count_of_volumes=1,
|
2022-07-11 16:10:31 -07:00
|
|
|
description="this is a description",
|
2022-12-23 00:09:19 -08:00
|
|
|
id="2",
|
2022-10-23 14:40:15 -07:00
|
|
|
image_url="https://test.org/image/2",
|
2022-07-11 16:10:31 -07:00
|
|
|
name="test 2",
|
2022-10-05 16:34:32 -07:00
|
|
|
publisher="test",
|
2022-10-15 15:20:50 -07:00
|
|
|
start_year=0,
|
2022-11-03 16:32:35 -07:00
|
|
|
aliases=[],
|
2023-05-22 16:27:58 -07:00
|
|
|
format=None,
|
2022-07-11 16:10:31 -07:00
|
|
|
),
|
|
|
|
]
|
|
|
|
|
|
|
|
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 = [
|
|
|
|
(
|
2024-05-10 15:51:13 -07:00
|
|
|
comicapi.genericmetadata.md_test.copy(),
|
2022-07-11 16:10:31 -07:00
|
|
|
comicapi.genericmetadata.GenericMetadata(series="test", issue="2", title="never"),
|
2022-07-18 09:00:56 -07:00
|
|
|
comicapi.genericmetadata.md_test.replace(series="test", issue="2", title="never"),
|
2022-07-11 16:10:31 -07:00
|
|
|
),
|
2022-07-18 09:00:56 -07:00
|
|
|
(
|
2024-05-10 15:51:13 -07:00
|
|
|
comicapi.genericmetadata.md_test.copy(),
|
2022-07-18 09:00:56 -07:00
|
|
|
comicapi.genericmetadata.GenericMetadata(),
|
|
|
|
comicapi.genericmetadata.md_test.copy(),
|
2022-07-11 16:10:31 -07:00
|
|
|
),
|
2024-05-10 15:51:13 -07:00
|
|
|
(
|
|
|
|
comicapi.genericmetadata.GenericMetadata(
|
2024-07-27 19:39:15 -07:00
|
|
|
series="series1",
|
|
|
|
tags={"test", "tags"}, # These get overwritten because lists do not get merged by default
|
2024-05-10 15:51:13 -07:00
|
|
|
credits=[
|
|
|
|
comicapi.genericmetadata.Credit(person="test", role="writer", primary=False),
|
|
|
|
comicapi.genericmetadata.Credit(person="test", role="artist", primary=True),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
comicapi.genericmetadata.GenericMetadata(
|
2024-07-27 19:39:15 -07:00
|
|
|
title="title2",
|
|
|
|
tags={"testing"},
|
2024-05-10 15:51:13 -07:00
|
|
|
credits=[
|
2024-07-27 19:39:15 -07:00
|
|
|
# This first item gets removed because there is no name
|
2024-05-10 15:51:13 -07:00
|
|
|
comicapi.genericmetadata.Credit(person="", role="writer", primary=False),
|
|
|
|
comicapi.genericmetadata.Credit(person="test2", role="inker", primary=False),
|
2024-07-27 19:39:15 -07:00
|
|
|
],
|
2024-05-10 15:51:13 -07:00
|
|
|
),
|
|
|
|
comicapi.genericmetadata.GenericMetadata(
|
2024-07-27 19:39:15 -07:00
|
|
|
series="series1",
|
|
|
|
title="title2",
|
|
|
|
tags={"testing"},
|
2024-05-10 15:51:13 -07:00
|
|
|
credits=[
|
|
|
|
comicapi.genericmetadata.Credit(person="test2", role="inker", primary=False),
|
2024-07-27 19:39:15 -07:00
|
|
|
],
|
2024-05-10 15:51:13 -07:00
|
|
|
),
|
|
|
|
),
|
2022-07-18 09:00:56 -07:00
|
|
|
]
|
|
|
|
|
2024-04-22 17:29:47 -07:00
|
|
|
metadata_add = [
|
|
|
|
(
|
|
|
|
comicapi.genericmetadata.GenericMetadata(
|
2024-05-10 15:51:13 -07:00
|
|
|
series="test",
|
|
|
|
title="test",
|
|
|
|
issue="1",
|
|
|
|
volume_count=1,
|
|
|
|
page_count=3,
|
|
|
|
day=3,
|
|
|
|
genres={"test", "test2"},
|
|
|
|
story_arcs=["arc"],
|
|
|
|
characters=set(),
|
|
|
|
credits=[
|
|
|
|
comicapi.genericmetadata.Credit(person="test", role="writer", primary=False),
|
|
|
|
comicapi.genericmetadata.Credit(person="test", role="artist", primary=True),
|
|
|
|
],
|
2024-04-22 17:29:47 -07:00
|
|
|
),
|
|
|
|
comicapi.genericmetadata.GenericMetadata(
|
2024-05-10 15:51:13 -07:00
|
|
|
series="test2",
|
|
|
|
title="",
|
|
|
|
issue_count=2,
|
|
|
|
page_count=2,
|
|
|
|
day=0,
|
|
|
|
genres={"fake"},
|
|
|
|
characters={"bob", "fred"},
|
|
|
|
scan_info="nothing",
|
|
|
|
credits=[
|
|
|
|
comicapi.genericmetadata.Credit(person="Bob", role="writer", primary=False),
|
|
|
|
comicapi.genericmetadata.Credit(person="test", role="artist", primary=True),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
comicapi.genericmetadata.GenericMetadata(
|
|
|
|
series="test",
|
|
|
|
title="test",
|
|
|
|
issue="1",
|
|
|
|
issue_count=2,
|
|
|
|
volume_count=1,
|
|
|
|
day=3,
|
|
|
|
page_count=3,
|
2024-05-11 08:42:24 -07:00
|
|
|
genres={"fake", "test", "test2"},
|
2024-05-10 15:51:13 -07:00
|
|
|
story_arcs=["arc"],
|
|
|
|
characters={"bob", "fred"},
|
|
|
|
scan_info="nothing",
|
|
|
|
credits=[
|
|
|
|
comicapi.genericmetadata.Credit(person="Bob", role="writer", primary=False),
|
2024-07-27 19:39:15 -07:00
|
|
|
comicapi.genericmetadata.Credit(person="test", role="artist", primary=True),
|
|
|
|
comicapi.genericmetadata.Credit(person="test", role="writer", primary=False),
|
2024-05-10 15:51:13 -07:00
|
|
|
],
|
2024-04-22 17:29:47 -07:00
|
|
|
),
|
|
|
|
),
|
|
|
|
]
|
|
|
|
|
|
|
|
metadata_combine = [
|
|
|
|
(
|
|
|
|
comicapi.genericmetadata.GenericMetadata(
|
|
|
|
series="test",
|
|
|
|
title="test",
|
2024-05-10 15:51:13 -07:00
|
|
|
issue="1",
|
|
|
|
volume_count=1,
|
|
|
|
page_count=3,
|
|
|
|
day=3,
|
2024-04-22 17:29:47 -07:00
|
|
|
genres={"test", "test2"},
|
2024-05-10 15:51:13 -07:00
|
|
|
story_arcs=["arc"],
|
|
|
|
characters=set(),
|
2024-04-22 17:29:47 -07:00
|
|
|
web_links=[comicapi.genericmetadata.parse_url("https://my.comics.here.com")],
|
|
|
|
),
|
|
|
|
comicapi.genericmetadata.GenericMetadata(
|
|
|
|
series="test2",
|
2024-05-10 15:51:13 -07:00
|
|
|
title="",
|
|
|
|
issue_count=2,
|
|
|
|
page_count=2,
|
|
|
|
day=0,
|
|
|
|
genres={"fake"},
|
2024-04-22 17:29:47 -07:00
|
|
|
characters={"bob", "fred"},
|
2024-05-10 15:51:13 -07:00
|
|
|
scan_info="nothing",
|
|
|
|
web_links=[comicapi.genericmetadata.parse_url("https://my.comics.here.com")],
|
2024-04-22 17:29:47 -07:00
|
|
|
),
|
|
|
|
comicapi.genericmetadata.GenericMetadata(
|
|
|
|
series="test2",
|
2024-05-10 15:51:13 -07:00
|
|
|
title="test",
|
2024-04-22 17:29:47 -07:00
|
|
|
issue="1",
|
2024-05-10 15:51:13 -07:00
|
|
|
issue_count=2,
|
|
|
|
volume_count=1,
|
|
|
|
day=0,
|
|
|
|
page_count=2,
|
|
|
|
genres={"fake", "test", "test2"},
|
|
|
|
story_arcs=["arc"],
|
2024-04-22 17:29:47 -07:00
|
|
|
characters={"bob", "fred"},
|
2024-05-10 15:51:13 -07:00
|
|
|
scan_info="nothing",
|
2024-04-22 17:29:47 -07:00
|
|
|
web_links=[comicapi.genericmetadata.parse_url("https://my.comics.here.com")],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
comicapi.genericmetadata.GenericMetadata(characters={"Macintosh", "Søren Kierkegaard", "Barry"}),
|
|
|
|
comicapi.genericmetadata.GenericMetadata(characters={"MacIntosh", "Soren Kierkegaard"}),
|
|
|
|
comicapi.genericmetadata.GenericMetadata(
|
|
|
|
characters={"MacIntosh", "Soren Kierkegaard", "Søren Kierkegaard", "Barry"}
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
comicapi.genericmetadata.GenericMetadata(story_arcs=["arc 1", "arc2", "arc 3"]),
|
|
|
|
comicapi.genericmetadata.GenericMetadata(story_arcs=["Arc 1", "Arc2"]),
|
|
|
|
comicapi.genericmetadata.GenericMetadata(story_arcs=["Arc 1", "Arc2", "arc 3"]),
|
|
|
|
),
|
|
|
|
]
|
|
|
|
|
2022-07-18 09:00:56 -07:00
|
|
|
metadata_keys = [
|
2022-07-11 16:10:31 -07:00
|
|
|
(
|
2024-02-24 18:30:41 -08:00
|
|
|
comicapi.genericmetadata.md_test,
|
2022-07-18 09:00:56 -07:00
|
|
|
{
|
|
|
|
"issue_count": 6,
|
|
|
|
"issue_number": "1",
|
|
|
|
"month": 10,
|
|
|
|
"series": "Cory Doctorow's Futuristic Tales of the Here and Now",
|
|
|
|
"year": 2007,
|
2024-02-24 18:30:41 -08:00
|
|
|
"alternate_count": 7,
|
|
|
|
"alternate_number": "2",
|
|
|
|
"imprint": "craphound.com",
|
|
|
|
"publisher": "IDW Publishing",
|
2022-07-18 09:00:56 -07:00
|
|
|
},
|
2022-07-11 16:10:31 -07:00
|
|
|
),
|
|
|
|
]
|
|
|
|
|
|
|
|
credits = [
|
2022-07-27 23:24:34 -07:00
|
|
|
(comicapi.genericmetadata.md_test, "writer", "Dara Naraghi"),
|
|
|
|
(comicapi.genericmetadata.md_test, "writeR", "Dara Naraghi"),
|
|
|
|
(
|
|
|
|
comicapi.genericmetadata.md_test.replace(
|
2024-05-10 15:51:13 -07:00
|
|
|
credits=[
|
|
|
|
comicapi.genericmetadata.Credit(person="Dara Naraghi", role="writer"),
|
|
|
|
comicapi.genericmetadata.Credit(person="Dara Naraghi", role="writer"),
|
|
|
|
]
|
2022-07-27 23:24:34 -07:00
|
|
|
),
|
|
|
|
"writeR",
|
|
|
|
"Dara Naraghi",
|
|
|
|
),
|
2022-07-11 16:10:31 -07:00
|
|
|
]
|
|
|
|
|
|
|
|
imprints = [
|
|
|
|
("marvel", ("", "Marvel")),
|
|
|
|
("marvel comics", ("", "Marvel")),
|
|
|
|
("aircel", ("Aircel Comics", "Marvel")),
|
2022-08-08 18:03:29 -07:00
|
|
|
("nothing", ("", "nothing")),
|
2022-07-11 16:10:31 -07:00
|
|
|
]
|
|
|
|
|
|
|
|
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"}),
|
2022-07-11 16:10:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
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"}}
|
2024-04-28 13:53:41 -07:00
|
|
|
|
|
|
|
|
|
|
|
metadata_prepared = (
|
|
|
|
(
|
|
|
|
(comicapi.genericmetadata.GenericMetadata(), comicapi.genericmetadata.GenericMetadata()),
|
|
|
|
comicapi.genericmetadata.GenericMetadata(notes="Tagged with ComicTagger 1.3.2a5 on 2022-04-16 15:52:26."),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
(comicapi.genericmetadata.GenericMetadata(issue_id="123"), comicapi.genericmetadata.GenericMetadata()),
|
|
|
|
comicapi.genericmetadata.GenericMetadata(
|
|
|
|
issue_id="123", notes="Tagged with ComicTagger 1.3.2a5 on 2022-04-16 15:52:26. [Issue ID 123]"
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
(
|
|
|
|
comicapi.genericmetadata.GenericMetadata(
|
2024-06-20 16:47:10 -07:00
|
|
|
issue_id="123", data_origin=comicapi.genericmetadata.MetadataOrigin("SOURCE", "Source")
|
2024-04-28 13:53:41 -07:00
|
|
|
),
|
|
|
|
comicapi.genericmetadata.GenericMetadata(),
|
|
|
|
),
|
|
|
|
comicapi.genericmetadata.GenericMetadata(
|
|
|
|
issue_id="123",
|
2024-06-20 16:47:10 -07:00
|
|
|
data_origin=comicapi.genericmetadata.MetadataOrigin("SOURCE", "Source"),
|
2024-04-28 13:53:41 -07:00
|
|
|
notes="Tagged with ComicTagger 1.3.2a5 using info from Source on 2022-04-16 15:52:26. [Issue ID 123]",
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|