This commit is contained in:
meisnate12 2021-03-19 01:16:37 -04:00
parent bddaa35733
commit 91f6503b22
3 changed files with 11 additions and 1 deletions

View file

@ -470,7 +470,7 @@ class CollectionBuilder:
elif attr in ["include_adult", "include_null_first_air_dates", "screened_theatrically"]: elif attr in ["include_adult", "include_null_first_air_dates", "screened_theatrically"]:
if attr_data is True: if attr_data is True:
new_dictionary[attr] = attr_data 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) 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"]: 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) new_dictionary[attr] = util.check_number(attr_data, f"{m} attribute {attr}", minimum=1800, maximum=current_year + 1)

View file

@ -1,4 +1,5 @@
import logging, tmdbv3api import logging, tmdbv3api
from datetime import datetime
from modules import util from modules import util
from modules.util import Failed from modules.util import Failed
from retrying import retry from retrying import retry
@ -155,6 +156,9 @@ class TMDbAPI:
def get_discover(self, attrs, amount, is_movie): def get_discover(self, attrs, amount, is_movie):
ids = [] ids = []
count = 0 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) self.Discover.discover_movies(attrs) if is_movie else self.Discover.discover_tv_shows(attrs)
total_pages = int(self.TMDb.total_pages) total_pages = int(self.TMDb.total_pages)
total_results = int(self.TMDb.total_results) total_results = int(self.TMDb.total_results)

View file

@ -516,6 +516,12 @@ discover_tv = [
"include_null_first_air_dates", "include_null_first_air_dates",
"screened_theatrically" "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 = [ discover_movie_sort = [
"popularity.asc", "popularity.desc", "popularity.asc", "popularity.desc",
"release_date.asc", "release_date.desc", "release_date.asc", "release_date.desc",