Added input option to last episode selection

In the --last-episode/-le function to manually set the last scheduled episode in the database for any show or playlist, the ability to use the unique plex id (ratingKey in the API, or the unique digits near the end (before the Plex Token) of the URL when going from File Info -> View XML Data on an episode page within Plex) instead of season and episode numbers. This better allows support for this function with Playlists, which may have multiple files with the same season and episode numbers.
This commit is contained in:
Moe Fwacky
2022-01-09 02:41:18 -08:00
committed by GitHub
parent df16598d2a
commit 7c75677427

View File

@@ -1608,16 +1608,23 @@ class PseudoChannel():
showData = self.db.get_shows(showName)
#print("SHOW SELECTED: "+showData[3])
if(showData is not None):
print("Enter the season and episode numbers for the 'last episode' (episode previous to the episode you wish to be scheduled on next -g run")
sNo = input("Season Number: ")
eNo = input("Episode Number: ")
episodeData = self.db.get_episode_from_season_episode(showName,sNo,eNo)
if(episodeData is not None):
print("Setting "+episodeData[7]+" - "+episodeData[3]+" S"+str(episodeData[6])+"E"+str(episodeData[5])+" as the Last Episode in the Shows Database")
print("Enter the 'ratingKey' value (also integer following '/library/metadata/' in the URL) of the 'last episode' from the API, or leave blank to select by season and episode number (does not work for Playlists).")
plexID = input('/library/metadata/')
episodeData = self.db.get_episode_from_plexMediaID('/library/metadata/'+plexID)
if episodeData != None:
print("Setting "+episodeData[7]+" - "+episodeData[3]+" S"+str(episodeData[6])+"E"+str(episodeData[5])+" as the Last Episode in the Shows Database for "+showName)
self.db.update_shows_table_with_last_episode(episodeData[7], episodeData[8])
else:
print("ERROR: EPISODE NOT FOUND IN PSEUDO CHANNEL DATABASE")
sys.exit(1)
print("Enter the season and episode numbers for the 'last episode' (episode previous to the episode you wish to be scheduled on next -g run")
sNo = input("Season Number: ")
eNo = input("Episode Number: ")
episodeData = self.db.get_episode_from_season_episode(showName,sNo,eNo)
if(episodeData is not None):
print("Setting "+episodeData[7]+" - "+episodeData[3]+" S"+str(episodeData[6])+"E"+str(episodeData[5])+" as the Last Episode in the Shows Database for "+showName)
self.db.update_shows_table_with_last_episode(episodeData[7], episodeData[8])
else:
print("ERROR: EPISODE NOT FOUND IN PSEUDO CHANNEL DATABASE")
sys.exit(1)
else:
print("ERROR: SHOW NOT FOUND IN PSEUDO CHANNEL DATABASE")
sys.exit(1)