Browse Source

Merge branch 'develop'

pull/5327/head
Ruud 10 years ago
parent
commit
9f495eaad2
  1. 11
      couchpotato/core/media/movie/_base/static/details.js
  2. 7
      couchpotato/core/media/movie/_base/static/movie.actions.js
  3. 150
      couchpotato/core/media/movie/_base/static/movie.scss
  4. 8
      couchpotato/core/media/movie/providers/automation/trakt/__init__.py
  5. 48
      couchpotato/core/media/movie/providers/automation/trakt/main.py
  6. 5
      couchpotato/core/media/movie/providers/info/couchpotatoapi.py
  7. 1
      couchpotato/static/scripts/combined.base.min.js
  8. 13
      couchpotato/static/scripts/combined.plugins.min.js
  9. 3
      couchpotato/static/scripts/couchpotato.js
  10. 35
      couchpotato/static/style/combined.min.css
  11. 2
      couchpotato/static/style/main.scss

11
couchpotato/core/media/movie/_base/static/details.js

@ -10,8 +10,7 @@ var MovieDetails = new Class({
self.sections = {}; self.sections = {};
var category = parent.get('category'), var category = parent.get('category');
profile = parent.profile;
self.el = new Element('div',{ self.el = new Element('div',{
'class': 'page active movie_details level_' + (options.level || 0) 'class': 'page active movie_details level_' + (options.level || 0)
@ -123,6 +122,12 @@ var MovieDetails = new Class({
}); });
} }
self.outer_click = function(){
self.close();
};
App.addEvent('history.push', self.outer_click)
}, },
close: function(){ close: function(){
@ -157,6 +162,8 @@ var MovieDetails = new Class({
else { else {
self.el.removeClass('show'); self.el.removeClass('show');
} }
App.removeEvent('history.push', self.outer_click)
} }
}); });

7
couchpotato/core/media/movie/_base/static/movie.actions.js

