Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove variant. Fix logger. No sanitize. No unknown rating #6

Merged
merged 2 commits into from
Sep 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 5 additions & 17 deletions metron_talker/metron.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
from mokkari.issue import Issue, IssueSchema, IssuesList
from mokkari.series import AssociatedSeries, Series, SeriesList, SeriesSchema

logger = logging.getLogger(__name__)
logger = logging.getLogger(f"comictalker.{__name__}")


class MetronSeriesType(Enum):
Expand Down Expand Up @@ -113,23 +113,13 @@ def register_settings(self, parser: settngs.Manager) -> None:
display_name="Use series start as volume",
help="Use the series start year as the volume number",
)
# Hide from CLI as it is GUI related
parser.add_setting(
"--met-display-variants",
default=False,
cmdline=False,
action=argparse.BooleanOptionalAction,
display_name="Display variant covers in the issue list",
help="Make variant covers available in the issue list window. *May result in longer load times*",
)
parser.add_setting(
"--met-series-covers",
default=False,
cmdline=False,
action=argparse.BooleanOptionalAction,
display_name="Attempt to fetch a cover for each series",
help="Fetches a cover for each series in the series selection window. "
"*This will cause a delay in showing the series window list!*",
help="Fetches a cover for each series in the series selection window",
)
parser.add_setting(
"--met-use-ongoing",
Expand Down Expand Up @@ -161,7 +151,6 @@ def parse_settings(self, settings: dict[str, Any]) -> dict[str, Any]:
settings = super().parse_settings(settings)

self.use_series_start_as_volume = settings["met_use_series_start_as_volume"]
self.display_variants = settings["met_display_variants"]
self.find_series_covers = settings["met_series_covers"]
self.use_ongoing_issue_count = settings["met_use_ongoing"]
self.username = settings["met_username"]
Expand Down Expand Up @@ -195,8 +184,7 @@ def search_for_series(
literal: bool = False,
series_match_thresh: int = 90,
) -> list[ComicSeries]:
search_series_name = utils.sanitize_title(series_name, literal)
logger.info(f"{self.name} searching: {search_series_name}")
logger.info(f"{self.name} searching: {series_name}")

# Before we search online, look in our cache, since we might have done this same search recently
# For literal searches always retrieve from online
Expand All @@ -208,7 +196,7 @@ def search_for_series(
json_cache = {"results": [json.loads(x[0].data) for x in cached_search_results]}
return self._format_search_results(SeriesList(json_cache))

met_response: SeriesList = self._get_metron_content("series_list", {"name": search_series_name})
met_response: SeriesList = self._get_metron_content("series_list", {"name": series_name})

# Cache these search results, even if it's literal we cache the results
# The most it will cause is extra processing time
Expand Down Expand Up @@ -536,7 +524,7 @@ def _map_comic_issue_to_metadata(self, issue: Issue, series: Series) -> GenericM
if len(issue.story_titles) > 0:
md.title = "; ".join(issue.story_titles)

if hasattr(issue, "rating"):
if hasattr(issue, "rating") and issue.rating.name != "Unknown":
md.maturity_rating = issue.rating.name

md.web_link = getattr(issue, "resource_url", None)
Expand Down
Loading