Added back tvrage_name and tvrage_id to mirror show_name and indexer_id so that other apps that need those values have them available.

Cleaned up video html in display shows.
This commit is contained in:
echel0n 2014-07-11 18:38:22 -07:00
parent 13f12b2635
commit 84fe4f0aeb
3 changed files with 72 additions and 63 deletions

View file

@ -323,13 +323,15 @@
#end if #end if
</td> </td>
#if $sickbeard.PLAY_VIDEOS: #if $sickbeard.PLAY_VIDEOS:
<td> <td>
#if $epResult["location"]: #if $epResult["location"]:
#set $video_root = $os.path.dirname($show._location) #set $video_root = $os.path.dirname($show._location)
#set $video_source = $sbRoot + $epResult["location"].replace($video_root, '/videos') #set $video_source = $sbRoot + $epResult["location"].replace($video_root, '/videos')
<div id="$video_source" class="jwvideo">Loading the player...</div> <div id="$video_source" class="jwvideo">Loading the player...</div>
#end if #else:
</td> No Video
#end if
</td>
#end if #end if
<td align="center"><img src="$sbRoot/images/#if $epResult["hasnfo"] == 1 then "nfo.gif\" alt=\"Y" else "nfo-no.gif\" alt=\"N"#" width="23" height="11" /></td> <td align="center"><img src="$sbRoot/images/#if $epResult["hasnfo"] == 1 then "nfo.gif\" alt=\"Y" else "nfo-no.gif\" alt=\"N"#" width="23" height="11" /></td>
<td align="center"><img src="$sbRoot/images/#if $epResult["hastbn"] == 1 then "tbn.gif\" alt=\"Y" else "tbn-no.gif\" alt=\"N"#" width="23" height="11" /></td> <td align="center"><img src="$sbRoot/images/#if $epResult["hastbn"] == 1 then "tbn.gif\" alt=\"Y" else "tbn-no.gif\" alt=\"N"#" width="23" height="11" /></td>

View file

