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

Old TV Episodes: Attempt less frequently #313

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/nefarious/parsers/movie.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ class MovieParser(ParserBase):
regex.compile(r"^(?<title>(?![(\[]).+?)((\W|_))(?:(?<!(19|20)\d{2}.)(German|French|TrueFrench))(.+?)(?=((19|20)\d{2}|$))(?<year>(19|20)\d{2}(?!p|i|\d+|\]|\W\d+))?(\W+|_|$)(?!\\)", regex.I),
),
(
'Special, Despecialized, etc. Edition Movies, e.g: Mission.Impossible.3.Special.Edition.2011',
'Special, Despecialized, etc. Edition Movies, e.g.: Mission.Impossible.3.Special.Edition.2011',
regex.compile(r"^(?<title>(?![(\[]).+?)?(?:(?:[-_\W](?<![)\[!]))*\(?(?<edition>(((Extended.|Ultimate.)?(Director.?s|Collector.?s|Theatrical|Ultimate|Final(?=(.(Cut|Edition|Version)))|Extended|Rogue|Special|Despecialized|\d{2,3}(th)?.Anniversary)(.(Cut|Edition|Version))?(.(Extended|Uncensored|Remastered|Unrated|Uncut|IMAX|Fan.?Edit))?|((Uncensored|Remastered|Unrated|Uncut|IMAX|Fan.?Edit|Edition|Restored|((2|3|4)in1))))))\)?.{1,3}(?<year>(19|20)\d{2}(?!p|i|\d+|\]|\W\d+)))+(\W+|_|$)(?!\\)", regex.I),
),
(
'Normal movie format, e.g: Mission.Impossible.3.2011',
'Normal movie format, e.g.: Mission.Impossible.3.2011',
regex.compile(r"^(?<title>(?![(\[]).+?)?(?:(?:[-_\W](?<![)\[!]))*(?<year>(19|20)\d{2}(?!p|i|(19|20)\d{2}|\]|\W(19|20)\d{2})))+(\W+|_|$)(?!\\)", regex.I),
),
(
Expand Down
13 changes: 12 additions & 1 deletion src/nefarious/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,18 @@ def wanted_media_task():

for media_type, data in wanted_media_data.items():
for media in data['query']:
# media has been released (or it's missing it's release date so try anyway) so create a task to try and fetch it
# skip episodes attempts if last attempt was within x days, and we're past release date by x days
if media_type == 'episode':
days_since_last_attempt = (today - media.last_attempt_date).days if media.last_attempt_date else None
days_since_release = abs(today - media.release_date).days if media.release_date else None
is_too_recent_to_check_for_old_episodes = all([
days_since_last_attempt is not None and days_since_last_attempt <= 7,
days_since_release is not None and days_since_release >= 7,
])
if is_too_recent_to_check_for_old_episodes:
logger_background.info(f=f"skipping wanted media {media} since it's been released for a while and attempted recently")
continue
# media has been released (or it's missing its release date so try anyway) so create a task to try and fetch it
if not media.release_date or media.release_date <= today:
logger_background.info('Wanted {type}: {media}'.format(type=media_type, media=media))
# queue task for wanted media
Expand Down
Loading