Merge pull request #119 from JackDandy/feature/ImproveAddTrendingPage

Change improve Add Show/Add Trending Show page.
This commit is contained in:
JackDandy 2014-11-07 23:00:29 +00:00
commit a3a38f76e7
5 changed files with 582 additions and 495 deletions

View file

@ -1,4 +1,4 @@
### 0.x.x (2014-11-05 xx:xx:xx UTC)
### 0.x.x (2014-11-07 xx:xx:xx UTC)
* Add Bootstrap for UI features
* Change UI to resize fluidly on different display sizes, fixes the issue where top menu items would disappear on smaller screens
@ -42,6 +42,11 @@
* Made all init scripts executable
* Fix invalid responses when using sickbeard.searchtvdb api command
* Fixes unicode issues during searches on newznab providers when rid mapping occur
* Fix white screen of death when trying to add a show that is already in library on Add Show/Add Trending Show page
* Add show sorting options to Add Show/Add Trending Show page
* Add handler for when Trakt returns no results for Add Show/Add Trending Show page
* Fix image links when anchor child images are not found at Trakt on Add Show/Add Trending Show page
* Add image to be used when Trakt posters are void on Add Show/Add Trending Show page
[develop changelog]
* Change improve display of progress bars in the Downloads columns of the show list page

View file