@ -346,7 +346,7 @@ MA.Release = new Class({
if(json.success){ if(json.success){
if(icon) if(icon)
icon.addClass('completed'); icon.addClass('completed');
release_el.getElement('.release_status').set('text', 'snatched'); release_el.getElement('.status').set('text', 'snatched');
} }
else else
if(icon) if(icon)
@ -421,7 +421,10 @@ MA.Trailer = new Class({
watch: function(){ watch: function(){
var self = this; var self = this;
self.container.set('html', '<iframe src="https://www.youtube-nocookie.com/embed/'+self.video_id+'?rel=0&showinfo=0&autoplay=1&showsearch=0&iv_load_policy=3&vq=hd720" />');
new Element('iframe', {
'src': 'https://www.youtube-nocookie.com/embed/'+self.video_id+'?rel=0&showinfo=0&autoplay=1&showsearch=0&iv_load_policy=3&vq=hd720'
}).inject(self.container);
} }

150
couchpotato/core/media/movie/_base/static/movie.scss

@ -1037,109 +1037,127 @@ $mass_edit_height: 44px;
} }
.section_trailer.no_trailer { .section_trailer.section_trailer {
display: none; $max_height: 450px;
} $max_width: $max_height * (16/9);
.trailer_container {
$play-size: 110px;
background: #000; padding: 0;
position: relative; background: $menu_color;
padding-bottom: 56.25%; max-height: $max_height;
height: 0;
overflow: hidden; overflow: hidden;
max-width: 100%;
cursor: pointer;
.background { @include media-phablet {
opacity: .3; max-height: $max_height;
background: no-repeat center;
background-size: cover;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1;
} }
.icon-play { &.no_trailer {
opacity: 0.9; display: none;
position: absolute; }
z-index: 2;
text-align: center;
width: 100%;
top: 50%;
transform: translateY(-50%);
will-change: opacity;
transition: all 300ms;
color: #FFF;
font-size: $play-size;
@include media-desktop { .trailer_container {
font-size: $play-size/2; $play-size: 110px;
}
max-height: $max_height;
position: relative;
overflow: hidden;
max-width: $max_width;
margin: 0 auto;
cursor: pointer;
@include media-phablet { @include media-phablet {
font-size: $play-size/3.5; margin-bottom: $padding/2;
} }
span { .background {
transition: all 300ms; opacity: .3;
background: no-repeat center;
background-size: cover;
position: relative;
z-index: 1;
max-height: $max_height;
padding-bottom: 56.25%;
}
.icon-play {
opacity: 0.9; opacity: 0.9;
position: absolute; position: absolute;
font-size: 1em; z-index: 2;
text-align: center;
width: 100%;
top: 50%; top: 50%;
left: 50%; transform: translateY(-50%);
margin-left: $play-size/2;
transform: translateY(-54%);
will-change: opacity; will-change: opacity;
transition: all 300ms;
color: #FFF;
font-size: $play-size;
@include media-desktop { @include media-desktop {
margin-left: $play-size/4; font-size: $play-size/2;
} }
@include media-phablet { @include media-phablet {
margin-left: $play-size/7; font-size: $play-size/3.5;
} }
&:first-child { span {
margin-left: -($play-size/2); transition: all 300ms;
transform: translate(-100%, -54%); opacity: 0.9;
position: absolute;
font-size: 1em;
top: 50%;
left: 50%;
margin-left: $play-size/2;
transform: translateY(-54%);
will-change: opacity;
@include media-desktop { @include media-desktop {
margin-left: -($play-size/4); margin-left: $play-size/4;
} }
@include media-phablet { @include media-phablet {
margin-left: -($play-size/7); margin-left: $play-size/7;
}
&:first-child {
margin-left: -($play-size/2);
transform: translate(-100%, -54%);
@include media-desktop {
margin-left: -($play-size/4);
}
@include media-phablet {
margin-left: -($play-size/7);
}
} }
} }
} }
}
&:hover { &:hover {
color: $primary_color; color: $primary_color;
.icon-play {
opacity: 1;
span { .icon-play {
opacity: 1; opacity: 1;
span {
opacity: 1;
}
} }
} }
}
iframe { iframe {
position: absolute; position: absolute;
top: 0; width: 100%;
left: 0; height: 100%;
width: 100%; border: 0;
height: 100%; top: 0;
border: 0; left: 0;
max-height: $max_height;
z-index: 10;
}
} }
} }
} }

8
couchpotato/core/media/movie/providers/automation/trakt/__init__.py

@ -25,7 +25,13 @@ config = [{
'label': 'Auth Token', 'label': 'Auth Token',
'advanced': 1 'advanced': 1
}, },
{
'name': 'automation_oauth_refresh',
'label': 'Refresh Token',
'description': 'Used to automatically refresh your oauth token every 3 months',
'advanced': 1
},
], ],
}, },
], ],
}] }]

48
couchpotato/core/media/movie/providers/automation/trakt/main.py

