Skip to content

[fix] est_released_movies: Fixed crash with movie_year of None#1602

Merged
cvium merged 3 commits intoFlexget:developfrom
jacobmetrick:develop
Jan 10, 2017
Merged

[fix] est_released_movies: Fixed crash with movie_year of None#1602
cvium merged 3 commits intoFlexget:developfrom
jacobmetrick:develop

Conversation

@jacobmetrick
Copy link
Copy Markdown
Contributor

Motivation for changes:

Was seeing a crash when using a list containing a movie with no release date:

Traceback (most recent call last):
  File "/home/jacob/flexget/lib/python3.5/site-packages/flexget/task.py", line 477, in __run_plugin
    return method(*args, **kwargs)
  File "/home/jacob/flexget/lib/python3.5/site-packages/flexget/event.py", line 23, in __call__
    return self.func(*args, **kwargs)
  File "/home/jacob/flexget/lib/python3.5/site-packages/flexget/plugins/input/discover.py", line 289, in on_task_input
    entries = self.estimated(entries, estimation_mode)
  File "/home/jacob/flexget/lib/python3.5/site-packages/flexget/plugins/input/discover.py", line 201, in estimated
    est_date = estimator.estimate(entry)
  File "/home/jacob/flexget/lib/python3.5/site-packages/flexget/plugins/estimators/est_released.py", line 28, in estimate
    estimate = estimator(entry)
  File "/home/jacob/flexget/lib/python3.5/site-packages/flexget/plugins/estimators/est_released_movies.py", line 22, in estimate
    return datetime(year=entry['movie_year'], month=1, day=1)
TypeError: an integer is required (got type NoneType)

It looks like this plugin can't handle a movie_year of none, despite that being a valid value to be passed.

Detailed changes:

  • Simply have it check for none as well as existence of the value in the entry.
  • I also noticed that the trakt_list plugin wasn't correctly generating the title in cases where the year was missing. I used the imdb_list as my guide for removing the (YEAR) at the end of the title if it doesn't exist.
  • I didn't create a new test for this; I could add one but I was worried it would be brittle because things on trakt usually get dates added to them over time, and this would break the test. I ran into this issue personally with this movie

Addressed issues:

  • No issue filed, I just made a PR for it, but I can make one if people want.

Config usage if relevant (new plugin or updated schema):

N/A

Log and/or tests output (preferably both):

============================= test session starts ==============================
platform linux -- Python 3.5.2, pytest-3.0.5, py-1.4.32, pluggy-0.4.0
rootdir: /home/jacob/Development/Flexget, inifile: setup.cfg
plugins: cov-2.2.1, xdist-1.15.0, capturelog-0.7
collected 1096 items