@ -6,8 +6,8 @@ fonts
@font-face {
font-family: 'Open Sans';
src: url('fonts/OpenSans-Regular-webfont.eot');
src: url('fonts/OpenSans-Regular-webfont.eot?#iefix') format('embedded-opentype'),
src:url('fonts/OpenSans-Regular-webfont.eot');
src:url('fonts/OpenSans-Regular-webfont.eot?#iefix') format('embedded-opentype'),
url('fonts/OpenSans-Regular-webfont.woff') format('woff'),
url('fonts/OpenSans-Regular-webfont.ttf') format('truetype'),
url('fonts/OpenSans-Regular-webfont.svg#OpenSansRegular') format('svg');
@ -19,8 +19,8 @@ fonts
/* Italic */
@font-face {
font-family: 'Open Sans';
src: url('fonts/OpenSans-Italic-webfont.eot');
src: url('fonts/OpenSans-Italic-webfont.eot?#iefix') format('embedded-opentype'),
src:url('fonts/OpenSans-Italic-webfont.eot');
src:url('fonts/OpenSans-Italic-webfont.eot?#iefix') format('embedded-opentype'),
url('fonts/OpenSans-Italic-webfont.woff') format('woff'),
url('fonts/OpenSans-Italic-webfont.ttf') format('truetype'),
url('fonts/OpenSans-Italic-webfont.svg#OpenSansItalic') format('svg');
@ -32,8 +32,8 @@ fonts
/* Light */
@font-face {
font-family: 'Open Sans';
src: url('fonts/OpenSans-Light-webfont.eot');
src: url('fonts/OpenSans-Light-webfont.eot?#iefix') format('embedded-opentype'),
src:url('fonts/OpenSans-Light-webfont.eot');
src:url('fonts/OpenSans-Light-webfont.eot?#iefix') format('embedded-opentype'),
url('fonts/OpenSans-Light-webfont.woff') format('woff'),
url('fonts/OpenSans-Light-webfont.ttf') format('truetype'),
url('fonts/OpenSans-Light-webfont.svg#OpenSansLight') format('svg');
@ -44,8 +44,8 @@ fonts
/* Light Italic */
@font-face {
font-family: 'Open Sans';
src: url('fonts/OpenSans-LightItalic-webfont.eot');
src: url('fonts/OpenSans-LightItalic-webfont.eot?#iefix') format('embedded-opentype'),
src:url('fonts/OpenSans-LightItalic-webfont.eot');
src:url('fonts/OpenSans-LightItalic-webfont.eot?#iefix') format('embedded-opentype'),
url('fonts/OpenSans-LightItalic-webfont.woff') format('woff'),
url('fonts/OpenSans-LightItalic-webfont.ttf') format('truetype'),
url('fonts/OpenSans-LightItalic-webfont.svg#OpenSansLightItalic') format('svg');
@ -56,8 +56,8 @@ fonts
/* Semibold */
@font-face {
font-family: 'Open Sans';
src: url('fonts/OpenSans-Semibold-webfont.eot');
src: url('fonts/OpenSans-Semibold-webfont.eot?#iefix') format('embedded-opentype'),
src:url('fonts/OpenSans-Semibold-webfont.eot');
src:url('fonts/OpenSans-Semibold-webfont.eot?#iefix') format('embedded-opentype'),
url('fonts/OpenSans-Semibold-webfont.woff') format('woff'),
url('fonts/OpenSans-Semibold-webfont.ttf') format('truetype'),
url('fonts/OpenSans-Semibold-webfont.svg#OpenSansSemibold') format('svg');
@ -68,8 +68,8 @@ fonts
/* Semibold Italic */
@font-face {
font-family: 'Open Sans';
src: url('fonts/OpenSans-SemiboldItalic-webfont.eot');
src: url('fonts/OpenSans-SemiboldItalic-webfont.eot?#iefix') format('embedded-opentype'),
src:url('fonts/OpenSans-SemiboldItalic-webfont.eot');
src:url('fonts/OpenSans-SemiboldItalic-webfont.eot?#iefix') format('embedded-opentype'),
url('fonts/OpenSans-SemiboldItalic-webfont.woff') format('woff'),
url('fonts/OpenSans-SemiboldItalic-webfont.ttf') format('truetype'),
url('fonts/OpenSans-SemiboldItalic-webfont.svg#OpenSansSemiboldItalic') format('svg');
@ -80,8 +80,8 @@ fonts
/* Bold */
@font-face {
font-family: 'Open Sans';
src: url('fonts/OpenSans-Semibold-webfont.eot');
src: url('fonts/OpenSans-Semibold-webfont.eot?#iefix') format('embedded-opentype'),
src:url('fonts/OpenSans-Semibold-webfont.eot');
src:url('fonts/OpenSans-Semibold-webfont.eot?#iefix') format('embedded-opentype'),
url('fonts/OpenSans-Semibold-webfont.woff') format('woff'),
url('fonts/OpenSans-Semibold-webfont.ttf') format('truetype'),
url('fonts/OpenSans-Semibold-webfont.svg#OpenSansSemibold') format('svg');
@ -93,8 +93,8 @@ fonts
/* Bold Italic */
@font-face {
font-family: 'Open Sans';
src: url('fonts/OpenSans-SemiboldItalic-webfont.eot');
src: url('fonts/OpenSans-SemiboldItalic-webfont.eot?#iefix') format('embedded-opentype'),
src:url('fonts/OpenSans-SemiboldItalic-webfont.eot');
src:url('fonts/OpenSans-SemiboldItalic-webfont.eot?#iefix') format('embedded-opentype'),
url('fonts/OpenSans-SemiboldItalic-webfont.woff') format('woff'),
url('fonts/OpenSans-SemiboldItalic-webfont.ttf') format('truetype'),
url('fonts/OpenSans-SemiboldItalic-webfont.svg#OpenSansSemiboldItalic') format('svg');
@ -106,8 +106,8 @@ fonts
/* Extra Bold */
@font-face {
font-family: 'Open Sans';
src: url('fonts/OpenSans-Bold-webfont.eot');
src: url('fonts/OpenSans-Bold-webfont.eot?#iefix') format('embedded-opentype'),
src:url('fonts/OpenSans-Bold-webfont.eot');
src:url('fonts/OpenSans-Bold-webfont.eot?#iefix') format('embedded-opentype'),
url('fonts/OpenSans-Bold-webfont.woff') format('woff'),
url('fonts/OpenSans-Bold-webfont.ttf') format('truetype'),
url('fonts/OpenSans-Bold-webfont.svg#OpenSansBold') format('svg');
@ -118,8 +118,8 @@ fonts
/* Extra Bold Italic */
@font-face {
font-family: 'Open Sans';
src: url('fonts/OpenSans-BoldItalic-webfont.eot');
src: url('fonts/OpenSans-BoldItalic-webfont.eot?#iefix') format('embedded-opentype'),
src:url('fonts/OpenSans-BoldItalic-webfont.eot');
src:url('fonts/OpenSans-BoldItalic-webfont.eot?#iefix') format('embedded-opentype'),
url('fonts/OpenSans-BoldItalic-webfont.woff') format('woff'),
url('fonts/OpenSans-BoldItalic-webfont.ttf') format('truetype'),
url('fonts/OpenSans-BoldItalic-webfont.svg#OpenSansBoldItalic') format('svg');
@ -130,8 +130,8 @@ fonts
/* Droid Sans */
@font-face {
font-family: 'droid_sans_mono';
src: url('fonts/droidsansmono-webfont.eot');
src: url('fonts/droidsansmono-webfont.eot?#iefix') format('embedded-opentype'),
src:url('fonts/droidsansmono-webfont.eot');
src:url('fonts/droidsansmono-webfont.eot?#iefix') format('embedded-opentype'),
url('fonts/droidsansmono-webfont.woff') format('woff'),
url('fonts/droidsansmono-webfont.ttf') format('truetype'),
url('fonts/droidsansmono-webfont.svg#droid_sans_monoregular') format('svg');
@ -3010,6 +3010,14 @@ span.token-input-delete-token {
.red-text {color:#d33}
.clear-left {clear:left}
.nextline-block {display:block}
.trakt-image {
display: block;
width: 100%;
height: 100%;
z-index: 0;
background-image: url(/images/poster-dark.jpg)
}
/* =======================================================================
jquery.confirm.css
========================================================================== */

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View file

@ -4,14 +4,14 @@
#from sickbeard.common import *
#from sickbeard import sbdatetime
#set global $title="Trending Shows"
#set global $header="Trending Shows"
#set global $title='Trending Shows'
#set global $header='Trending Shows'
#set global $sbPath=".."
#set global $sbPath='..'
#set global $topmenu="comingEpisodes"
#set global $topmenu='comingEpisodes'
#import os.path
#include $os.path.join($sickbeard.PROG_DIR, "gui/slick/interfaces/default/inc_top.tmpl")
#include $os.path.join($sickbeard.PROG_DIR, 'gui/slick/interfaces/default/inc_top.tmpl')
<script type="text/javascript" src="$sbRoot/js/plotTooltip.js?$sbPID"></script>
@ -19,20 +19,59 @@
<!--
\$(document).ready(function(){
// initialise combos for dirty page refreshes
\$('#showsort').val('original');
\$('#showsortdirection').val('asc');
var \$container = [\$('#container'), \$('#container-anime')];
var \$container = [\$('#container')];
jQuery.each(\$container, function (j) {
this.isotope({
itemSelector: '.trakt_show',
layoutMode: 'masonry',
masonry: {
columnWidth: 12,
isFitWidth: true
sortBy: 'original-order',
layoutMode: 'fitRows',
getSortData: {
name: function( itemElem ) {
var name = \$( itemElem ).attr('data-name') || '';
#if not $sickbeard.SORT_ARTICLE:
name = name.replace(/^(The|A|An)\s/i, '');
#end if
return name.toLowerCase();
},
rating: '[data-rating] parseInt',
votes: '[data-votes] parseInt',
}
});
});
\$('#showsort').on( 'change', function() {
var sortCriteria;
switch (this.value) {
case 'original':
sortCriteria = 'original-order'
break;
case 'rating':
/* randomise, else the rating_votes can already
* have sorted leaving this with nothing to do.
*/
\$('#container').isotope({sortBy: 'random'});
sortCriteria = 'rating';
break;
case 'rating_votes':
sortCriteria = ['rating', 'votes'];
break;
case 'votes':
sortCriteria = 'votes';
break;
default:
sortCriteria = 'name'
break;
}
\$('#container').isotope({sortBy: sortCriteria});
});
\$('#showsortdirection').on( 'change', function() {
\$('#container').isotope({sortAscending: ('asc' == this.value)});
});
});
//-->
@ -44,40 +83,70 @@
<h1 class="title">$title</h1>
#end if
#if $trending_shows
<div class="pull-right" style="margin-top: -40px;">
<span>Sort By:</span>
<select id="showsort" class="form-control form-control-inline input-sm">
<option value="name">Name</option>
<option value="original" selected="selected">Original</option>
<option value="votes">Votes</option>
<option value="rating">% Rating</option>
<option value="rating_votes">% Rating > Votes</option>
</select>
<span style="margin-left:12px">Sort Order:</span>
<select id="showsortdirection" class="form-control form-control-inline input-sm">
<option value="asc" selected="selected">Asc</option>
<option value="desc">Desc</option>
</select>
</div>
#end if
<div id="container">
#if None is $trending_shows
<div class="trakt_show" style="width:100%; margin-top:20px">
<p class="red-text">Trakt API did not return results, this can happen from time to time.
<br /><br />This view should auto refresh every 10 mins.</p>
</div>
#else
#for $cur_show in $trending_shows:
#set $image = re.sub(r"(.*)(\..*?)$", r"\1-300\2", $cur_show["images"]["poster"], 0, re.IGNORECASE | re.MULTILINE)
#set $image = re.sub(r'(.*)(\..*?)$', r'\1-300\2', $cur_show['images']['poster'], 0, re.IGNORECASE | re.MULTILINE)
<div class="trakt_show">
<div class="trakt_show" data-name="$cur_show['title']" data-rating="$cur_show['ratings']['percentage']" data-votes="$cur_show['ratings']['votes']">
<div class="traktContainer">
<div class="trakt-image">
<a href="${cur_show["url"]}" target="_blank"><img alt="" class="trakt-image" src="${image}" /></a>
<a class="trakt-image" href="${cur_show['url']}" target="_blank"><img alt="" class="trakt-image" src="${image}" /></a>
</div>
<div class="show-title">
$cur_show["title"]
<%= (cur_show['title'], '<span>&nbsp;</span>')[ '' == cur_show['title']] %>
</div>
<div class="clearfix">
<p>$cur_show["ratings"]["percentage"]% <img src="$sbRoot/images/heart.png"></p>
<i>$cur_show["ratings"]["votes"] votes</i>
<p>$cur_show['ratings']['percentage']% <img src="$sbRoot/images/heart.png"></p>
<i>$cur_show['ratings']['votes'] votes</i>
<div class="traktShowTitleIcons">
<a href="$sbRoot/home/addTraktShow?indexer_id=${cur_show["tvdb_id"]}&amp;showName=${cur_show["title"]}" class="btn btn-xs">Add Show</a>
#if 'ExistsInLibrary' in $cur_show['tvdb_id']:
<p style="line-height: 1.5; padding: 2px 5px 3px">In library</p>
#else
<a href="$sbRoot/home/addTraktShow?indexer_id=${cur_show['tvdb_id']}&amp;showName=${cur_show['title']}" class="btn btn-xs">Add Show</a>
#end if
</div>
</div>
</div>
</div>
#end for
#end if
</div>
<script type="text/javascript" charset="utf-8">
<!--
window.setInterval( "location.reload(true)", 600000); // Refresh every 10 minutes
window.setInterval('location.reload(true)', 600000); // Refresh every 10 minutes
//-->
</script>
#include $os.path.join($sickbeard.PROG_DIR, "gui/slick/interfaces/default/inc_bottom.tmpl")
#include $os.path.join($sickbeard.PROG_DIR, 'gui/slick/interfaces/default/inc_bottom.tmpl')

View file

@ -2989,6 +2989,11 @@ class NewHomeAddShows(MainHandler):
t.trending_shows = TraktCall("shows/trending.json/%API%", sickbeard.TRAKT_API_KEY)
if None is not t.trending_shows:
for item in t.trending_shows:
if helpers.findCertainShow(sickbeard.showList, int(item['tvdb_id'])):
item['tvdb_id'] = u'ExistsInLibrary'
return _munge(t)
def existingShows(self, *args, **kwargs):