Skip to content

Commit

Permalink
Added Season scene exception indicators to displayShow, using the sce…
Browse files Browse the repository at this point in the history
…ne_exceptions saved in the cache scene_exceptions table.

Xem season scene mappings are shown through the xem icon, through the img elements title attribute. Sickrage's scene name exceptions are indicated through the sickrage ico file.

We do need to change the sickrage logo to the Medusa logo.
  • Loading branch information
p0psicles committed Mar 7, 2016
1 parent 5555719 commit 45a8b10
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 28 deletions.
4 changes: 4 additions & 0 deletions gui/slick/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -1248,6 +1248,10 @@ td.col-search {
margin-left: auto;
}

div.season-scene-exception {
display: inline;
}

/* =======================================================================
schedule.mako
========================================================================== */
Expand Down
50 changes: 50 additions & 0 deletions gui/slick/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -2437,7 +2437,57 @@ var SICKRAGE = {
$('#showseason-' + result[1]).text('Hide Episodes');
});
});

// Set the season exception based on using the get_xem_numbering_for_show() for animes if available in data.xemNumbering,
// or else try to map using just the data.season_exceptions.
// TODO: OMG: make sure these are ported to angular
function setSeasonSceneException(data) {
var xemImg;

for (var season in data.seasonExceptions) {
if (data.seasonExceptions.hasOwnProperty(season)) {
// Check if it is a season name exception, we don't handle the show name exceptions here
if (season >= 1 && Object.keys(data.xemNumbering).length > 0) {
// Let's handle this as a xem season numbered exception
for (var indexerSeason in data.xemNumbering) {
if (data.xemNumbering.hasOwnProperty(indexerSeason) &&
data.seasonExceptions[data.xemNumbering[indexerSeason]]) {
xemImg = $('<img>', {
'id': 'xem-exception-season-' + indexerSeason,
'alt': '[xem]',
'height': '16',
'width': '16',
'src': srRoot + '/images/xem.png',
'title': data.seasonExceptions[data.xemNumbering[indexerSeason]].join(', '),
}).appendTo('[data-season=' + indexerSeason + ']');
}
}

console.log("Exception: " + data.seasonExceptions[season] + " for season: "+ season);
} else {
// This is not a xem season exception, let's set the exceptions as a medusa exception
xemImg = $('<img>', {
'id': 'xem-exception-season-' + season,
'alt': '[medusa]',
'height': '16',
'width': '16',
'src': srRoot + '/images/ico/favicon-16.png',
'title': data.seasonExceptions[season].join(', '),
}).appendTo('[data-season=' + season + ']');
}
}
}
}

// TODO: OMG: This is just a basic json, in future it should be based on the CRUD route.
// Get the season exceptions and the xem season mappings.
$.getJSON(srRoot + '/home/getSeasonSceneExceptions', {
'indexer': $('input#indexer').val(),
'indexer_id': $('input#showID').val()
}, function(data) {
setSeasonSceneException(data);
});

},
postProcess: function() {
$('#episodeDir').fileBrowser({ title: 'Select Unprocessed Episode Folder', key: 'postprocessPath' });
Expand Down
4 changes: 2 additions & 2 deletions gui/slick/js/core.min.js

Large diffs are not rendered by default.

52 changes: 26 additions & 26 deletions gui/slick/js/vender.min.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions gui/slick/views/displayShow.mako
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,8 @@
<tr style="height: 60px;">
<th class="row-seasonheader displayShowTable" colspan="13" style="vertical-align: bottom; width: auto;">
<h3 style="display: inline;"><a name="season-${epResult["season"]}"></a>${("Specials", "Season " + str(epResult["season"]))[int(epResult["season"]) > 0]}</h3>
<!-- @TODO: port the season scene exceptions to angular -->
<div class="season-scene-exception" data-season=${("Specials", str(epResult["season"]))[int(epResult["season"]) > 0]}></div>
% if sickbeard.DISPLAY_ALL_SEASONS is False:
<button id="showseason-${epResult['season']}" type="button" class="btn btn-xs pull-right" data-toggle="collapse" data-target="#collapseSeason-${epResult['season']}">Show Episodes</button>
% endif
Expand Down Expand Up @@ -367,6 +369,8 @@
<tr style="height: 60px;">
<th class="row-seasonheader displayShowTable" colspan="13" style="vertical-align: bottom; width: auto;">
<h3 style="display: inline;"><a name="season-${epResult["season"]}"></a>${("Specials", "Season " + str(epResult["season"]))[bool(int(epResult["season"]))]}</h3>
<!-- @TODO: port the season scene exceptions to angular -->
<div class="season-scene-exception" data-season=${("Specials", str(epResult["season"]))[int(epResult["season"]) > 0]}></div>
% if sickbeard.DISPLAY_ALL_SEASONS is False:
<button id="showseason-${epResult['season']}" type="button" class="btn btn-xs pull-right" data-toggle="collapse" data-target="#collapseSeason-${epResult['season']}">Show Episodes</button>
% endif
Expand Down
20 changes: 20 additions & 0 deletions sickbeard/webserve.py
Original file line number Diff line number Diff line change
Expand Up @@ -1224,6 +1224,26 @@ def getDBcompare():
logger.log(u"Checkout branch couldn't compare DB version.", logger.ERROR)
return json.dumps({"status": "error", 'message': 'General exception'})

def getSeasonSceneExceptions(self, indexer, indexer_id): # @TODO: OMG, You can use this as an example to create the Api for the season exception indicators
"""Get show name scene exceptions per season
:param indexer: The shows indexer
:param indexer_id: The shows indexer_id
:return: A json with the scene exceptions per season.
"""

exceptions_list = {}
xem_numbering_season = {}

exceptions_list['seasonExceptions'] = sickbeard.scene_exceptions.get_all_scene_exceptions(indexer_id)

xem_numbering_season = {tvdb_season_ep[0]: anidb_season_ep[0]
for (tvdb_season_ep, anidb_season_ep)
in get_xem_numbering_for_show(indexer_id, indexer).iteritems()}

exceptions_list['xemNumbering'] = xem_numbering_season
return json.dumps(exceptions_list)

def displayShow(self, show=None):
# todo: add more comprehensive show validation
try:
Expand Down

0 comments on commit 45a8b10

Please sign in to comment.