Skip to content

Commit

Permalink
Readded mobile interface
Browse files Browse the repository at this point in the history
  • Loading branch information
gugahoi committed Apr 29, 2014
1 parent 83227e0 commit 339cf31
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
1 change: 1 addition & 0 deletions Maraschino.py
Expand Up @@ -63,6 +63,7 @@ def import_modules():
import modules.updater
import modules.utorrent
import modules.weather
import mobile


@app.teardown_request
Expand Down
15 changes: 9 additions & 6 deletions mobile.py
@@ -1,13 +1,11 @@
# -*- coding: utf-8 -*-
"""Ressources to use Maraschino on mobile devices"""

import jsonrpclib

from flask import render_template
from maraschino import app, logger

from maraschino.tools import *
from maraschino.noneditable import *
from maraschino.models import Module, PlexServer

global sabnzbd_history_slots
sabnzbd_history_slots = None
Expand All @@ -16,9 +14,14 @@
@app.route('/mobile/')
@requires_auth
def mobile_index():
plex = True
available_modules = Module.query.order_by(Module.position)
servers = PlexServer.query.order_by(PlexServer.id)
if servers.count() == 0:
plex = False

return render_template('mobile/index.html',
plex=plex,
available_modules=available_modules,
search=get_setting_value('search') == '1',
)
Expand Down Expand Up @@ -771,8 +774,8 @@ def start_script(script_id):
file_ext = os.path.splitext(script.script)[1]

if (file_ext == '.py'):
if (script.updates == 1):
#these are extra parameters to be passed to any scripts ran, so they
if (script.updates == 1):
#these are extra parameters to be passed to any scripts ran, so they
#can update the status if necessary
extras = '--i "%s" --p "%s" --s "%s" --w "%s"' % (host, port, script.id, webroot)

Expand Down Expand Up @@ -807,4 +810,4 @@ def start_script(script_id):
db_session.add(script)
db_session.commit()

return script_launcher()
return script_launcher()
4 changes: 2 additions & 2 deletions templates/mobile/index.html
Expand Up @@ -3,8 +3,8 @@
{% block content %}

<ul data-role="listview">
{% if xbmc %}<li><a href="{{ url_for('xbmc') }}">XBMC</a></li>{% endif %}

<!-- {% if plex %}<li><a href="{{ url_for('plex') }}">Plex</a></li>{% endif %}
-->
{% for module in available_modules %}
{% if 'sickbeard' in module.name %}<li><a href="{{ url_for('sickbeard') }}">Sickbeard</a></li>{% endif %}
{% if 'couchpotato' in module.name %}<li><a href="{{ url_for('couchpotato') }}">CouchPotato</a></li>{% endif %}
Expand Down

0 comments on commit 339cf31

Please sign in to comment.