Skip to content

comicbox.readinglists.sources.comicvine ΒΆ

Comic Vine story arcs, through the shared simyan client.

The calls go through ComicVineOnlineSource, so they spend the same hourly budgets and fill the same response cache as tagging with the same key. Imported only when a Comic Vine fetch runs: it loads simyan.

check_key(session) ΒΆ

Raise unless a Comic Vine API key is set, before a fetch begins.

Source code in comicbox/readinglists/sources/comicvine.py
62
63
64
def check_key(session: FetchContext) -> None:
    """Raise unless a Comic Vine API key is set, before a fetch begins."""
    _configured(session)

fetch_arc(session, arc_id) ΒΆ

Fetch a story arc as a list: the arc, then its issues, then their volumes.

The arc names its issues by id alone, so they are asked for by id, a hundred a call, and their volumes the same way, for the series, numbers and dates. Each issue call emits a progress event counting the issues asked for.

A cancel is checked before each call. A call already sent runs to its end: simyan has no hook to stop one, and paces each to a second.

Source code in comicbox/readinglists/sources/comicvine.py
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
def fetch_arc(session: FetchContext, arc_id: int) -> ReadingListResult:
    """
    Fetch a story arc as a list: the arc, then its issues, then their volumes.

    The arc names its issues by id alone, so they are asked for by id, a
    hundred a call, and their volumes the same way, for the series, numbers
    and dates. Each issue call emits a progress event counting the issues
    asked for.

    A cancel is checked before each call. A call already sent runs to its
    end: simyan has no hook to stop one, and paces each to a second.
    """
    kind, key = SourceKind.COMICVINE_ARC.value, str(arc_id)
    with _calling(session, f"Comic Vine arc {arc_id}") as source:
        arc = source.story_arc(arc_id)
        issue_ids = _unique(member.id for member in arc.issues)
        issues, asked = [], 0
        for batch in _batches(issue_ids):
            session.check_cancelled()
            issues.extend(source.issues_by_id(batch))
            asked += len(batch)
            session.emit(
                ReadingListFetchProgress(
                    index=asked,
                    total=len(issue_ids),
                    source=kind,
                    key=key,
                )
            )
        volumes = []
        for batch in _batches(_unique(issue.volume.id for issue in issues)):
            session.check_cancelled()
            volumes.extend(source.volumes_by_id(batch))
    return reading_list_from_comicvine_arc(arc, issues, volumes)