Skip to content

Instantly share code, notes, and snippets.

@henryjfry
Created May 26, 2019 17:39
Show Gist options
  • Save henryjfry/b50716cbfe40a14bb45b8496452a330c to your computer and use it in GitHub Desktop.
Save henryjfry/b50716cbfe40a14bb45b8496452a330c to your computer and use it in GitHub Desktop.
script.skin.helper.widgets - FIX next up episodes and hide episodes which air today.
#~/.kodi/addons/script.skin.helper.widgets/resources/lib/episodes.py
##
#below "import xbmc" add the following:
from resources.lib.utils import log_msg, ADDON_ID
import time, datetime
from datetime import date
from datetime import datetime
######
######
######
######
######In the following section "def get_next_episode_for_show(self, show_id):" CHANGE:
#fields = ["playcount", "season"]
#TO:
fields = ["playcount", "season", "firstaired"]
#####
#####
#####Then if you change below the following:
# return full details for our episode
#return self.metadatautils.kodidb.episode(next_episode["episodeid"]) if next_episode else None
#
#To (spacing is important here as you are adding an IF statement)
#
####
# return full details for our episode
if date(*map(int, str(next_episode["firstaired"]).split('-')))<date.today():
return self.metadatautils.kodidb.episode(next_episode["episodeid"]) if next_episode else None
@henryjfry
Copy link
Author

LOGGING:

log_msg(date.today(), xbmc.LOGNOTICE)
log_msg(date(*map(int, str(next_episode["firstaired"]).split('-')))<date.today(), xbmc.LOGNOTICE)
log_msg(next_episode, xbmc.LOGNOTICE)
log_msg(next_episode["episodeid"], xbmc.LOGNOTICE)
log_msg(next_episode["firstaired"], xbmc.LOGNOTICE)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment