Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge remote-tracking branch 'upstream/master' into mobile-search

  • Loading branch information...
commit 2050c915ace2a4ef3d3dc7d36178df2236d975b7 2 parents b77a441 + 64f0576
@gugahoi gugahoi authored
View
23 mobile.py
@@ -8,7 +8,6 @@
from maraschino.tools import *
from maraschino.noneditable import *
-import maraschino
global sabnzbd_history_slots
sabnzbd_history_slots = None
@@ -74,8 +73,11 @@ def recently_added_albums():
@app.route('/mobile/xbmc/')
@requires_auth
def xbmc():
+ servers = XbmcServer.query.order_by(XbmcServer.position)
+ active_server = int(get_setting_value('active_server'))
return render_template('mobile/xbmc/xbmc.html',
- webroot=maraschino.WEBROOT,
+ servers=servers,
+ active_server=active_server,
)
@@ -91,7 +93,6 @@ def movie_library():
return render_template('mobile/xbmc/movie_library.html',
movies=movies,
- webroot=maraschino.WEBROOT,
)
@@ -107,7 +108,6 @@ def tv_library():
return render_template('mobile/xbmc/tv_library.html',
TV=TV,
- webroot=maraschino.WEBROOT,
)
@@ -123,7 +123,6 @@ def tvshow(id):
return render_template('mobile/xbmc/tvshow.html',
show=show,
- webroot=maraschino.WEBROOT,
)
@@ -140,7 +139,6 @@ def season(id, season):
return render_template('mobile/xbmc/season.html',
season=season,
episodes=episodes,
- webroot=maraschino.WEBROOT,
)
from modules.sickbeard import sickbeard_api, get_pic
@@ -165,7 +163,6 @@ def sickbeard():
return render_template('mobile/sickbeard/coming_episodes.html',
coming_episodes=sickbeard,
- webroot=maraschino.WEBROOT,
)
@@ -188,7 +185,6 @@ def sickbeard_all():
return render_template('mobile/sickbeard/all.html',
shows=sickbeard,
- webroot=maraschino.WEBROOT,
)
@@ -208,7 +204,6 @@ def sickbeard_history():
return render_template('mobile/sickbeard/history.html',
history=sickbeard,
- webroot=maraschino.WEBROOT,
)
@@ -230,7 +225,6 @@ def sickbeard_show(id):
return render_template('mobile/sickbeard/show.html',
show=sickbeard,
- webroot=maraschino.WEBROOT,
)
@@ -278,7 +272,6 @@ def sickbeard_episode(id, season, episode):
episode_number=episode,
episode=sickbeard,
id=id,
- webroot=maraschino.WEBROOT,
)
@@ -290,7 +283,6 @@ def sickbeard_episode_options(id, season, episode):
season_number=season,
episode_number=episode,
show_number=id,
- webroot=maraschino.WEBROOT,
)
@@ -310,7 +302,6 @@ def sickbeard_search(query=None):
return render_template('mobile/sickbeard/search.html',
results=sickbeard,
query=query,
- webroot=maraschino.WEBROOT,
)
@@ -331,7 +322,6 @@ def couchpotato():
return render_template('mobile/couchpotato/wanted.html',
wanted=couchpotato,
- webroot=maraschino.WEBROOT,
)
@@ -349,7 +339,6 @@ def couchpotato_all():
return render_template('mobile/couchpotato/all.html',
all=couchpotato,
- webroot=maraschino.WEBROOT,
)
@@ -358,7 +347,7 @@ def couchpotato_all():
def couchpotato_history():
unread = 0
try:
- couchpotato = couchpotato_api('notification.list', params='limit_offset=50')
+ couchpotato = couchpotato_api('notification.list')
if couchpotato['success'] and not couchpotato['empty']:
couchpotato = couchpotato['notifications']
for notification in couchpotato:
@@ -372,7 +361,6 @@ def couchpotato_history():
return render_template('mobile/couchpotato/history.html',
history=couchpotato,
unread=unread,
- webroot=maraschino.WEBROOT,
)
@@ -407,7 +395,6 @@ def couchpotato_search(query=None):
return render_template('mobile/couchpotato/search.html',
results=couchpotato,
query=query,
- webroot=maraschino.WEBROOT,
)
from modules.headphones import *
View
17 modules/couchpotato.py
@@ -421,10 +421,25 @@ def cp_notification_read(id):
try:
logger.log('CouchPotato :: Marking notification "%i" as read' % id, 'INFO')
result = couchpotato_api('notification.markread', 'ids=%i' % id)
- print result
return jsonify({'success': True})
except Exception as e:
log_exception(e)
return jsonify({'success': False})
+
+
+@app.route('/xhr/couchpotato/release/<action>/<id>/')
+@requires_auth
+def release_action(action, id):
+ if id.isdigit():
+ id = int(id)
+
+ try:
+ logger.log('CouchPotato :: %sing release %s' % (action.title()[:-1], id), 'INFO')
+ result = couchpotato_api('release.%s' % action, 'id=%s' % id)
+ return jsonify(result)
+ except Exception as e:
+ log_exception(e)
+
+ return jsonify({'success': False})
View
BIN  static/images/download.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
43 static/js/index.js
@@ -1530,15 +1530,52 @@ $(document).ready(function() {
var el = $('#'+id);
el.toggleClass('selected');
if(el.hasClass('selected')){
- el.transition({x: '30px', opacity: 0.7}, function(){
- $('#couchpotato #cp_content .options&.'+id).transition({opacity: 1});
- });
+ if ($(this).parent().hasClass('releases')) {
+ var x_move = $('#couchpotato').width() - ($(this).width() * 1.55);
+ var ul_width = x_move - 40;
+ x_move = x_move + 'px';
+ ul_width = ul_width + 'px';
+ $('#couchpotato .release_list').css('width', ul_width);
+
+ el.transition({x: x_move, opacity: 0.7}, function(){
+ $('#couchpotato #cp_content .options&.'+id).transition({opacity: 1});
+ });
+ }
+ else {
+ el.transition({x: '30px', opacity: 0.7}, function(){
+ $('#couchpotato #cp_content .options&.'+id).transition({opacity: 1});
+ });
+ }
} else {
$('#couchpotato #cp_content .options&.'+id).transition({opacity: 0}, function(){
el.transition({opacity: 1, x: '0px'});
});
}
});
+ // release action (download, remove, ignore)
+ $(document).on('click', '#couchpotato .release_list .release_btn', function() {
+ var id = $(this).parent().data('id');
+ var el = $(this);
+ var action = el.data('action');
+ el.attr('src', WEBROOT + '/static/images/xhrloading.gif');
+
+ $.get(WEBROOT+'/xhr/couchpotato/release/'+action+'/'+id, function(data) {
+ if(data.success) {
+ if(action === 'delete') {
+ el.parent().transition({opacity: 0, duration: 1000}, function(){
+ el.parent().remove();
+ });
+ } else {
+ popup_message('Successfully sent download request');
+ $.get(WEBROOT+'/xhr/couchpotato/', function(data) {
+ $('#couchpotato').replaceWith(data);
+ });
+ }
+ } else {
+ popup_message('Failed to '+action+' release, see log for more datials');
+ }
+ });
+ });
// wanted delete, info delete
$(document).on('click', '#couchpotato #cp_content .options img.delete, #couchpotato #info .options img.delete', function(selector) {
var id = $(this).parent().data('cpid');
View
14 static/js/mobile/mobile.js
@@ -55,6 +55,16 @@ $(document).ready(function () {
});
});
+ $(document).on('change', '#servers select', function() {
+ var selected = $('#'+ $(this).val() + '_server');
+ $.get(WEBROOT + '/xhr/switch_server/' + selected.data('id'), function(data) {
+ if (data.status === 'error') {
+ popup_message('There was an error switching XBMC servers.');
+ return;
+ }
+ });
+
+ });
///////////////////
// CouchPotato //
@@ -63,11 +73,13 @@ $(document).ready(function () {
// notification read click
$(document).on('click', '#couchpotato li#notification.new', function() {
+ $(this).removeClass('ui-body-e').removeClass('new').addClass('ui-body-c');
$.get(WEBROOT + '/xhr/couchpotato/notification/read/' + $(this).data('id'), function(data) {
if(data.success){
- $(this).attr('data-theme', 'c').removeClass('ui-body-e').addClass('ui-body-c');
+ $(this).attr('data-theme', 'c');
$('#unread').text($('#unread').text()-1);
} else {
+ $(this).addClass('ui-body-e').addClass('new').removeClass('ui-body-c');
popup_message('Failed to mark notification as read');
}
});
View
39 static/less/mobile/mobile.less
@@ -40,6 +40,13 @@
}
}
+ #servers {
+ display: block;
+ position: absolute;
+ left: 10px;
+ top: 5px;
+ }
+
#header_controls {
.icon {
display: block;
@@ -211,21 +218,21 @@
}
}
-ul li a.badge span.ui-li-count {
+ul li a.badge span.ui-li-count {
// setup
- color: #ffffff;
- font-size: 90%;
- text-shadow: none;
- font-weight: bold;
- font-family: arial;
+ color: #ffffff;
+ font-size: 90%;
+ text-shadow: none;
+ font-weight: bold;
+ font-family: arial;
// shadow
- -moz-box-shadow: 0 1px 2px #999;
- -webkit-box-shadow: 0 1px 2px #999;
- box-shadow: 0 1px 2px #999;
+ -moz-box-shadow: 0 1px 2px #999;
+ -webkit-box-shadow: 0 1px 2px #999;
+ box-shadow: 0 1px 2px #999;
padding-bottom: 1px;
// border
- border: 1px solid #ffffff;
- .border-radius (5px);
+ border: 1px solid #ffffff;
+ .border-radius (5px);
padding: 3px;
background-color: red;
margin-right: -15px;
@@ -257,8 +264,8 @@ ul li a.badge span.ui-li-count {
font-weight: bold;
color: #fff;
text-shadow: 0 -1px 1px #000;
- background-image: -moz-linear-gradient(top,
- #D47272,
+ background-image: -moz-linear-gradient(top,
+ #D47272,
#B64B4B);
background-image: -webkit-gradient(linear,left top,left bottom,
color-stop(0, #D47272),
@@ -293,7 +300,7 @@ ul li a.badge span.ui-li-count {
/* END RED BUTTON THEME FOR JQUERY MOBILE */
/* PROGRESS BARS */
-.meter {
+.meter {
height: 30px;
position: relative;
background: #999;
@@ -333,10 +340,10 @@ ul li a.badge span.ui-li-count {
rgb(43,194,83) 37%,
rgb(84,240,84) 69%
);
- -webkit-box-shadow:
+ -webkit-box-shadow:
inset 0 2px 9px rgba(255,255,255,0.3),
inset 0 -2px 6px rgba(0,0,0,0.4);
- -moz-box-shadow:
+ -moz-box-shadow:
inset 0 2px 9px rgba(255,255,255,0.3),
inset 0 -2px 6px rgba(0,0,0,0.4);
position: relative;
View
77 static/less/module-couchpotato.less
@@ -108,12 +108,15 @@
padding: 6px;
overflow: hidden;
position: relative;
- z-index: 10;
.border-radius(4px);
&:hover {
background: url('/@{webroot}/images/alpha/fff_20.png');
}
+
+ &.releases {
+ background: url('/@{webroot}/images/alpha/lightblue_30.png');
+ }
div.active {
background: url('/@{webroot}/images/snatched-banner.png') no-repeat;
@@ -130,11 +133,11 @@
padding-right: 5px;
position: relative;
cursor: pointer;
-
+
img.poster {
height: 100%;
}
-
+
span.profile {
position: absolute;
bottom: 0;
@@ -145,7 +148,7 @@
background: rgba(0, 0, 0, 0.8);
}
}
-
+
span {
display: block;
padding-bottom: 5px;
@@ -154,6 +157,7 @@
}
}
}
+
div.options {
opacity: 0;
-moz-opacity: 0;
@@ -166,7 +170,60 @@
float: left;
z-index: 1;
- img {
+ .release_list {
+ position: absolute;
+ top: -5px;
+ left: 30px;
+
+ ul {
+ max-height: 60px;
+ overflow-y: auto;
+ padding: 3px;
+
+ li {
+ position: relative;
+ background: url('/@{webroot}/images/alpha/fff_10.png');
+ line-height: 20px;
+ padding: 4px;
+ margin: 2px;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ cursor: pointer;
+ padding-right: 45px;
+ .border-radius(3px);
+
+ img {
+ position: absolute;
+ height: 15px;
+ width: 15px;
+ top: 4px;
+ padding: 2px;
+ cursor: pointer;
+ background: url('/@{webroot}/images/alpha/fff_10.png');
+
+ .border-radius(4px);
+ &:hover{
+ background: url('/@{webroot}/images/alpha/fff_20.png');
+ }
+
+ &#download {
+ right: 25px;
+ }
+
+ &#delete {
+ right: 4px;
+ }
+ }
+
+ &:hover {
+ background: url('/@{webroot}/images/alpha/fff_20.png');
+ }
+ }
+ }
+ }
+
+ img.left_opt {
display: block;
height: 15px;
width: 15px;
@@ -185,7 +242,7 @@
#all {
max-height: 264px;
overflow-x: hidden;
-
+
.movie {
background: url('/@{webroot}/images/alpha/fff_10.png');
cursor: pointer;
@@ -201,7 +258,7 @@
&:hover {
background: url('/@{webroot}/images/alpha/fff_20.png');
}
-
+
div.active {
background: url('/@{webroot}/images/snatched-banner.png') no-repeat;
width: 55px;
@@ -210,7 +267,7 @@
top: 0;
right: 0;
}
-
+
img.poster {
float: left;
height: 100%;
@@ -218,7 +275,7 @@
position: relative;
cursor: pointer;
}
-
+
span.text {
display: inline;
line-height:30px;
@@ -385,4 +442,4 @@
margin-left: 15px;
}
}
-}
+}
View
4 static/less/module-sabnzbd.less
@@ -38,10 +38,12 @@
li {
padding-left: 5px;
padding-right: 5px;
+ cursor: default;
.border-radius(3px);
- &:hover {
+ &.pause_time:hover,&.pause_for:hover {
background: url('/@{webroot}/images/alpha/fff_20.png');
+ cursor: pointer;
}
}
}
View
37 templates/couchpotato.html
@@ -4,7 +4,7 @@
<div id="cp_content" {% if compact_view %}class="compact"{%endif%}>
{% for item in couchpotato %}
- <div class="movie" id="{{item.library.identifier}}" data-cpid="{{item.id}}">
+ <div class="movie {{ 'releases' if item.releases }}" id="{{item.library.identifier}}" data-cpid="{{item.id}}">
<div class="{{item.releases.status}}"></div>
{% if not compact_view %}
<div class="image">
@@ -25,11 +25,40 @@
{%if compact_view %}<span class="quality">{{item.profile.label}}</span>{%endif%}
</div>
<div class="options {{item.library.identifier}}" data-imdbid="{{item.library.identifier}}" data-cpid="{{item.library_id}}">
- <img class="delete" src="{{ url_for('static', filename='images/no.png')}}"/>
- <img class="search" src="{{ url_for('static', filename='images/search.png')}}"/>
+ <img class="delete left_opt" src="{{ url_for('static', filename='images/no.png')}}"/>
+ <img class="search left_opt" src="{{ url_for('static', filename='images/search.png')}}"/>
<a href="http://imdb.com/title/{{item.library.identifier}}" target="_blank">
- <img src="{{ url_for('static', filename='images/imdb.png')}}" alt="" />
+ <img class="left_opt" src="{{ url_for('static', filename='images/imdb.png')}}" alt="" />
</a>
+ {% if item.releases %}
+ <div class="release_list">
+ <ul>
+ {% for release in item.releases %}
+ <li
+ data-id="{{ release.id }}"
+ data-imdbid="{{item.library.identifier}}"
+ title="Provider: {{ release.info.provider }}&#13;Size: {{ release.info.size }}MB"
+ >
+ <a href="{{ release.info.detail_url }}" target="_blank">
+ {{release.info.name}}
+ </a>
+ <img
+ id="download"
+ class="release_btn"
+ src="{{ url_for('static', filename='images/download.png') }}"
+ data-action="download"
+ />
+ <img
+ id="delete"
+ class="release_btn"
+ src="{{ url_for('static', filename='images/no.png') }}"
+ data-action="delete"
+ />
+ </li>
+ {% endfor %}
+ </ul>
+ </div>
+ {% endif %}
</div>
{% endfor %}
</div>
View
2  templates/mobile/base.html
@@ -52,7 +52,7 @@
{% block header %}<h1>Maraschino</h1>{% endblock %}
- <a class="logo" href="{{ url_for('mobile_index') }}" data-ajax="false">
+ <a class="logo" href="{{ url_for('mobile_index') }}" data-direction="reverse" data-transition="slide">
<img src="{{ url_for('static', filename='images/mobile/maraschino_logo.png') }}" alt="Maraschino logo">
</a>
View
2  templates/mobile/couchpotato/history.html
@@ -18,7 +18,7 @@
{% block content %}
<ul id="couchpotato" data-role="listview" data-filter="true">
- {% for notification in history %}
+ {% for notification in history|reverse %}
<li id="notification" {% if not notification.read %}data-theme="e" class="new"{% endif %} data-id="{{notification.id}}">
<h2>{{ notification.message }})</h2>
</li>
View
19 templates/mobile/xbmc/xbmc.html
@@ -1,18 +1,32 @@
{% extends "mobile/base.html" %}
+{% block left_button %}
+{% if servers %}
+<div id="servers">
+ <select data-native-menu="false" data-theme="c">
+ <option>Servers</option>
+ {% for server in servers %}
+ <option id="{{ server.label }}_server" data-id="{{ server.id }}" {{ 'selected' if server.id == active_server }}>{{ server.label }}</option>
+ {% endfor %}
+ </select>
+</div>
+{% endif %}
+{% endblock %}
+
+
{% block header %}<h1>XBMC</h1>{% endblock %}
{% block navbar %}
<div data-role="navbar">
<ul id="header_controls">
- <li><a class="control stop" data-command="stop" href="#"><span class="icon">Stop</span></a></li>
+ <li><a class=
+ "control stop" data-command="stop" href="#"><span class="icon">Stop</span></a></li>
<li><a class="control play_pause" data-command="play_pause" href="#"><span class="icon">Play / Pause</span></a></li>
</ul>
</div>
{% endblock %}
{% block content %}
-
<ul data-role="listview">
<li><a href="{{ url_for('recently_added_episodes') }}">Recently added episodes</a></li>
<li><a href="{{ url_for('recently_added_movies') }}">Recently added movies</a></li>
@@ -20,5 +34,4 @@
<li><a href="{{ url_for('movie_library') }}">Movies</a></li>
<li><a href="{{ url_for('tv_library') }}">TV Shows</a></li>
</ul>
-
{% endblock %}
View
17 templates/sabnzbd-queue.html
@@ -5,13 +5,14 @@
{{ sabnzbd.status }}
<img class="pause_arrow" src="{{ url_for('static', filename='images/arrow_down.png') }}">
<ul class="pause_list">
- <li class="pause_time" data-time="5">Pause for 5 minutes</li>
- <li class="pause_time" data-time="15">Pause for 15 minutes</li>
- <li class="pause_time" data-time="30">Pause for 30 minutes</li>
- <li class="pause_time" data-time="60">Pause for 1 hour</li>
- <li class="pause_time" data-time="180">Pause for 3 hours</li>
- <li class="pause_time" data-time="360">Pause for 6 hours</li>
- <li class="pause_for">Pause for...</li>
+ <li>Pause for: </li>
+ <li class="pause_time" data-time="5">5 minutes</li>
+ <li class="pause_time" data-time="15">15 minutes</li>
+ <li class="pause_time" data-time="30">30 minutes</li>
+ <li class="pause_time" data-time="60">1 hour</li>
+ <li class="pause_time" data-time="180">3 hours</li>
+ <li class="pause_time" data-time="360">6 hours</li>
+ <li class="pause_for">Other...</li>
</ul>
</div>
<div class="speed"><input type="text" value="{{ download_speed[:-4] }}" title="Adjust Speed" size="5"/>{{ download_speed[-4:] }}</div>
@@ -33,7 +34,7 @@
<table width=100%>
<tr>
<td align=left><b>Total Remaining:</b> {{sabnzbd.timeleft}} / {{sabnzbd.sizeleft}}</td>
- <td align=right><span>
+ <td align=right><span>
{% if queue_status == 'hide' %} <img src="{{ url_for('static', filename='images/arrow_down.png')}}">More
{% else %} <img src="{{ url_for('static', filename='images/arrow_up.png') }}">Less
{% endif %}
Please sign in to comment.
Something went wrong with that request. Please try again.