Commit Graph

19 Commits

Author SHA1 Message Date
Timmy Welch
f72ebdb149 Simplify ComicCacher to store a single binary data field and ID(s)
If the ComicCacher is to be a generic cache for talkers it must assume
 very little. Current assumptions:
 - There are issues that can be queried individually by an "Issue ID" and they have a relation to a single series
 - There are series that can be queried individually by an "Series ID" and they have a relation to zero or more issues
 - There are Searches that can be queried by the search term and they have a relation to zero or more series

Each series and issue have a boolean `complete` attribute which is up to the talker to decide what it means.
Data is returned as a tuple ([series, complete] or [issue, complete]) or a list of tuples
An issue consists of an ID, an series ID and a binary data attribute which is up to the talker to determine what it means.
An series consists of in ID and a binary data attribute which is up to the talker to determine what it means.

The data attribute is binary to allow for compression and efficient storage of binary data (e.g. pickle) it is suggested to store it as json or similar text format encoded with utf-8. If the talker is using a website API it is suggested to store the raw response from the server.

All caches automatically expire 7 days after insertion.
2023-08-05 03:02:12 -07:00
Timmy Welch
2c3a2566cc 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
Mizaki
2187ddece8 Move volume from ComicSeries to ComicIssue 2023-06-23 22:38:15 +01:00
Timmy Welch
3a287504ae Fix setting issue and alternate_number on GenericMetadata
IssueString.as_string always returns a string this is a problem for
  GenericMetadata. When the overlay function is used it checks
  specifically for the value None this allows the -m option to unset
  attributes however the issue attribute would get set to the empty
  string when loading ComicRack tags regardless of if there was a value
  stored in the file. Fixes #465 and #480
2023-06-15 20:26:38 -07:00
Mizaki
e72347656b Add format (1-shot, limited series, etc.) 2023-05-23 00:27:58 +01:00
Mizaki
6cf259191e Add volume and count_of_volumes to ComicSeries 2023-05-12 21:48:45 +01:00
Mizaki
9e86b5e331 Fix tests 2023-03-02 00:23:56 +00:00
Timmy Welch
4eb9e008ce
Update pre-commit 2023-02-10 00:25:20 -08:00
Timmy Welch
9f00af4bba
Change issue id and series id to strings 2022-12-23 00:09:19 -08:00
Timmy Welch
1d9840913a
Change all references of volume to series 2022-12-22 10:16:05 -08:00
Mizaki
b4f6820f56 remove_fetch_alternate_cover_urls.patch 2022-11-03 23:32:35 +00:00
Mizaki
d23258f359 Change ComicVolume, ComicIssue to image_url and image_thumb_url. Add/change search/volume DB layout to remove duplication of data. Fixup some test. 2022-10-23 22:40:15 +01:00
Mizaki
43464724bd Convert all start_year to int. 2022-10-15 23:20:50 +01:00
Mizaki
6a98afb89c After second merge. 2022-10-06 00:34:32 +01:00
Timmy Welch
aadeb07c49 Fix issues
Refactor add_to_path with tests
Fix type hints for titles_match
Use casefold in get_language
Fix using the recursive flag in cli mode
Add http status code to ComicVine exceptions
Fix parenthesis getting removed when renaming
Add more tests
2022-08-08 18:05:06 -07:00
Timmy Welch
94be266e17 Handle the 'primary' key missing in get_primary_credit
Fixes #342
Add better exception handling for the formatter
2022-07-27 23:24:34 -07:00
Timmy Welch
6e7660c3d9 Tests
Add tests for IssueIdentifier
Change tags to a set from a string
Add copy and replace convenience functions on GenericMetadata
Update deprecated resampling code for Pillow
Change comicvine test data to be the same as the test comic
Cleanup tests
2022-07-18 12:06:49 -07:00
Timmy Welch
c0880c9afe Account for aliases field from CV 2022-07-13 23:11:14 -07:00
Timmy Welch
0bbf417133 Tests
Add tests for ComicCacher and ComicVineTalker
Move fixtures to conftest.py
Move test data to testing module
2022-07-11 18:40:12 -07:00