@ -25,7 +25,7 @@ $(document).ready(function () {
}); });
$('#changeStatus').click(function () { $('#changeStatus').click(function () {
var sbRoot = $('#sbRoot').val() var sbRoot = $('#sbRoot').val();
var epArr = new Array() var epArr = new Array()
$('.epCheck').each(function () { $('.epCheck').each(function () {
@ -37,9 +37,9 @@ $(document).ready(function () {
}); });
if (epArr.length == 0) if (epArr.length == 0)
return false return false;
url = sbRoot + '/home/setStatus?show=' + $('#showID').attr('value') + '&eps=' + epArr.join('|') + '&status=' + $('#statusSelect').attr('value') url = sbRoot + '/home/setStatus?show=' + $('#showID').attr('value') + '&eps=' + epArr.join('|') + '&status=' + $('#statusSelect').attr('value');
window.location.href = url window.location.href = url
}); });
@ -49,7 +49,7 @@ $(document).ready(function () {
var seasNo = $(seasCheck).attr('id'); var seasNo = $(seasCheck).attr('id');
$('.epCheck:visible').each(function () { $('.epCheck:visible').each(function () {
var epParts = $(this).attr('id').split('x') var epParts = $(this).attr('id').split('x');
if (epParts[0] == seasNo) { if (epParts[0] == seasNo) {
this.checked = seasCheck.checked this.checked = seasCheck.checked
@ -105,18 +105,18 @@ $(document).ready(function () {
// handle the show selection dropbox // handle the show selection dropbox
$('#pickShow').change(function () { $('#pickShow').change(function () {
var sbRoot = $('#sbRoot').val() var sbRoot = $('#sbRoot').val();
var val = $(this).attr('value') var val = $(this).attr('value');
if (val == 0) if (val == 0)
return return;
url = sbRoot + '/home/displayShow?show=' + val url = sbRoot + '/home/displayShow?show=' + val;
window.location.href = url window.location.href = url
}); });
// show/hide different types of rows when the checkboxes are changed // show/hide different types of rows when the checkboxes are changed
$("#checkboxControls input").change(function (e) { $("#checkboxControls input").change(function (e) {
var whichClass = $(this).attr('id') var whichClass = $(this).attr('id');
$(this).showHideRows(whichClass) $(this).showHideRows(whichClass);
$('tr.' + whichClass).each(function (i) { $('tr.' + whichClass).each(function (i) {
$(this).toggle(); $(this).toggle();
@ -137,7 +137,7 @@ $(document).ready(function () {
$.fn.showHideRows = function (whichClass) { $.fn.showHideRows = function (whichClass) {
var status = $('#checkboxControls > input, #' + whichClass).prop('checked') var status = $('#checkboxControls > input, #' + whichClass).prop('checked');
$("tr." + whichClass).each(function (e) { $("tr." + whichClass).each(function (e) {
if (status) { if (status) {
$(this).show(); $(this).show();
@ -148,21 +148,21 @@ $(document).ready(function () {
// hide season headers with no episodes under them // hide season headers with no episodes under them
$('tr.seasonheader').each(function () { $('tr.seasonheader').each(function () {
var numRows = 0 var numRows = 0;
var seasonNo = $(this).attr('id') var seasonNo = $(this).attr('id');
$('tr.' + seasonNo + ' :visible').each(function () { $('tr.' + seasonNo + ' :visible').each(function () {
numRows++ numRows++
}) });
if (numRows == 0) { if (numRows == 0) {
$(this).hide() $(this).hide();
$('#' + seasonNo + '-cols').hide() $('#' + seasonNo + '-cols').hide()
} else { } else {
$(this).show() $(this).show();
$('#' + seasonNo + '-cols').show() $('#' + seasonNo + '-cols').show()
} }
}); });
} };
function setEpisodeSceneNumbering(forSeason, forEpisode, sceneSeason, sceneEpisode) { function setEpisodeSceneNumbering(forSeason, forEpisode, sceneSeason, sceneEpisode) {
var sbRoot = $('#sbRoot').val(); var sbRoot = $('#sbRoot').val();

View file

@ -98,7 +98,8 @@ class Api(webserve.MainHandler):
# if debug was set call the "_call_dispatcher" # if debug was set call the "_call_dispatcher"
if 'debug' in kwargs: if 'debug' in kwargs:
outDict = _call_dispatcher(self, args, kwargs) # this way we can debug the cherry.py traceback in the browser outDict = _call_dispatcher(self, args,
kwargs) # this way we can debug the cherry.py traceback in the browser
del kwargs["debug"] del kwargs["debug"]
else: # if debug was not set we wrap the "call_dispatcher" in a try block to assure a json output else: # if debug was not set we wrap the "call_dispatcher" in a try block to assure a json output
try: try:
@ -204,7 +205,7 @@ def call_dispatcher(handler, args, kwargs):
""" """
logger.log(u"API :: all args: '" + str(args) + "'", logger.DEBUG) logger.log(u"API :: all args: '" + str(args) + "'", logger.DEBUG)
logger.log(u"API :: all kwargs: '" + str(kwargs) + "'", logger.DEBUG) logger.log(u"API :: all kwargs: '" + str(kwargs) + "'", logger.DEBUG)
#logger.log(u"API :: dateFormat: '" + str(dateFormat) + "'", logger.DEBUG) # logger.log(u"API :: dateFormat: '" + str(dateFormat) + "'", logger.DEBUG)
cmds = None cmds = None
if args: if args:
@ -502,9 +503,9 @@ class TVDBShorthandWrapper(ApiCall):
return CMD_Show(self.handler, args, self.kwargs).run() return CMD_Show(self.handler, args, self.kwargs).run()
################################ # ###############################
# helper functions # # helper functions #
################################ # ###############################
def _sizeof_fmt(num): def _sizeof_fmt(num):
for x in ['bytes', 'KB', 'MB', 'GB', 'TB']: for x in ['bytes', 'KB', 'MB', 'GB', 'TB']:
@ -675,7 +676,7 @@ class IntParseError(Exception):
"A value could not be parsed into a int. But should be parsable to a int " "A value could not be parsed into a int. But should be parsable to a int "
#-------------------------------------------------------------------------------------# # -------------------------------------------------------------------------------------#
class CMD_Help(ApiCall): class CMD_Help(ApiCall):
@ -704,7 +705,7 @@ class CMD_ComingEpisodes(ApiCall):
"optionalParameters": {"sort": {"desc": "change the sort order"}, "optionalParameters": {"sort": {"desc": "change the sort order"},
"type": {"desc": "one or more of allowedValues separated by |"}, "type": {"desc": "one or more of allowedValues separated by |"},
"paused": { "paused": {
"desc": "0 to exclude paused shows, 1 to include them, or omitted to use the SB default"}, "desc": "0 to exclude paused shows, 1 to include them, or omitted to use the SB default"},
} }
} }
@ -816,7 +817,7 @@ class CMD_Episode(ApiCall):
"episode": {"desc": "the episode number"} "episode": {"desc": "the episode number"}
}, },
"optionalParameters": {"full_path": { "optionalParameters": {"full_path": {
"desc": "show the full absolute path (if valid) instead of a relative path for the episode location"} "desc": "show the full absolute path (if valid) instead of a relative path for the episode location"}
} }
} }
@ -1008,7 +1009,6 @@ class CMD_EpisodeSetStatus(ApiCall):
myDB = db.DBConnection() myDB = db.DBConnection()
myDB.mass_action(sql_l) myDB.mass_action(sql_l)
extra_msg = "" extra_msg = ""
if start_backlog: if start_backlog:
cur_backlog_queue_item = search_queue.BacklogQueueItem(showObj, ep_segment) cur_backlog_queue_item = search_queue.BacklogQueueItem(showObj, ep_segment)
@ -1211,14 +1211,13 @@ class CMD_HistoryTrim(ApiCall):
myDB.action("DELETE FROM history WHERE date < " + str( myDB.action("DELETE FROM history WHERE date < " + str(
(datetime.datetime.today() - datetime.timedelta(days=30)).strftime(history.dateFormat))) (datetime.datetime.today() - datetime.timedelta(days=30)).strftime(history.dateFormat)))
return _responds(RESULT_SUCCESS, msg="Removed history entries greater than 30 days old") return _responds(RESULT_SUCCESS, msg="Removed history entries greater than 30 days old")
class CMD_Logs(ApiCall): class CMD_Logs(ApiCall):
_help = {"desc": "view sickbeard's log", _help = {"desc": "view sickbeard's log",
"optionalParameters": {"min_level ": { "optionalParameters": {"min_level ": {
"desc": "the minimum level classification of log entries to show, with each level inherting its above level"}} "desc": "the minimum level classification of log entries to show, with each level inherting its above level"}}
} }
def __init__(self, handler, args, kwargs): def __init__(self, handler, args, kwargs):
@ -1368,7 +1367,6 @@ class CMD_SickBeardCheckScheduler(ApiCall):
backlogRunning = sickbeard.searchQueueScheduler.action.is_backlog_in_progress() #@UndefinedVariable backlogRunning = sickbeard.searchQueueScheduler.action.is_backlog_in_progress() #@UndefinedVariable
nextBacklog = sickbeard.backlogSearchScheduler.nextRun().strftime(dateFormat).decode(sickbeard.SYS_ENCODING) nextBacklog = sickbeard.backlogSearchScheduler.nextRun().strftime(dateFormat).decode(sickbeard.SYS_ENCODING)
data = {"backlog_is_paused": int(backlogPaused), "backlog_is_running": int(backlogRunning), data = {"backlog_is_paused": int(backlogPaused), "backlog_is_running": int(backlogRunning),
"last_backlog": _ordinal_to_dateForm(sqlResults[0]["last_backlog"]), "last_backlog": _ordinal_to_dateForm(sqlResults[0]["last_backlog"]),
"next_backlog": nextBacklog} "next_backlog": nextBacklog}
@ -1576,7 +1574,7 @@ class CMD_SickBeardSearchIndexers(ApiCall):
results = [] results = []
for curSeries in series: for curSeries in series:
results.append({"indexerid": int(curSeries.findtext('seriesid')), results.append({"indexerid": int(curSeries.findtext('seriesid')),
"tvdbid": int(curSeries.findtext('seriesid')), "tvdbid": int(curSeries.findtext('seriesid')),
"name": curSeries.findtext('SeriesName'), "name": curSeries.findtext('SeriesName'),
"first_aired": curSeries.findtext('FirstAired')}) "first_aired": curSeries.findtext('FirstAired')})
@ -1607,7 +1605,7 @@ class CMD_SickBeardSearchIndexers(ApiCall):
return _responds(RESULT_FAILURE, msg="Show contains no name, invalid result") return _responds(RESULT_FAILURE, msg="Show contains no name, invalid result")
showOut = [{"indexerid": self.indexerid, showOut = [{"indexerid": self.indexerid,
"tvdbid": self.indexerid, "tvdbid": self.indexerid,
"name": unicode(myShow.data['seriesname']), "name": unicode(myShow.data['seriesname']),
"first_aired": myShow.data['firstaired']}] "first_aired": myShow.data['firstaired']}]
@ -1750,10 +1748,13 @@ class CMD_Show(ApiCall):
showDict["show_name"] = showObj.name showDict["show_name"] = showObj.name
showDict["paused"] = showObj.paused showDict["paused"] = showObj.paused
showDict["air_by_date"] = showObj.air_by_date showDict["air_by_date"] = showObj.air_by_date
showDict["sports"] = showObj.sports
showDict["flatten_folders"] = showObj.flatten_folders showDict["flatten_folders"] = showObj.flatten_folders
showDict["sports"] = showObj.sports
showDict["anime"] = showObj.anime
#clean up tvdb horrible airs field #clean up tvdb horrible airs field
showDict["airs"] = str(showObj.airs).replace('am', ' AM').replace('pm', ' PM').replace(' ', ' ') showDict["airs"] = str(showObj.airs).replace('am', ' AM').replace('pm', ' PM').replace(' ', ' ')
showDict["tvrage_id"] = showObj.indexerid
showDict["tvrage_name"] = showObj.name
showDict["network"] = showObj.network showDict["network"] = showObj.network
if not showDict["network"]: if not showDict["network"]:
showDict["network"] = "" showDict["network"] = ""
@ -1820,7 +1821,8 @@ class CMD_ShowAddExisting(ApiCall):
return _responds(RESULT_FAILURE, msg='Not a valid location') return _responds(RESULT_FAILURE, msg='Not a valid location')
indexerName = None indexerName = None
indexerResult = CMD_SickBeardSearchIndexers(self.handler, [], {"indexerid": self.indexerid, "indexer": self.indexer}).run() indexerResult = CMD_SickBeardSearchIndexers(self.handler, [],
{"indexerid": self.indexerid, "indexer": self.indexer}).run()
if indexerResult['result'] == result_type_map[RESULT_SUCCESS]: if indexerResult['result'] == result_type_map[RESULT_SUCCESS]:
if not indexerResult['data']['results']: if not indexerResult['data']['results']:
@ -1982,7 +1984,8 @@ class CMD_ShowAddNew(ApiCall):
newStatus = self.status newStatus = self.status
indexerName = None indexerName = None
indexerResult = CMD_SickBeardSearchIndexers(self.handler, [], {"indexerid": self.indexerid, "indexer": self.indexer}).run() indexerResult = CMD_SickBeardSearchIndexers(self.handler, [],
{"indexerid": self.indexerid, "indexer": self.indexer}).run()
if indexerResult['result'] == result_type_map[RESULT_SUCCESS]: if indexerResult['result'] == result_type_map[RESULT_SUCCESS]:
if not indexerResult['data']['results']: if not indexerResult['data']['results']:
@ -2008,7 +2011,8 @@ class CMD_ShowAddNew(ApiCall):
else: else:
helpers.chmodAsParent(showPath) helpers.chmodAsParent(showPath)
sickbeard.showQueueScheduler.action.addShow(int(self.indexer), int(self.indexerid), showPath, newStatus, newQuality, sickbeard.showQueueScheduler.action.addShow(int(self.indexer), int(self.indexerid), showPath, newStatus,
newQuality,
int(self.flatten_folders), self.lang, self.subtitles, self.anime, int(self.flatten_folders), self.lang, self.subtitles, self.anime,
self.scene) # @UndefinedVariable self.scene) # @UndefinedVariable
@ -2230,7 +2234,6 @@ class CMD_ShowSeasonList(ApiCall):
for row in sqlResults: for row in sqlResults:
seasonList.append(int(row["season"])) seasonList.append(int(row["season"]))
return _responds(RESULT_SUCCESS, seasonList) return _responds(RESULT_SUCCESS, seasonList)
@ -2293,18 +2296,17 @@ class CMD_ShowSeasons(ApiCall):
seasons[curEpisode] = {} seasons[curEpisode] = {}
seasons[curEpisode] = row seasons[curEpisode] = row
return _responds(RESULT_SUCCESS, seasons) return _responds(RESULT_SUCCESS, seasons)
class CMD_ShowSetQuality(ApiCall): class CMD_ShowSetQuality(ApiCall):
_help = { _help = {
"desc": "set desired quality of a show in sickbeard. if neither initial or archive are provided then the config default quality will be used", "desc": "set desired quality of a show in sickbeard. if neither initial or archive are provided then the config default quality will be used",
"requiredParameters": {"indexerid": {"desc": "thetvdb.com unique id of a show"} "requiredParameters": {"indexerid": {"desc": "thetvdb.com unique id of a show"}
}, },
"optionalParameters": {"initial": {"desc": "initial quality for the show"}, "optionalParameters": {"initial": {"desc": "initial quality for the show"},
"archive": {"desc": "archive quality for the show"} "archive": {"desc": "archive quality for the show"}
} }
} }
def __init__(self, handler, args, kwargs): def __init__(self, handler, args, kwargs):
@ -2462,7 +2464,6 @@ class CMD_ShowStats(ApiCall):
")", "") ")", "")
episodes_stats[statusString] = episode_status_counts_total[statusCode] episodes_stats[statusString] = episode_status_counts_total[statusCode]
return _responds(RESULT_SUCCESS, episodes_stats) return _responds(RESULT_SUCCESS, episodes_stats)
@ -2521,17 +2522,23 @@ class CMD_Shows(ApiCall):
if self.paused != None and bool(self.paused) != bool(curShow.paused): if self.paused != None and bool(self.paused) != bool(curShow.paused):
continue continue
showDict = {"paused": curShow.paused, showDict = {
"quality": _get_quality_string(curShow.quality), "paused": curShow.paused,
"language": curShow.lang, "quality": _get_quality_string(curShow.quality),
"air_by_date": curShow.air_by_date, "language": curShow.lang,
"sports": curShow.sports, "air_by_date": curShow.air_by_date,
"indexerid": curShow.indexerid, "sports": curShow.sports,
"tvdbid": curShow.indexerid, "anime": curShow.anime,
"network": curShow.network, "indexerid": curShow.indexerid,
"show_name": curShow.name, "tvdbid": curShow.indexerid,
"status": curShow.status, "tvrage_id": curShow.indexerid,
"next_ep_airdate": nextAirdate} "tvrage_name": curShow.name,
"network": curShow.network,
"show_name": curShow.name,
"status": curShow.status,
"next_ep_airdate": nextAirdate
}
showDict["cache"] = CMD_ShowCache(self.handler, (), {"indexerid": curShow.indexerid}).run()["data"] showDict["cache"] = CMD_ShowCache(self.handler, (), {"indexerid": curShow.indexerid}).run()["data"]
if not showDict["network"]: if not showDict["network"]:
showDict["network"] = "" showDict["network"] = ""