@ -1,7 +1,10 @@
import json import json
import traceback
import time
from couchpotato import Env from couchpotato import Env, fireEvent
from couchpotato.api import addApiView from couchpotato.api import addApiView
from couchpotato.core.event import addEvent
from couchpotato.core.helpers.variable import cleanHost from couchpotato.core.helpers.variable import cleanHost
from couchpotato.core.logger import CPLog from couchpotato.core.logger import CPLog
from couchpotato.core.media._base.providers.base import Provider from couchpotato.core.media._base.providers.base import Provider
@ -36,13 +39,42 @@ class Trakt(Automation, TraktBase):
urls = { urls = {
'watchlist': 'sync/watchlist/movies/', 'watchlist': 'sync/watchlist/movies/',
'oauth': 'https://api.couchpota.to/authorize/trakt/', 'oauth': 'https://api.couchpota.to/authorize/trakt/',
'refresh_token': 'https://api.couchpota.to/authorize/trakt_refresh/',
} }
def __init__(self): def __init__(self):
super(Trakt, self).__init__()
addApiView('automation.trakt.auth_url', self.getAuthorizationUrl) addApiView('automation.trakt.auth_url', self.getAuthorizationUrl)
addApiView('automation.trakt.credentials', self.getCredentials) addApiView('automation.trakt.credentials', self.getCredentials)
super(Trakt, self).__init__() fireEvent('schedule.interval', 'updater.check', self.refreshToken, hours = 24)
addEvent('app.load', self.refreshToken)
def refreshToken(self):
token = self.conf('automation_oauth_token')
refresh_token = self.conf('automation_oauth_refresh')
if token and refresh_token:
prop_name = 'last_trakt_refresh'
last_refresh = int(Env.prop(prop_name, default = 0))
if last_refresh < time.time()-4838400: # refresh every 8 weeks
log.debug('Refreshing trakt token')
url = self.urls['refresh_token'] + '?token=' + self.conf('automation_oauth_refresh')
data = fireEvent('cp.api_call', url, cache_timeout = 0, single = True)
if data and 'oauth' in data and 'refresh' in data:
log.debug('Oauth refresh: %s', data)
self.conf('automation_oauth_token', value = data.get('oauth'))
self.conf('automation_oauth_refresh', value = data.get('refresh'))
Env.prop(prop_name, value = int(time.time()))
else:
log.error('Failed refreshing Trakt token, please re-register in settings')
elif token and not refresh_token:
log.error('Refresh token is missing, please re-register Trakt for autorefresh of the token in the future')
def getIMDBids(self): def getIMDBids(self):
movies = [] movies = []
@ -69,8 +101,14 @@ class Trakt(Automation, TraktBase):
def getCredentials(self, **kwargs): def getCredentials(self, **kwargs):
try: try:
oauth_token = kwargs.get('oauth') oauth_token = kwargs.get('oauth')
refresh_token = kwargs.get('refresh')
log.debug('oauth_token is: %s', oauth_token)
self.conf('automation_oauth_token', value = oauth_token)
self.conf('automation_oauth_refresh', value = refresh_token)
Env.prop('last_trakt_refresh', value = int(time.time()))
except: except:
return 'redirect', Env.get('web_base') + 'settings/automation/' log.error('Failed setting trakt token: %s', traceback.format_exc())
log.debug('oauth_token is: %s', oauth_token)
self.conf('automation_oauth_token', value = oauth_token)
return 'redirect', Env.get('web_base') + 'settings/automation/' return 'redirect', Env.get('web_base') + 'settings/automation/'

5
couchpotato/core/media/movie/providers/info/couchpotatoapi.py

