Merge pull request #351 from axsuul/first_air_date

pull/353/head
meisnate12 3 years ago committed by GitHub
commit a56fabc83d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -95,6 +95,7 @@ all_filters = [
"release", "release.not", "release.before", "release.after", "release.regex", "history",
"added", "added.not", "added.before", "added.after", "added.regex",
"last_played", "last_played.not", "last_played.before", "last_played.after", "last_played.regex",
"first_episode_aired", "first_episode_aired.not", "first_episode_aired.before", "first_episode_aired.after", "first_episode_aired.regex",
"last_episode_aired", "last_episode_aired.not", "last_episode_aired.before", "last_episode_aired.after", "last_episode_aired.regex",
"title", "title.not", "title.begins", "title.ends", "title.regex",
"plays.gt", "plays.gte", "plays.lt", "plays.lte",
@ -122,7 +123,7 @@ movie_only_filters = [
"resolution", "resolution.not",
"writer", "writer.not"
]
show_only_filters = ["last_episode_aired", "network"]
show_only_filters = ["first_episode_aired", "last_episode_aired", "network"]
smart_invalid = ["collection_order"]
smart_url_invalid = ["filters", "run_again", "sync_mode", "show_filtered", "show_missing", "save_missing", "smart_label"] + radarr_details + sonarr_details
custom_sort_builders = [
@ -1075,9 +1076,11 @@ class CollectionBuilder:
if (modifier == ".not" and item.original_language in filter_data) \
or (modifier == "" and item.original_language not in filter_data):
return False
elif filter_attr in ["last_episode_aired"]:
elif filter_attr in ["first_episode_aired", "last_episode_aired"]:
tmdb_date = None
if filter_attr == "last_episode_aired":
if filter_attr == "first_episode_aired":
tmdb_date = item.first_air_date
elif filter_attr == "last_episode_aired":
tmdb_date = item.last_air_date
if not util.date_filter(tmdb_date, modifier, filter_data, filter_final, self.current_time):
return False
@ -1388,7 +1391,7 @@ class CollectionBuilder:
for filter_method, filter_data in self.filters:
filter_attr, modifier, filter_final = self._split(filter_method)
filter_actual = filter_translation[filter_attr] if filter_attr in filter_translation else filter_attr
if filter_attr in ["tmdb_vote_count", "original_language", "last_episode_aired"]:
if filter_attr in ["tmdb_vote_count", "original_language", "first_episode_aired", "last_episode_aired"]:
if current.ratingKey not in self.library.movie_rating_key_map and current.ratingKey not in self.library.show_rating_key_map:
logger.warning(f"Filter Error: No {'TMDb' if self.library.is_movie else 'TVDb'} ID found for {current.title}")
return False
@ -1402,7 +1405,7 @@ class CollectionBuilder:
return False
if not self.check_tmdb_filter(t_id, current.ratingKey in self.library.movie_rating_key_map):
return False
if filter_attr in ["release", "added", "last_played"]:
elif filter_attr in ["release", "added", "last_played"]:
if not util.date_filter(getattr(current, filter_actual), modifier, filter_data, filter_final, self.current_time):
return False
elif filter_attr == "audio_track_title":

@ -133,7 +133,7 @@ show_only_searches = [
"episode_year", "episode_year.not", "episode_year.gt", "episode_year.gte", "episode_year.lt", "episode_year.lte"
]
number_attributes = [
"plays", "episode_plays", "duration", "tmdb_vote_count", "last_episode_aired",
"plays", "episode_plays", "duration", "tmdb_vote_count", "first_episode_aired", "last_episode_aired",
"added", "episode_added", "release", "episode_air_date", "last_played", "episode_last_played"
]
float_attributes = ["user_rating", "episode_user_rating", "critic_rating", "audience_rating"]
@ -142,7 +142,7 @@ boolean_attributes = [
"unplayed_episodes", "episode_unplayed", "episode_duplicate", "episode_progress", "episode_unmatched",
]
tmdb_attributes = ["actor", "director", "producer", "writer"]
date_attributes = ["added", "episode_added", "release", "episode_air_date", "last_played", "episode_last_played", "last_episode_aired"]
date_attributes = ["added", "episode_added", "release", "episode_air_date", "last_played", "episode_last_played", "first_episode_aired", "last_episode_aired"]
search_display = {"added": "Date Added", "release": "Release Date", "hdr": "HDR", "progress": "In Progress", "episode_progress": "Episode In Progress"}
sorts = {
None: None,

Loading…
Cancel
Save