Browse Source

basic theme

master
dave 1 year ago
parent
commit
3932d5745b
9 changed files with 1548 additions and 141 deletions
  1. +1
    -1
      README.md
  2. +1381
    -0
      assets/styles.css
  3. +14
    -5
      mediaweb/__init__.py
  4. +9
    -0
      templates/html.html
  5. +50
    -35
      templates/index.html
  6. +13
    -2
      templates/moveform.html
  7. +19
    -49
      templates/page.html
  8. +50
    -49
      templates/sortform.html
  9. +11
    -0
      templates/splash.html

+ 1
- 1
README.md View File

@@ -92,4 +92,4 @@ todo
* more options than just hard linking (soft link, copy)
* support sorting season torrents
* make UI pretty
* support post-sort webhooks e.g. to tell plex to rescan when we add something
* support post-sort webhooks e.g. to tell plex to rescan when we add something - maybe push and email too

+ 1381
- 0
assets/styles.css
File diff suppressed because it is too large
View File


+ 14
- 5
mediaweb/__init__.py View File

@@ -139,6 +139,7 @@ class MediaWeb(object):
torrents=self.cache.torrents,
moves=self.cache.moves,
shows=self.cache.data.shows,
user=cherrypy.request.login,
**kwargs,
**self.get_default_vars())

@@ -146,11 +147,15 @@ class MediaWeb(object):
return {}

@cherrypy.expose
def index(self, action=None):
def index(self):
return self.render("splash.html")

@cherrypy.expose
def home(self, action=None):
if action:
if action == "update":
self.cache.refresh()
raise cherrypy.HTTPRedirect("/")
raise cherrypy.HTTPRedirect("/home")
return self.render("index.html", inflight=self.cache.inflight)

@cherrypy.expose
@@ -163,7 +168,7 @@ class MediaWeb(object):
otherdest or dest)
client.rpc.core.move_storage([thash], target)
self.cache.refresh()
raise cherrypy.HTTPRedirect("/")
raise cherrypy.HTTPRedirect("/home")

return self.render("moveform.html", torrent=torrent, tkey=tkey)

@@ -249,7 +254,7 @@ class MediaWeb(object):
else:
raise cherrypy.HTTPError(404)
self.cache.refresh()
raise cherrypy.HTTPRedirect("/")
raise cherrypy.HTTPRedirect("/home")


def get_fname(torrent):
@@ -332,7 +337,11 @@ def main():
web = MediaWeb(rpc_cache, tpl, options)
cherrypy.tree.mount(web, '/', {'/': {'tools.auth_basic.on': True,
'tools.auth_basic.realm': 'mediaweb',
'tools.auth_basic.checkpassword': validate_password, }})
'tools.auth_basic.checkpassword': validate_password, },
'/index': {'tools.auth_basic.on': False},
'/static': {'tools.auth_basic.on': False,
'tools.staticdir.on': True,
'tools.staticdir.dir': os.path.join(APPROOT, 'assets')}})

