jakewaldron / PlexEmail

This script aggregates all new TV, movie and music releases for the past configured time then optionally writes to your web directory and sends out an email.
206 stars 32 forks source link

running the script gives the following error #34

Open harroguk opened 8 years ago

harroguk commented 8 years ago

Not sure what has changed but trying to run the script gives the following error.

Last email was successfully sent on 25 Apr 2015 (Emails are normally sent weekly on Mondays).

26th April was a Plex Update, I can see no updates to PlexEmail since 4th March 2016

C:\InstalledPrograms\PlexEmail\scripts>python plexEmail.py Traceback (most recent call last): File "plexEmail.py", line 1175, in <module> tvEpisodes = OrderedDict(sorted(tvEpisodes.iteritems(), key=lambda t: t[1][config['episode_sort_2']], reverse=config['episode_sort_2_reverse'])) File "plexEmail.py", line 1175, in <lambda> tvEpisodes = OrderedDict(sorted(tvEpisodes.iteritems(), key=lambda t: t[1][config['episode_sort_2']], reverse=config['episode_sort_2_reverse'])) KeyError: 'season_index'

Line 1175 seems to refer to "episode_sort_2" in the config.conf so here are the relevant lines refering to it in my config.conf

# Possible values = id, title, title_sort, original_title, rating, tagline,
#                   summary, content_rating, duration, tags_genre, tags_director, tags_star, year,
#                   hash, index, studio, season_index, show_title, show_title_sort, show_original_title
episode_sort_1 = 'show_title_sort'
episode_sort_1_reverse = False
episode_sort_2 = 'season_index'
episode_sort_2_reverse = False
episode_sort_3 = 'index'
episode_sort_3_reverse = False
harroguk commented 8 years ago

More details...

Running on Windows Server 2008 R2

PS C:\Windows\System32\WindowsPowerShell\v1.0> python --version Python 2.7.10 requests-2.7.0 sqlite3.dll - 3.8.8.3

jakewaldron commented 8 years ago

I'm not sure what could be causing this. My next major release will include logging throughout the script to hopefully help troubleshoot issues like this.

harroguk commented 8 years ago

I managed to get it running again by removing 'season_index' and 'index' as sorts so I figure it is bailing out because Plex hasn't populated those fields correctly?

I would be tempted to say you should just sort on show_title in the base script and let people add in their own options for further sorting if they require it just so that you can increase the chances that the script will run out of the box.

As far as I am concerned now, there is no urgent need to fix this, put it to the back of the queue and anyone who searches can see how I fixed it.

My config.conf now reads...

# Possible values = id, title, title_sort, original_title, rating, tagline,
#                   summary, content_rating, duration, tags_genre, tags_director, tags_star, year,
#                   hash, index, studio, season_index, show_title, show_title_sort, show_original_title
episode_sort_1 = 'rating'
episode_sort_1_reverse = False
episode_sort_2 = 'title_sort'
episode_sort_2_reverse = False
episode_sort_3 = 'title_sort'
episode_sort_3_reverse = False