Skip to content

Commit

Permalink
Add Docs and Additional DataSources (#140)
Browse files Browse the repository at this point in the history
* Add new functions to docs
* Add documentation to `DataSources` class
* Add addition comictagger sources to get ID from
  • Loading branch information
bpepple authored Dec 1, 2024
1 parent 5ee4933 commit 5ee22f3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
20 changes: 20 additions & 0 deletions darkseid/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,26 @@

# TODO: Change to StrEnum when Python-3.10 support dropped
class DataSources(str, Enum):
"""Enumeration for various comic data sources.
This class defines a set of constants representing different sources of comic data.
Each constant is a string that corresponds to a specific data source name.
Attributes:
COMIC_VINE (str): Represents the Comic Vine data source.
METRON (str): Represents the Metron data source.
GCD (str): Represents the Grand Comics Database data source.
KITSU (str): Represents the Kitsu data source.
MANGADEX (str): Represents the MangaDex data source.
MANGAUPDATES (str): Represents the MangaUpdates data source.
"""

COMIC_VINE = "Comic Vine"
METRON = "Metron"
GCD = "Grand Comics Database"
KITSU = "Kitsu"
MANGADEX = "MangaDex"
MANGAUPDATES = "MangaUpdates"


def get_issue_id_from_note(note_txt: str) -> dict[str, str] | None:
Expand Down Expand Up @@ -41,6 +58,9 @@ def get_issue_id_from_note(note_txt: str) -> dict[str, str] | None:
"comic vine": DataSources.COMIC_VINE,
"metron": DataSources.METRON,
"grand comics database": DataSources.GCD,
"mangadex": DataSources.MANGADEX,
"mangaupdates": DataSources.MANGAUPDATES,
"kitsu": DataSources.KITSU,
}

if match := re.search(r"(issue id (\d+))|(cvdb(\d+))", note_lower):
Expand Down
2 changes: 2 additions & 0 deletions docs/darkseid/utils.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:::darkseid.utils.DataSources
:::darkseid.utils.get_issue_id_from_note
:::darkseid.utils.get_recursive_filelist
:::darkseid.utils.list_to_string
:::darkseid.utils.remove_articles
Expand Down

0 comments on commit 5ee22f3

Please sign in to comment.