@ -40,9 +40,14 @@ class CouchPotatoApi(MovieProvider):
addEvent('release.validate', self.validate) addEvent('release.validate', self.validate)
addEvent('cp.api_call', self.call)
addEvent('cp.source_url', self.getSourceUrl) addEvent('cp.source_url', self.getSourceUrl)
addEvent('cp.messages', self.getMessages) addEvent('cp.messages', self.getMessages)
def call(self, url, **kwargs):
return self.getJsonData(url, headers = self.getRequestHeaders(), **kwargs)
def getMessages(self, last_check = 0): def getMessages(self, last_check = 0):
data = self.getJsonData(self.urls['messages'] % tryUrlencode({ data = self.getJsonData(self.urls['messages'] % tryUrlencode({

1
couchpotato/static/scripts/combined.base.min.js

@ -222,6 +222,7 @@ var CouchPotato = new Class({
var url = el.get("href"); var url = el.get("href");
if (e.event && e.event.button === 1) window.open(url); else if (History.getPath() != url) History.push(url); if (e.event && e.event.button === 1) window.open(url); else if (History.getPath() != url) History.push(url);
} }
self.fireEvent("history.push");
}, },
isMac: function() { isMac: function() {
return Browser.platform == "mac"; return Browser.platform == "mac";

13
couchpotato/static/scripts/combined.plugins.min.js

@ -326,7 +326,7 @@ var MovieDetails = new Class({
initialize: function(parent, options) { initialize: function(parent, options) {
var self = this; var self = this;
self.sections = {}; self.sections = {};
var category = parent.get("category"), profile = parent.profile; var category = parent.get("category");
self.el = new Element("div", { self.el = new Element("div", {
class: "page active movie_details level_" + (options.level || 0) class: "page active movie_details level_" + (options.level || 0)
}).adopt(self.overlay = new Element("div.overlay", { }).adopt(self.overlay = new Element("div.overlay", {
@ -398,6 +398,10 @@ var MovieDetails = new Class({
}); });
}); });
} }
self.outer_click = function() {
self.close();
};
App.addEvent("history.push", self.outer_click);
}, },
close: function() { close: function() {
var self = this; var self = this;
@ -425,6 +429,7 @@ var MovieDetails = new Class({
} else { } else {
self.el.removeClass("show"); self.el.removeClass("show");
} }
App.removeEvent("history.push", self.outer_click);
} }
}); });
@ -1271,7 +1276,7 @@ MA.Release = new Class({
if (icon) icon.removeClass("icon spinner"); if (icon) icon.removeClass("icon spinner");
if (json.success) { if (json.success) {
if (icon) icon.addClass("completed"); if (icon) icon.addClass("completed");
release_el.getElement(".release_status").set("text", "snatched"); release_el.getElement(".status").set("text", "snatched");
} else if (icon) icon.addClass("attention").set("title", "Something went wrong when downloading, please check logs."); } else if (icon) icon.addClass("attention").set("title", "Something went wrong when downloading, please check logs.");
} }
}); });
@ -1323,7 +1328,9 @@ MA.Trailer = new Class({
}, },
watch: function() { watch: function() {
var self = this; var self = this;
self.container.set("html", '<iframe src="https://www.youtube-nocookie.com/embed/' + self.video_id + '?rel=0&showinfo=0&autoplay=1&showsearch=0&iv_load_policy=3&vq=hd720" />'); new Element("iframe", {
src: "https://www.youtube-nocookie.com/embed/" + self.video_id + "?rel=0&showinfo=0&autoplay=1&showsearch=0&iv_load_policy=3&vq=hd720"
}).inject(self.container);
} }
}); });

3
couchpotato/static/scripts/couchpotato.js