# General config options
cherrypy.config.update({


+ 9
- 0
templates/html.html View File

@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Media Sort</title>
<link type="text/css" rel="stylesheet" href="/static/styles.css" media="all" />
</head>
{% block body %}{% endblock %}
</html>

+ 50
- 35
templates/index.html View File

@@ -1,15 +1,25 @@
{% extends "page.html" %}

{% block toolbar %}
<form action="/" method="post">
<input name="action" type="submit" value="refresh">
{% if inflight %}update in progress...{% else %}<input name="action" type="submit" value="update">{% endif %}
</form>
<a class="nav-item is-active" href="/home">Home</a>
<a class="nav-item" href="/home">Refresh</a>
{% if inflight %}<span class="nav-item">Scanning in progress...</span>
{% else %}<a class="nav-item" href="/home?action=update">Rescan</a>{% endif %}
<a class="nav-item" href="/home">Blah</a>
<hr />
<a class="nav-item" href="/home">Blah</a>
<a class="nav-item" href="/home">Blah</a>
{% endblock %}

{% block body %}
<div class="torrents">
<h2>Completed</h2>
<form action="/autosort" method="post">
{% block main %}
<form action="/autosort" method="post">
<header class="flex items-center py1 border-bottom">
<h1 class="m0">Completed</h1>
{% if inflight %}<a class="btn ml-auto btn-primary rounded-left">Scanning...</a>
{% else %}<a href="/home?action=update" class="btn ml-auto btn-primary rounded-left">Rescan</a>{% endif %}
<input type="submit" value="Autosort selected" class="btn btn-danger rounded-right">
</header>
<section class="flex py2">
<table>
<tr>
<th></th>
@@ -24,8 +34,8 @@
<td><input type="checkbox" name="tkeys" value="{{ torid }}"{% if torid in moves %} checked="checked"{% else %} disabled="disabled"{% endif %}/></td>
<td>{{ torid[0:8] }}</td>
<td>
{{ tor.name }}<br />
<span class="small">{{ tor.save_path }}</span>
<span class="h3">{{ tor.name }}</span><br />
<span class="h6">{{ tor.save_path }}</span>
</td>
{% if torid in moves %}
<td>{{ moves[torid].dest.dir }}</td>
@@ -41,10 +51,12 @@
</tr>
{% endif %}{% endfor %}
</table>
<br/>
<input type="submit" value="Autosort selected">
</form>
<h2>Downloading</h2>
</section>
</form>
<header class="flex items-center py1 border-bottom">
<h1 class="m0">Downloading</h1>
</header>
<section class="flex mb3">
<table>
<tr>
<th>hash</th>
@@ -76,25 +88,28 @@
</tr>
{% endif %}{% endfor %}
</table>
<div class="libraryinfo">
<details>
<summary>Library information</summary>
<h2>Shows ({{ shows|len }})</h2>
<table>
<tr>
<th>name</th>
<th>path</th>
<th>sorting</th>
</tr>
{% for show in shows %}
<tr>
<td>{{ show.name }}</td>
<td>{{ show.dir }}</td>
<td>{{ show.mode }}</td>
</tr>
{% endfor %}
</table>
</details>
</div>
</div>
</section>
<header class="flex items-center py1 border-bottom">
<h1 class="m0">Library</h1>
</header>
<section class="flex mb3">
<details>
<summary>Library information</summary>
<h2>Shows ({{ shows|len }})</h2>
<table>
<tr>
<th>name</th>
<th>path</th>
<th>sorting</th>
</tr>
{% for show in shows %}
<tr>
<td>{{ show.name }}</td>
<td>{{ show.dir }}</td>
<td>{{ show.mode }}</td>
</tr>
{% endfor %}
</table>
</details>
</section>
{% endblock %}

+ 13
- 2
templates/moveform.html View File

@@ -1,11 +1,22 @@
{% extends "page.html" %}

{% block toolbar %}
<a href="/"><button type="button">Back</button></a>
<a class="nav-item is-active" href="/home">Back</a>
{% endblock %}

{% block body %}
{% block main %}
<div class="moveform">
<header class="flex items-center py1 border-bottom">
<h1 class="m0">Move <span class="font-size-smaller">{{ torrent.name }} - {{ torrent.hash }}</span></h1>
</header>
<section class="mb3">
<ul>
{% for f in torrent.files %}
<li>{{ f.path }} - {{ f.size }} B</li> <!-- TODO nice size formatting-->
{% endfor %}
</ul>
</section>

<h2>Move {{ torrent.name }} </h2>
<p>{{ torrent.hash }}</p>



+ 19
- 49
templates/page.html View File

@@ -1,52 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Media Sort</title>
<style>
html, body {
font-family: arial, sans-serif;
font-size: 12px;
}
#page {
margin: 0px auto;
padding: 0px 15px;
max-width: 1000px;
}
td {
padding: 3px 5px;
}
td {
border-bottom: 1px solid #666;
}
h2 {
margin-top: 30px;
}
table {
width: 100%;
}
span.small {
font-size: 10px;
color: #999;
}
.right {
float: right;
}
.libraryinfo {
margin-top: 30px;
}
details summary:hover {
cursor: pointer;
}
</style>
</head>
<body>
<div id="page">
<div class="toolbar">
{% block toolbar %}{% endblock %}
</div>
{% block body %}{% endblock %}
{% extends "html.html" %}

{% block body %}
<body class="flex v100 items-stretch white bg-black">
<nav class="p2 overflow-scroll bg-darken-4" style="width:256px">
<h1 class="m0">msort</h1>
<p class="mt0 gray">media librarian</p>
{% block toolbar %}{% endblock %}
</nav>
<div class="flex-auto flex flex-column">
<header class="flex items-center x1 bg-darken-2">
<h3 class="h3 m0 px2">{{ user }}</h3>
<a href="/" class="nav-item ml-auto">Sign Out</a>
</header>
<main class="flex-auto p3">
{% block main %}{% endblock %}
<hr />
</main>
</div>
<a name="bottom" />
</body>
</html>
{% endblock %}

+ 50
- 49
templates/sortform.html View File

@@ -1,55 +1,56 @@
{% extends "page.html" %}
{% block toolbar %}
<a href="/"><button type="button">Back</button></a>
<a class="nav-item is-active" href="/home">Back</a>
{% endblock %}

{% block body %}
<div class="sortform">
<h2>Sort {{ torrent.name }} </h2>
<p>{{ torrent.hash }}</p>

<fieldset>
<legend>files</legend>
<ul>
{% for f in torrent.files %}
<li>{{ f.path }} - {{ f.size }} B</li> <!-- TODO nice size formatting-->
{% endfor %}
</ul>
</fieldset>

<br/>

<form action="/sort" method="post">
<input type="hidden" name="tkey" value="{{ tkey }}">
<fieldset>
<legend>destination</legend>
<table>
<tr>
<th></th>
<th>show</th>
<th>season</th>
<th>library</th>
<th>score</th>
</tr>
{% for row in matches %}
<tr>
<td>
<input type="radio" name="dest" value="{{row.dest.dir}}" {% if loop.index == 1 %}checked="checked"{%endif %}/>
</td>
<td>{{ row.dest.dir }}</td>
<td>{{ row.subdest }}</td>
<td>{{ row.dest.root }}</td>
<td>{{ row.score }}</td>
</tr>
{% block main %}
<form action="/sort" method="post">
<div class="col col-12 lg-col-6">
<header class="flex items-center py1 border-bottom">
<h1 class="m0">Files <span class="font-size-smaller">{{ torrent.name }} - {{ torrent.hash }}</span></h1>
</header>
<section class="mb3">
<ul>
{% for f in torrent.files %}
<li>{{ f.path }} - {{ f.size }} B</li> <!-- TODO nice size formatting-->
{% endfor %}
</table>
<br />
<input type="submit" value="Sort">
<div class="right">
{% if score > 0 %}<a href="/sort?tkey={{ tkey }}&score={{ score // 2 }}#bottom">show more (S={{ score }}%)</a>{% endif %}
{{ matches|len }}
</div>
</fieldset>
</form>
</div>
</ul>
</section>
</div>
<div class="col col-12 lg-col-6">
<header class="flex items-center py1 border-bottom">
<h1 class="m0">Destination</h1>
<input type="submit" value="Save" class="btn btn-danger ml-auto rounded">
</header>
<section class="mb3">

<input type="hidden" name="tkey" value="{{ tkey }}">
<table>
<tr>
<th></th>
<th>show</th>
<th>season</th>
<th>library</th>
<th>score</th>
</tr>
{% for row in matches %}
<tr>
<td>
<input type="radio" name="dest" value="{{row.dest.dir}}" {% if loop.index == 1 %}checked="checked"{%endif %}/>
</td>
<td>{{ row.dest.dir }}</td>
<td>{{ row.subdest }}</td>
<td>{{ row.dest.root }}</td>
<td>{{ row.score }}</td>
</tr>
{% endfor %}
</table>
<br />
<div class="right">
{% if score > 0 %}<a href="/sort?tkey={{ tkey }}&score={{ score // 2 }}#bottom">show more (S={{ score }}%)</a>{% endif %}
{{ matches|len }}
</div>
</section>
</div>
</form>
{% endblock %}

+ 11
- 0
templates/splash.html View File

@@ -0,0 +1,11 @@
{% extends "html.html" %}

{% block body %}
<body class="flex items-center justify-center v100 white bg-black">
<div class="bg-darken-4 py3 px4 center">
<h1 class="m0">MediaSort</h1>
Unauthenticated &middot; <a href="/home">Login</a>
</div>
<a name="bottom" />
</body>
{% endblock %}

Loading…
Cancel
Save