flexget/tests/test_abort.py .
flexget/tests/test_archives.py s...
flexget/tests/test_argparse.py ...
flexget/tests/test_assume_quality.py ....................
flexget/tests/test_backlog.py .
flexget/tests/test_cached_input.py ..
flexget/tests/test_condition.py ......
flexget/tests/test_config.py .
flexget/tests/test_config_schema.py ....................
flexget/tests/test_configure_series_betaseries_list.py ...
flexget/tests/test_content_filter.py ........
flexget/tests/test_content_size.py .......
flexget/tests/test_cookies.py .
flexget/tests/test_couchpotato_list.py ..
flexget/tests/test_crossmatch.py .
flexget/tests/test_decompress.py ss...
flexget/tests/test_delay.py .
flexget/tests/test_digest.py ......
flexget/tests/test_discover.py ......
flexget/tests/test_download.py ...sssss
flexget/tests/test_exec.py ..s
flexget/tests/test_exists_movie.py ..............ssssss
flexget/tests/test_exists_series.py ..................
flexget/tests/test_feed_control.py s..
flexget/tests/test_filesystem.py .............
flexget/tests/test_headers.py .
flexget/tests/test_html5lib.py .
flexget/tests/test_imdb.py ...........
flexget/tests/test_imdb_list_interface.py .
flexget/tests/test_imdb_parser.py ....
flexget/tests/test_input_sites.py ...
flexget/tests/test_inputs.py ..
flexget/tests/test_lazy_fields.py .
flexget/tests/test_limit_new.py .
flexget/tests/test_list_interface.py .............
flexget/tests/test_manipulate.py .....
flexget/tests/test_metainfo.py .........
flexget/tests/test_migrate.py .
flexget/tests/test_misc.py .........s.....
flexget/tests/test_movie_list.py ..............
flexget/tests/test_movieparser.py ..
flexget/tests/test_myepisodes.py s
flexget/tests/test_next_series_episodes.py ........................
flexget/tests/test_nfo_lookup.py .............
flexget/tests/test_npo_watchlist.py ..
flexget/tests/test_only_new.py .
flexget/tests/test_parsingapi.py ...
flexget/tests/test_path_by_space.py ......
flexget/tests/test_pathscrub.py ....
flexget/tests/test_pending_approval.py .
flexget/tests/test_pluginapi.py .....
flexget/tests/test_proper_movies.py ..
flexget/tests/test_qualities.py ........................................................................................................................
flexget/tests/test_regex_extract.py ....
flexget/tests/test_regexp.py .........
flexget/tests/test_regexp_list.py ..
flexget/tests/test_remember_rejected.py .
flexget/tests/test_reorder_quality.py ..
flexget/tests/test_rottentomatoes.py x
flexget/tests/test_rss.py .........
flexget/tests/test_rtorrent.py ...............
flexget/tests/test_secrets.py ..
flexget/tests/test_seen.py .......
flexget/tests/test_series.py ........................................................................................................................................................................
flexget/tests/test_series_premiere.py ................
flexget/tests/test_seriesparser.py .......s...................................................s............................................
flexget/tests/test_simple_persistence.py ..
flexget/tests/test_sort_by.py ....
flexget/tests/test_subtitle_list.py ...ssss.s.....
flexget/tests/test_t411.py ...........
flexget/tests/test_task.py .
flexget/tests/test_template.py ......
flexget/tests/test_thetvdb.py ..............
flexget/tests/test_thetvdb_list.py .
flexget/tests/test_tmdb.py .x
flexget/tests/test_torrent.py ...............
flexget/tests/test_trakt.py ....................x
flexget/tests/test_trakt_list_interface.py .......
flexget/tests/test_tvmaze.py ................X
flexget/tests/test_urlfix.py ..
flexget/tests/test_urlrewriting.py .....
flexget/tests/test_utils.py ...................
flexget/tests/test_validator.py ......
flexget/tests/api_tests/test_api_validator.py .
flexget/tests/api_tests/test_authentication_api.py .
flexget/tests/api_tests/test_cached_api.py .
flexget/tests/api_tests/test_database_api.py .
flexget/tests/api_tests/test_entry_list_api.py ......
flexget/tests/api_tests/test_etag.py .
flexget/tests/api_tests/test_execute_api.py ........
flexget/tests/api_tests/test_failed_api.py ....
flexget/tests/api_tests/test_format_checker_api.py ...........
flexget/tests/api_tests/test_history_api.py ...
flexget/tests/api_tests/test_imdb_lookup_api.py .
flexget/tests/api_tests/test_movie_list_api.py .........
flexget/tests/api_tests/test_pending_api.py ......
flexget/tests/api_tests/test_plugins_api.py .
flexget/tests/api_tests/test_rejected_api.py .......
flexget/tests/api_tests/test_schedule_api.py .................
flexget/tests/api_tests/test_secrets_api.py ..
flexget/tests/api_tests/test_seen_api.py ......
flexget/tests/api_tests/test_series_api.py ........................
flexget/tests/api_tests/test_server_api.py ......
flexget/tests/api_tests/test_status_api.py .......
flexget/tests/api_tests/test_tasks_api.py ........
flexget/tests/api_tests/test_tmdb_lookup.py ....
flexget/tests/api_tests/test_trakt_lookup_api.py .................
flexget/tests/api_tests/test_tvdb_lookup_api.py ...............
flexget/tests/api_tests/test_tvmaze_lookup_api.py .....
flexget/tests/api_tests/test_user_api.py ..
flexget/tests/notifiers/test_notify.py .
flexget/tests/notifiers/test_notify_abort.py ..
flexget/tests/notifiers/test_pushover.py .
flexget/tests/notifiers/test_sns_notifier.py ..

