From b3be940d445e8393b4d1fe2fe10f206b974261d8 Mon Sep 17 00:00:00 2001 From: Prinz23 Date: Thu, 19 Nov 2015 23:05:19 +0100 Subject: [PATCH] Add multiple Trakt account support to Config/Notifications/Social. Add setting to Trakt notification to update collection with downloaded episode info. Add Most Watched, Collected during the last month on Trakt. Change Add from Trakt/"Shows:" with Anticipated, Popular views. Change improve robustness of Trakt communications. Change Trakt notifier logo. Change pep8 and cleanup. --- CHANGES.md | 11 +- gui/slick/css/dark.css | 14 +- gui/slick/css/light.css | 14 +- gui/slick/css/style.css | 26 +++ gui/slick/images/notifiers/trakt.png | Bin 3589 -> 3662 bytes .../interfaces/default/config_notifications.tmpl | 74 +++++- gui/slick/interfaces/default/home_browseShows.tmpl | 14 +- gui/slick/js/configNotifications.js | 166 +++++++++++-- gui/slick/js/formwizard.js | 5 +- lib/libtrakt/__init__.py | 2 +- lib/libtrakt/exceptions.py | 6 +- lib/libtrakt/trakt.py | 258 +++++++++++++++------ sickbeard/__init__.py | 36 +-- sickbeard/config.py | 32 ++- sickbeard/notifiers/__init__.py | 5 +- sickbeard/notifiers/trakt.py | 139 +++++------ sickbeard/postProcessor.py | 2 +- sickbeard/show_queue.py | 14 +- sickbeard/trakt_helpers.py | 57 +++++ sickbeard/tv.py | 12 +- sickbeard/webserve.py | 134 ++++++++--- 21 files changed, 757 insertions(+), 264 deletions(-) create mode 100644 sickbeard/trakt_helpers.py diff --git a/CHANGES.md b/CHANGES.md index 14271fc..04de6ad 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -64,17 +64,22 @@ * Change increase frequency of updating show data * Remove Animenzb provider * Change increase the scope and number of non release group text that is identified and removed -* Add a general config setting to allow adding incomplete show data +* Add general config setting to allow adding incomplete show data * Change to throttle connection rate on thread initiation for adba library * Change default manage episodes selector to Snatched episodes if items exist else Wanted on Episode Status Manage page * Change snatched row colour on Episode Status Manage page to match colour used on the show details page * Change replace trakt with libtrakt for API v2 -* Change Trakt notification config to only handle PIN authentication with the service +* Change improve robustness of Trakt communications +* Change Trakt notification config to use PIN authentication with the service +* Add multiple Trakt account support to Config/Notifications/Social +* Add setting to Trakt notification to update collection with downloaded episode info +* Change trakt notifier logo * Remove all other Trakt deprecated API V1 service features pending reconsideration * Change increase show search capability when using plain text and also add TVDB id, IMDb id and IMDb url search * Change improve existing show page and the handling when an attempt to add a show to an existing location * Change consolidate Trakt Trending and Recommended views into an "Add From Trakt" view which defaults to trending -* Change Trakt view drop down "Show" to reveal Brand-new Shows, Season Premieres, Recommendations and Trending views +* Change Add from Trakt/"Shows:" with Anticipated, New Seasons, New Shows, Popular, Recommendations, and Trending views +* Change Add from Trakt/"Shows:" with Most Watched, Collected during the last month on Trakt * Change add season info to "Show: Trakt New Seasons" view on the Add from Trakt page * Change increase number of displayed Trakt shows to 100 * Add genres and rating to all Trakt shows diff --git a/gui/slick/css/dark.css b/gui/slick/css/dark.css index 5b35a87..69da66e 100644 --- a/gui/slick/css/dark.css +++ b/gui/slick/css/dark.css @@ -635,6 +635,14 @@ div.metadataDiv .disabled{ background:url("../images/warning16.png") no-repeat right 5px center #fff } +.solid-border{ + border:1px solid #555 +} + +.solid-border-top{ + border-top:1px solid #555 +} + /* ======================================================================= manage*.tmpl ========================================================================== */ @@ -1190,7 +1198,7 @@ browser.css #fileBrowserDialog ul li a:hover{ color:#09a2ff; - background:none + background: rgb(61, 61, 61) none } .ui-menu .ui-menu-item{ @@ -1224,6 +1232,10 @@ div.stepsguide .step p{ color:#646464 } +#newShowPortal #addShowForm .stepsguide .disabledstep:hover > .smalltext{ + color:#ccc; +} + div.stepsguide .disabledstep p{ border-color:#1178B3 } diff --git a/gui/slick/css/light.css b/gui/slick/css/light.css index 2b99452..0b30169 100644 --- a/gui/slick/css/light.css +++ b/gui/slick/css/light.css @@ -610,6 +610,14 @@ div.metadataDiv .disabled{ background:url("../images/warning16.png") no-repeat right 5px center #fff } +.solid-border{ + border:1px solid #ccc +} + +.solid-border-top{ + border-top:1px solid #ccc +} + /* ======================================================================= manage*.tmpl ========================================================================== */ @@ -1152,7 +1160,7 @@ browser.css #fileBrowserDialog ul li a:hover{ color:#00f; - background:none + background: rgb(220, 220, 220) none } .ui-menu .ui-menu-item{ @@ -1190,6 +1198,10 @@ div.stepsguide .disabledstep p{ border-color:#8a775e } +#newShowPortal #addShowForm .stepsguide .disabledstep:hover > .smalltext{ + color:#8a775e; +} + div.formpaginate .prev, div.formpaginate .next{ color:#fff; background:#57442b diff --git a/gui/slick/css/style.css b/gui/slick/css/style.css index ee1b376..9e59104 100644 --- a/gui/slick/css/style.css +++ b/gui/slick/css/style.css @@ -2559,6 +2559,32 @@ div.metadataDiv .disabled{ margin:6px 4px 0 0 } +#trakt-collection th,#trakt-collection td{ + padding:3px 5px +} + +#trakt-collection .col-1{ + text-align:left +} + +#trakt-collection th,#trakt-collection td.opt{ + text-align:center +} + +#trakt-collection .col-1{ + width:192px +} + +#config #trakt-collection input{ + float:none; + margin:0; + vertical-align:middle +} + +#config .trakt.component-desc{ + margin-left:0 +} + /* ======================================================================= manage*.tmpl ========================================================================== */ diff --git a/gui/slick/images/notifiers/trakt.png b/gui/slick/images/notifiers/trakt.png index a767eea4b8b24f951714fa497119c3f2460fe0a6..e91f57f1fd64d5a54d87e17db6277c5fd03b3503 100644 GIT binary patch delta 960 zcmV;x13&zQ9L^jeiBL{Q4GJ0x0000DNk~Le0000O0000O2nGNE0N{5$_^~0M3V(S? zL_t(|+LV@Eh?I2{#@{ZYGR!g|qyO%{^USm3t|PT-lSTw3iKaTt(@^8qykk=sJjJy*0 z9^_}^d>r}ZW}vCWE6Cp>|Ac%e@`cDkz8?8uh~0F!ljJ@+JS#H%7kQ`|pn`k?c|G#k$a|&`t;aSx+&2Ukz6BroHj3_;J&!8G8ynB@)+`& z$Zxg~-w|c0lDv@Q4J21c{v{yCX!i`{*N{I(J}pC@jr=R}?Z~|?#COu+Zjy&Xyh?J3 zzYk7p?OqWI794Ee5TwSV)F549*undJLPUP|&KB%9=Y4dOMD|EAq@Ba2-b@{7^O zg{I=UGm_Vn+)wgak_#m7pF+GIcOds6f1e?Lh1`$4VhZu?$lb^z8S+F-=s<(`bI4`n2a%T`4+UiFG~zXqKOlDr`G+jL<$osRb(6$Lkh_pK zAYX>ODJFN2+}$K^n+9-@+?~irGvx1(?+wUFx(8qMwP`8Vb`2AK3 z%cvp07nux30}PY9LYpt4;A`Wa-bTA#9tW%A2@jnDq$@IBjDOq~nV&#@s@cL>6|K4v zc_#AR(Zjo5_MQ(gLV zV>ZTPKW{`{MWNVBp}34fab*Ax#5&!Fy!8KkRn()1ypCM&Q0)9>th@a4SapihVSRm_SS&`lT&7Sc zkVqtc1KtPT4t@yaOw+V8nas=OvbH*`4s5*^~%qGwk+#RR4SEcsZ{Fg!NEaH)5I|D z*ilMh+cy3E{VXgjkV>UcN`KL8Hrd$+TCUUGDF#LdmkkOWrCEZLl~Qy%9e--I+7G}NfQ(4X z@b#>GRm6Qx19T4%ycJcW8HBk zU(>;H(=-u61T<-bHx&N^{}tFL-FrxKD45&T4Jjn -#if $varExists('header') +#if $varExists('header')

$header

-#else +#else

$title

#end if @@ -155,7 +156,7 @@ -
+

Kodi

@@ -275,7 +276,7 @@
- +
@@ -1481,16 +1482,77 @@
+
+ +
+ +#set num_accounts = len($trakt_accounts) +#set $num_columns = (1, num_accounts)[1 < num_accounts] + + + + + + + +#if not len($trakt_accounts) + +#end if +#for $void, $account in $trakt_accounts.items() + +#end for + + + +#if not $root_dirs: + #set $root_dirs = [{'root_def': False, 'loc': 'all folders. Multiple parent folders will appear here.', 'b64': ''}] +#end if +#for $root_info in $root_dirs: + + + #if not len($trakt_accounts) + + #end if + #for $void, $account in $trakt_accounts.items() + #set $cur_selected = ('', ' checked="checked"')[$root_info['loc'] in $sickbeard.TRAKT_UPDATE_COLLECTION.get($account.account_id, '')] + #set $id_loc = "update_trakt_%s_%s" % ($account.account_id, $root_info['b64']) + + #end for + + + + +#end for + +
Update multiple accounts with downloaded episode info#echo not len($trakt_accounts) and 'Connect New Pin' or 1 < len($trakt_accounts) and 'Trakt accounts' or 'Account'#
..$account.name#if $account.active then '' else '
(inactive)'#
Update collection.. + +
for #if $root_info['root_def'] then '*' else ''#$root_info['loc']
+
+
-#include $os.path.join($sickbeard.PROG_DIR, 'gui/slick/interfaces/default/inc_bottom.tmpl') \ No newline at end of file +#include $os.path.join($sickbeard.PROG_DIR, 'gui/slick/interfaces/default/inc_bottom.tmpl') diff --git a/gui/slick/interfaces/default/home_browseShows.tmpl b/gui/slick/interfaces/default/home_browseShows.tmpl index 1a6c7cb..2c565f9 100644 --- a/gui/slick/interfaces/default/home_browseShows.tmpl +++ b/gui/slick/interfaces/default/home_browseShows.tmpl @@ -128,10 +128,18 @@ #if 'Trakt' == $browse_type #set $mode = $kwargs and $kwargs.get('mode', None) #set $selected = ' class="selected"' - - + - + + + + + + #for $account in $sickbeard.TRAKT_ACCOUNTS + #if $sickbeard.TRAKT_ACCOUNTS[$account].active and $sickbeard.TRAKT_ACCOUNTS[$account].name + + #end if + #end for #end if diff --git a/gui/slick/js/configNotifications.js b/gui/slick/js/configNotifications.js index 1f47dcb..9bfde00 100644 --- a/gui/slick/js/configNotifications.js +++ b/gui/slick/js/configNotifications.js @@ -1,4 +1,4 @@ -$(document).ready(function(){ +$(document).ready(function(){ var loading = ''; $('#testGrowl').click(function () { @@ -353,28 +353,162 @@ $(document).ready(function(){ }); var elTraktAuth = $('#trakt-authenticate'), elTraktAuthResult = $('#trakt-authentication-result'); - elTraktAuth.click(function() { - var elTrakt = $('#trakt_pin'), traktPin = $.trim(elTrakt.val()); - if(!traktPin) { - elTrakt.addClass('warning'); + + function trakt_send_auth(){ + var elAccountSelect = $('#trakt_accounts'), strCurAccountId = elAccountSelect.find('option:selected').val(), + elTraktPin = $('#trakt_pin'), strPin = $.trim(elTraktPin.val()); + + elTraktAuthResult.html(loading); + + $.get(sbRoot + '/home/trakt_authenticate', {'pin': strPin, 'account': strCurAccountId}) + .done(function(data) { + elTraktAuth.prop('disabled', !1); + elTraktPin.val(''); + + var JSONData = $.parseJSON(data); + + elTraktAuthResult.html('Success' == JSONData.result + ? JSONData.result + ' account: ' + JSONData.account_name + : JSONData.result + ' ' + JSONData.error_message); + + if ('Success' == JSONData.result) { + var elUpdateRows = $('#trakt-collection').find('tr'); + if ('new' == strCurAccountId) { + elAccountSelect.append($('