Ignore items with future added at dates in newsletter

This commit is contained in:
JonnyWong16 2021-04-22 17:40:59 -07:00
parent abdde65c2e
commit 07ccd2af96
No known key found for this signature in database
GPG key ID: B1F1F9807184697A

View file

@ -713,7 +713,7 @@ class RecentlyAdded(Newsletter):
while not done:
recent_items = pms_connect.get_recently_added_details(start=str(start), count='10', media_type=media_type)
filtered_items = [i for i in recent_items['recently_added']
if self.start_time < helpers.cast_to_int(i['added_at']) < self.end_time]
if self.start_time < helpers.cast_to_int(i['added_at'])]
if len(filtered_items) < 10:
done = True
else:
@ -728,7 +728,8 @@ class RecentlyAdded(Newsletter):
if item['section_id'] not in self.config['incl_libraries']:
continue
movie_list.append(item)
if self.start_time < helpers.cast_to_int(item['added_at']) < self.end_time:
movie_list.append(item)
recently_added = movie_list
@ -756,6 +757,9 @@ class RecentlyAdded(Newsletter):
if self.start_time < helpers.cast_to_int(i['added_at']) < self.end_time]
filtered_children.sort(key=lambda x: helpers.cast_to_int(x['parent_media_index']))
if not filtered_children:
continue
seasons = []
for (index, title), children in groupby(filtered_children,
key=lambda x: (x['parent_media_index'], x['parent_title'])):
@ -803,6 +807,9 @@ class RecentlyAdded(Newsletter):
if self.start_time < helpers.cast_to_int(i['added_at']) < self.end_time]
filtered_children.sort(key=lambda x: x['added_at'])
if not filtered_children:
continue
albums = []
for a in filtered_children:
album_metadata = pms_connect.get_metadata_details(a['rating_key'], media_info=False)