mirror of
https://github.com/moparisthebest/SickRage
synced 2024-12-12 11:02:21 -05:00
fixes to make trakt watch list work
This commit is contained in:
parent
5a5b2af676
commit
557a286231
@ -132,9 +132,9 @@ class ShowQueue(generic_queue.GenericQueue):
|
|||||||
return queueItemObj
|
return queueItemObj
|
||||||
|
|
||||||
def addShow(self, indexer, indexer_id, showDir, default_status=None, quality=None, flatten_folders=None,
|
def addShow(self, indexer, indexer_id, showDir, default_status=None, quality=None, flatten_folders=None,
|
||||||
lang="en", subtitles=None, anime=None, scene=None):
|
lang="en", subtitles=None, anime=None, scene=None, paused=None):
|
||||||
queueItemObj = QueueItemAdd(indexer, indexer_id, showDir, default_status, quality, flatten_folders, lang,
|
queueItemObj = QueueItemAdd(indexer, indexer_id, showDir, default_status, quality, flatten_folders, lang,
|
||||||
subtitles, anime, scene)
|
subtitles, anime, scene, paused)
|
||||||
|
|
||||||
self.add_item(queueItemObj)
|
self.add_item(queueItemObj)
|
||||||
|
|
||||||
@ -191,7 +191,7 @@ class ShowQueueItem(generic_queue.QueueItem):
|
|||||||
|
|
||||||
class QueueItemAdd(ShowQueueItem):
|
class QueueItemAdd(ShowQueueItem):
|
||||||
def __init__(self, indexer, indexer_id, showDir, default_status, quality, flatten_folders, lang, subtitles, anime,
|
def __init__(self, indexer, indexer_id, showDir, default_status, quality, flatten_folders, lang, subtitles, anime,
|
||||||
scene):
|
scene, paused):
|
||||||
|
|
||||||
self.indexer = indexer
|
self.indexer = indexer
|
||||||
self.indexer_id = indexer_id
|
self.indexer_id = indexer_id
|
||||||
@ -203,6 +203,7 @@ class QueueItemAdd(ShowQueueItem):
|
|||||||
self.subtitles = subtitles
|
self.subtitles = subtitles
|
||||||
self.anime = anime
|
self.anime = anime
|
||||||
self.scene = scene
|
self.scene = scene
|
||||||
|
self.paused = paused
|
||||||
|
|
||||||
self.show = None
|
self.show = None
|
||||||
|
|
||||||
@ -290,7 +291,7 @@ class QueueItemAdd(ShowQueueItem):
|
|||||||
self.show.flatten_folders = self.flatten_folders if self.flatten_folders != None else sickbeard.FLATTEN_FOLDERS_DEFAULT
|
self.show.flatten_folders = self.flatten_folders if self.flatten_folders != None else sickbeard.FLATTEN_FOLDERS_DEFAULT
|
||||||
self.show.anime = self.anime if self.anime != None else sickbeard.ANIME_DEFAULT
|
self.show.anime = self.anime if self.anime != None else sickbeard.ANIME_DEFAULT
|
||||||
self.show.scene = self.scene if self.scene != None else sickbeard.SCENE_DEFAULT
|
self.show.scene = self.scene if self.scene != None else sickbeard.SCENE_DEFAULT
|
||||||
self.show.paused = False
|
self.show.paused = self.paused if self.paused != None else False
|
||||||
|
|
||||||
# be smartish about this
|
# be smartish about this
|
||||||
if self.show.genre and "talk show" in self.show.genre.lower():
|
if self.show.genre and "talk show" in self.show.genre.lower():
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import traceback
|
import traceback
|
||||||
|
import datetime
|
||||||
|
|
||||||
import sickbeard
|
import sickbeard
|
||||||
from sickbeard import encodingKludge as ek
|
from sickbeard import encodingKludge as ek
|
||||||
@ -129,10 +130,8 @@ class TraktChecker():
|
|||||||
newShow = helpers.findCertainShow(sickbeard.showList, indexer_id)
|
newShow = helpers.findCertainShow(sickbeard.showList, indexer_id)
|
||||||
if newShow is not None:
|
if newShow is not None:
|
||||||
self.setEpisodeToWanted(newShow, 1, 1)
|
self.setEpisodeToWanted(newShow, 1, 1)
|
||||||
self.startBacklog(newShow)
|
|
||||||
else:
|
else:
|
||||||
self.todoWanted.append((indexer_id, 1, 1))
|
self.todoWanted.append((indexer_id, 1, 1))
|
||||||
self.todoWanted.append((indexer_id, -1, -1)) # used to pause new shows if the settings say to
|
|
||||||
|
|
||||||
def updateEpisodes(self):
|
def updateEpisodes(self):
|
||||||
"""
|
"""
|
||||||
@ -160,13 +159,12 @@ class TraktChecker():
|
|||||||
newShow = helpers.findCertainShow(sickbeard.showList, indexer_id)
|
newShow = helpers.findCertainShow(sickbeard.showList, indexer_id)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if newShow and int(newShow['indexer']) == indexer:
|
if newShow and newShow.indexer == indexer:
|
||||||
for episode in show["episodes"]:
|
for episode in show["episodes"]:
|
||||||
if newShow is not None:
|
if newShow is not None:
|
||||||
self.setEpisodeToWanted(newShow, episode["season"], episode["number"])
|
self.setEpisodeToWanted(newShow, episode["season"], episode["number"])
|
||||||
else:
|
else:
|
||||||
self.todoWanted.append((indexer_id, episode["season"], episode["number"]))
|
self.todoWanted.append((indexer_id, episode["season"], episode["number"]))
|
||||||
self.startBacklog(newShow)
|
|
||||||
except TypeError:
|
except TypeError:
|
||||||
logger.log(u"Could not parse the output from trakt for " + show["title"], logger.DEBUG)
|
logger.log(u"Could not parse the output from trakt for " + show["title"], logger.DEBUG)
|
||||||
|
|
||||||
@ -194,7 +192,8 @@ class TraktChecker():
|
|||||||
|
|
||||||
sickbeard.showQueueScheduler.action.addShow(int(indexer), int(indexer_id), showPath, status,
|
sickbeard.showQueueScheduler.action.addShow(int(indexer), int(indexer_id), showPath, status,
|
||||||
int(sickbeard.QUALITY_DEFAULT),
|
int(sickbeard.QUALITY_DEFAULT),
|
||||||
int(sickbeard.FLATTEN_FOLDERS_DEFAULT))
|
int(sickbeard.FLATTEN_FOLDERS_DEFAULT),
|
||||||
|
paused=sickbeard.TRAKT_START_PAUSED)
|
||||||
else:
|
else:
|
||||||
logger.log(u"There was an error creating the show, no root directory setting found", logger.ERROR)
|
logger.log(u"There was an error creating the show, no root directory setting found", logger.ERROR)
|
||||||
return
|
return
|
||||||
@ -206,37 +205,25 @@ class TraktChecker():
|
|||||||
epObj = show.getEpisode(int(s), int(e))
|
epObj = show.getEpisode(int(s), int(e))
|
||||||
if epObj:
|
if epObj:
|
||||||
|
|
||||||
segments = {}
|
|
||||||
|
|
||||||
with epObj.lock:
|
with epObj.lock:
|
||||||
if epObj.status != SKIPPED:
|
if epObj.status != SKIPPED or epObj.airdate == datetime.date.fromordinal(1):
|
||||||
return
|
return
|
||||||
|
|
||||||
logger.log(u"Setting episode s" + str(s) + "e" + str(e) + " of show " + show.name + " to wanted")
|
logger.log(u"Setting episode s" + str(s) + "e" + str(e) + " of show " + show.name + " to wanted")
|
||||||
# figure out what segment the episode is in and remember it so we can backlog it
|
# figure out what segment the episode is in and remember it so we can backlog it
|
||||||
|
|
||||||
if epObj.season in ep_segment:
|
|
||||||
segments[epObj.season].append(epObj)
|
|
||||||
else:
|
|
||||||
segments[epObj.season] = [epObj]
|
|
||||||
|
|
||||||
epObj.status = WANTED
|
epObj.status = WANTED
|
||||||
epObj.saveToDB()
|
epObj.saveToDB()
|
||||||
|
|
||||||
for season, segment in segments.items():
|
cur_backlog_queue_item = search_queue.BacklogQueueItem(show, [epObj])
|
||||||
cur_backlog_queue_item = search_queue.BacklogQueueItem(show, segment[1])
|
sickbeard.searchQueueScheduler.action.add_item(cur_backlog_queue_item)
|
||||||
sickbeard.searchQueueScheduler.action.add_item(cur_backlog_queue_item)
|
|
||||||
|
|
||||||
logger.log(u"Starting backlog for " + show.name + " season " + str(
|
logger.log(u"Starting backlog for " + show.name + " season " + str(
|
||||||
season) + " because some eps were set to wanted")
|
s) + " episode " + str(e) + " because some eps were set to wanted")
|
||||||
|
|
||||||
def manageNewShow(self, show):
|
def manageNewShow(self, show):
|
||||||
|
logger.log(u"Checking if trakt watch list wants to search for episodes from new show " + show.name, logger.DEBUG)
|
||||||
episodes = [i for i in self.todoWanted if i[0] == show.indexerid]
|
episodes = [i for i in self.todoWanted if i[0] == show.indexerid]
|
||||||
for episode in episodes:
|
for episode in episodes:
|
||||||
self.todoWanted.remove(episode)
|
self.todoWanted.remove(episode)
|
||||||
|
self.setEpisodeToWanted(show, episode[1], episode[2])
|
||||||
if episode[1] == -1 and sickbeard.TRAKT_START_PAUSED:
|
|
||||||
show.paused = 1
|
|
||||||
continue
|
|
||||||
|
|
||||||
self.setEpisodeToWanted(show, episode[1], episode[2])
|
|
||||||
|
Loading…
Reference in New Issue
Block a user