============================ pytest-warning summary ============================
WC1 None [pytest] section in setup.cfg files is deprecated, use [tool:pytest] instead.
WI1 /home/jacob/Development/Flexget/lib/python3.5/site-packages/pytest_capturelog.py:171 'pytest_runtest_makereport' hook uses deprecated __multicall__ argument
WC1 None pytest_funcarg__cov: declaring fixtures using "pytest_funcarg__" prefix is deprecated and scheduled to be removed in pytest 4.0.  Please remove the prefix and use the @pytest.fixture decorator instead.
WC1 None pytest_funcarg__caplog: declaring fixtures using "pytest_funcarg__" prefix is deprecated and scheduled to be removed in pytest 4.0.  Please remove the prefix and use the @pytest.fixture decorator instead.
WC1 None pytest_funcarg__capturelog: declaring fixtures using "pytest_funcarg__" prefix is deprecated and scheduled to be removed in pytest 4.0.  Please remove the prefix and use the @pytest.fixture decorator instead.
 1067 passed, 25 skipped, 3 xfailed, 1 xpassed, 5 pytest-warnings in 245.16 seconds 

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line looks like it's over 120 characters.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I ran flake8 and the file now has no errors.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should let the logger handle string formatting ie. pass it as an argument.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this pep8-compliant? I would've expected it to be indented more.

@cvium
Copy link
Copy Markdown
Contributor

cvium commented Jan 5, 2017

A recent change conflicts with your PR. Please update your PR.

@jacobmetrick
Copy link
Copy Markdown
Contributor Author

rebased

@cvium cvium merged commit 54c5fda into Flexget:develop Jan 10, 2017
liiight pushed a commit that referenced this pull request Jan 20, 2017
* v2.9.0

* Prepare v2.9.1.dev

* Support searching for titles which contain quotes (#1618)

[change] piratebay: replacing single quotes with spaces as their search engine doesn't like them

* [added] subliminal: added support for .rar files

* NPO parameter has changed for only showing full episodes (#1616)

[change] npo_watchlist: updated to only grab broadcasts; previously it also grabbed trailers

* [fix] est_released_movies: Fixed crash with movie_year of None (#1602)

* [added] convert_magnet: new config option to fail entries if conversion fails, closes #1619

* Don't evaluate 'if' statements on un-needed phases for simple accept/reject actions.

* v2.9.1

* Prepare v2.9.2.dev

* relplace Safe by zxcvbn for password strenght testing (#1620)

* [fix] sickbeard: fixed a typo that caused a crash when 'include_data: yes', fixes #1623

* v2.9.2

* Prepare v2.9.3.dev

* Support for 2160p (#1625)

[added] quality: added support for 2160p

* [Fix][UI] improves version checking, fixes #1617

* [Fix][UI] Removing a show when in search mode, keeps the UI in search page #1559

* [Change][UI] Username is autofilled on login page

* Removed incorrect files

* v2.9.3

* Prepare v2.9.4.dev

* [Add][UI] Config section allows editing of variables

* Added warning regarding variables configuration

* v2.9.4

* Prepare v2.9.5.dev

* added support for Exx identifier in series parser (#1622)

[change] series parser: added support for Exx identifier

* [Add] My Anime List input plugin (#1629)

* [Add] My Anime List input plugin

* Review changes

* Python 3 .values =/= list

* Converting config variables to lists

* Correct list conversion

* v2.9.5

* Prepare v2.9.6.dev

* Update app.py

* Added base_url to webserver config

* Made `base_url` setting a little looser so that `/` is not mandatory

* Update url-interceptor.service.js

* Check base_url exists before prepending /

* Make sure base_url doesn't end with /

* fix api in UI

* Fix log page

* Removed leftover prints

* Fix series and movie posters not loading correctly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants