diff --git a/modules/builder.py b/modules/builder.py index 6f03f599..73bdd0e2 100644 --- a/modules/builder.py +++ b/modules/builder.py @@ -470,7 +470,7 @@ class CollectionBuilder: elif attr in ["include_adult", "include_null_first_air_dates", "screened_theatrically"]: if attr_data is True: new_dictionary[attr] = attr_data - elif attr in ["primary_release_date.gte", "primary_release_date.lte", "release_date.gte", "release_date.lte", "air_date.gte", "air_date.lte", "first_air_date.gte", "first_air_date.lte"]: + elif attr in util.discover_dates: new_dictionary[attr] = util.check_date(attr_data, f"{m} attribute {attr}", return_string=True) elif attr in ["primary_release_year", "year", "first_air_date_year"]: new_dictionary[attr] = util.check_number(attr_data, f"{m} attribute {attr}", minimum=1800, maximum=current_year + 1) diff --git a/modules/tmdb.py b/modules/tmdb.py index 076ae6d5..da8a98c9 100644 --- a/modules/tmdb.py +++ b/modules/tmdb.py @@ -1,4 +1,5 @@ import logging, tmdbv3api +from datetime import datetime from modules import util from modules.util import Failed from retrying import retry @@ -155,6 +156,9 @@ class TMDbAPI: def get_discover(self, attrs, amount, is_movie): ids = [] count = 0 + for date_attr in util.discover_dates: + if date_attr in attrs: + attrs[date_attr] = datetime.strftime(datetime.strptime(attrs[date_attr], "%m/%d/%Y"), "%Y-%m-%d") self.Discover.discover_movies(attrs) if is_movie else self.Discover.discover_tv_shows(attrs) total_pages = int(self.TMDb.total_pages) total_results = int(self.TMDb.total_results) diff --git a/modules/util.py b/modules/util.py index 8d19debf..f935b2b8 100644 --- a/modules/util.py +++ b/modules/util.py @@ -516,6 +516,12 @@ discover_tv = [ "include_null_first_air_dates", "screened_theatrically" ] +discover_dates = [ + "primary_release_date.gte", "primary_release_date.lte", + "release_date.gte", "release_date.lte", + "air_date.gte", "air_date.lte", + "first_air_date.gte", "first_air_date.lte" +] discover_movie_sort = [ "popularity.asc", "popularity.desc", "release_date.asc", "release_date.desc",