@ -94,7 +94,10 @@
window.open(url); window.open(url);
else if(History.getPath() != url) else if(History.getPath() != url)
History.push(url); History.push(url);
} }
self.fireEvent('history.push');
}, },
isMac: function(){ isMac: function(){

35
couchpotato/static/style/combined.min.css

@ -343,28 +343,31 @@
.page.movie_details .releases .provider{min-width:110px;max-width:110px} .page.movie_details .releases .provider{min-width:110px;max-width:110px}
.page.movie_details .releases .provider:before{content:"Provider:"} .page.movie_details .releases .provider:before{content:"Provider:"}
.page.movie_details .releases .actions{min-width:80px;max-width:80px} .page.movie_details .releases .actions{min-width:80px;max-width:80px}
.page.movie_details .section_trailer.no_trailer{display:none} .page.movie_details .section_trailer.section_trailer{padding:0;background:#111;max-height:450px;overflow:hidden}
.page.movie_details .trailer_container{background:#000;position:relative;padding-bottom:56.25%;height:0;overflow:hidden;max-width:100%;cursor:pointer} .page.movie_details .section_trailer.section_trailer.no_trailer{display:none}
.page.movie_details .section_trailer.section_trailer .trailer_container{max-height:450px;position:relative;overflow:hidden;max-width:800px;margin:0 auto;cursor:pointer}
.page.movie_details .section_trailer.section_trailer .trailer_container .background{opacity:.3;background:center no-repeat;background-size:cover;position:relative;z-index:1;max-height:450px;padding-bottom:56.25%}
.alph_nav .menus .button,.alph_nav .menus .counter{line-height:80px;padding:0 10px} .alph_nav .menus .button,.alph_nav .menus .counter{line-height:80px;padding:0 10px}
.page.movie_details .trailer_container .background{opacity:.3;background:center no-repeat;background-size:cover;position:absolute;top:0;right:0;bottom:0;left:0;z-index:1} .page.movie_details .section_trailer.section_trailer .trailer_container .icon-play{opacity:.9;position:absolute;z-index:2;text-align:center;width:100%;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);will-change:opacity;transition:all 300ms;color:#FFF;font-size:110px}
.page.movie_details .trailer_container .icon-play{opacity:.9;position:absolute;z-index:2;text-align:center;width:100%;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);will-change:opacity;transition:all 300ms;color:#FFF;font-size:110px} @media (max-width:1024px){.page.movie_details .section_trailer.section_trailer .trailer_container .icon-play{font-size:55px}
@media (max-width:1024px){.page.movie_details .trailer_container .icon-play{font-size:55px}
} }
@media (max-width:480px){.page.movie_details .trailer_container .icon-play{font-size:31.43px} @media (max-width:480px){.page.movie_details .section_trailer.section_trailer{max-height:450px}
.page.movie_details .section_trailer.section_trailer .trailer_container{margin-bottom:10px}
.page.movie_details .section_trailer.section_trailer .trailer_container .icon-play{font-size:31.43px}
} }
.page.movie_details .trailer_container .icon-play span{transition:all 300ms;opacity:.9;position:absolute;font-size:1em;top:50%;left:50%;margin-left:55px;-webkit-transform:translateY(-54%);transform:translateY(-54%);will-change:opacity} .page.movie_details .section_trailer.section_trailer .trailer_container .icon-play span{transition:all 300ms;opacity:.9;position:absolute;font-size:1em;top:50%;left:50%;margin-left:55px;-webkit-transform:translateY(-54%);transform:translateY(-54%);will-change:opacity}
@media (max-width:1024px){.page.movie_details .trailer_container .icon-play span{margin-left:27.5px} @media (max-width:1024px){.page.movie_details .section_trailer.section_trailer .trailer_container .icon-play span{margin-left:27.5px}
} }
@media (max-width:480px){.page.movie_details .trailer_container .icon-play span{margin-left:15.71px} @media (max-width:480px){.page.movie_details .section_trailer.section_trailer .trailer_container .icon-play span{margin-left:15.71px}
} }
.page.movie_details .trailer_container .icon-play span:first-child{margin-left:-55px;-webkit-transform:translate(-100%,-54%);transform:translate(-100%,-54%)} .page.movie_details .section_trailer.section_trailer .trailer_container .icon-play span:first-child{margin-left:-55px;-webkit-transform:translate(-100%,-54%);transform:translate(-100%,-54%)}
@media (max-width:1024px){.page.movie_details .trailer_container .icon-play span:first-child{margin-left:-27.5px} @media (max-width:1024px){.page.movie_details .section_trailer.section_trailer .trailer_container .icon-play span:first-child{margin-left:-27.5px}
} }
@media (max-width:480px){.page.movie_details .trailer_container .icon-play span:first-child{margin-left:-15.71px} @media (max-width:480px){.page.movie_details .section_trailer.section_trailer .trailer_container .icon-play span:first-child{margin-left:-15.71px}
} }
.page.movie_details .trailer_container:hover{color:#ac0000} .page.movie_details .section_trailer.section_trailer .trailer_container:hover{color:#ac0000}
.page.movie_details .trailer_container:hover .icon-play,.page.movie_details .trailer_container:hover .icon-play span{opacity:1} .page.movie_details .section_trailer.section_trailer .trailer_container:hover .icon-play,.page.movie_details .section_trailer.section_trailer .trailer_container:hover .icon-play span{opacity:1}
.page.movie_details .trailer_container iframe{position:absolute;top:0;left:0;width:100%;height:100%;border:0} .page.movie_details .section_trailer.section_trailer .trailer_container iframe{position:absolute;width:100%;height:100%;border:0;top:0;left:0;max-height:450px;z-index:10}
.alph_nav{position:relative} .alph_nav{position:relative}
.alph_nav .mass_edit_form{display:-webkit-flex;display:-ms-flexbox;display:flex;background:#FFF;position:fixed;top:80px;right:0;left:132px;-webkit-flex-flow:row nowrap;-ms-flex-flow:row nowrap;flex-flow:row nowrap;-webkit-align-items:center;-ms-flex-align:center;align-items:center;will-change:max-height;transition:max-height 300ms cubic-bezier(.9,0,.1,1);max-height:0;overflow:hidden} .alph_nav .mass_edit_form{display:-webkit-flex;display:-ms-flexbox;display:flex;background:#FFF;position:fixed;top:80px;right:0;left:132px;-webkit-flex-flow:row nowrap;-ms-flex-flow:row nowrap;flex-flow:row nowrap;-webkit-align-items:center;-ms-flex-align:center;align-items:center;will-change:max-height;transition:max-height 300ms cubic-bezier(.9,0,.1,1);max-height:0;overflow:hidden}
.mass_editing .alph_nav .mass_edit_form{max-height:44px} .mass_editing .alph_nav .mass_edit_form{max-height:44px}
@ -640,7 +643,7 @@ body,html{font-size:14px;line-height:1.5;font-family:OpenSans,"Helvetica Neue",H
body{display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-flow:row nowrap;-ms-flex-flow:row nowrap;flex-flow:row nowrap} body{display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-flow:row nowrap;-ms-flex-flow:row nowrap;flex-flow:row nowrap}
a{position:relative;overflow:hidden;text-decoration:none;cursor:pointer;-webkit-tap-highlight-color:transparent} a{position:relative;overflow:hidden;text-decoration:none;cursor:pointer;-webkit-tap-highlight-color:transparent}
input,select,textarea{font-size:1em;font-weight:300;padding:6.67px;background:#FFF;border:1px solid #b7b7b7;border-radius:0} input,select,textarea{font-size:1em;font-weight:300;padding:6.67px;background:#FFF;border:1px solid #b7b7b7;border-radius:0}
input,textarea{-webkit-appearance:none} input[type=text],textarea{-webkit-appearance:none}
.button{color:#ac0000;font-weight:300;padding:5px;cursor:pointer;border:1px solid #ac0000;border-radius:3px;margin:0 5px;transition:all 150ms} .button{color:#ac0000;font-weight:300;padding:5px;cursor:pointer;border:1px solid #ac0000;border-radius:3px;margin:0 5px;transition:all 150ms}
.button:hover{background:#ac0000;color:#FFF} .button:hover{background:#ac0000;color:#FFF}
.ripple{position:absolute;height:10px;width:10px;border-radius:50%;background:#ac0000;-webkit-transform:translate(-50%,-50%) scale(1) rotateZ(360deg);transform:translate(-50%,-50%) scale(1) rotateZ(360deg);opacity:.2;transition:all 1.5s ease;transition-property:opacity,-webkit-transform;transition-property:opacity,transform} .ripple{position:absolute;height:10px;width:10px;border-radius:50%;background:#ac0000;-webkit-transform:translate(-50%,-50%) scale(1) rotateZ(360deg);transform:translate(-50%,-50%) scale(1) rotateZ(360deg);opacity:.2;transition:all 1.5s ease;transition-property:opacity,-webkit-transform;transition-property:opacity,transform}

2
couchpotato/static/style/main.scss

@ -43,7 +43,7 @@ input, textarea, select {
border-radius: 0; border-radius: 0;
} }
input, textarea { input[type=text], textarea {
-webkit-appearance: none; -webkit-appearance: none;
} }

Loading…
Cancel
Save