This commit is contained in:
dave 2019-08-17 15:09:32 -07:00
parent e6ea486b56
commit 4a28090c76
4 changed files with 26 additions and 12 deletions

View File

@ -48,4 +48,5 @@ todo
* more options than just hard linking (soft link, copy)
* support sorting season torrents
* support multiple deluge instances - need a pathmap per instance
* make UI pretty
* make UI pretty
* support post-sort webhooks e.g. to tell plex to rescan when we add something

View File

@ -181,7 +181,7 @@ class MediaWeb(object):
self.execute_move(torrent, self.rpc.data.moves[thash])
self.rpc.refresh()
# TODO summary display
# TODO summary display of results
return f"autosorted: {repr(torrents)}"
@ -204,6 +204,10 @@ def get_mapped_stashdir(mapping, trackers):
return urlparse(tracker["url"]).hostname.lower() if tracker else "other"
def tsortbyname(dict_items):
return sorted(dict_items, key=lambda x: x[1]["name"].lower())
def main():
import argparse
import signal
@ -243,8 +247,7 @@ def main():
tpl_dir = os.path.join(APPROOT, "templates")
tpl = Environment(loader=FileSystemLoader(tpl_dir),
autoescape=select_autoescape(['html', 'xml']))
# self.tpl.filters.update(basename=os.path.basename,
# ceil=math.ceil
tpl.filters.update(tsortbyname=tsortbyname)
def validate_password(realm, user, passw):
return user == passw # lol

View File

@ -15,18 +15,18 @@
<th></th>
<th>hash</th>
<th>name</th>
<th>path</th>
<th>show</th>
<th>season</th>
<th>status</th>
<th>actions</th>
</tr>
{% for torid, tor in torrents.items() %}{% if tor.is_finished %}
{% for torid, tor in torrents.items()|tsortbyname %}{% if tor.is_finished %}
<tr>
<td><input type="checkbox" name="torrents" value="{{ torid }}"{% if torid in moves %} checked="checked"{% endif %}></td>
<td>{{ torid[0:6] }}</td>
<td>{{ tor.name }}</td>
<td>{{ tor.save_path }}</td>
<td>
{{ tor.name }}<br />
<span class="small">{{ tor.save_path }}</span>
</td>
{% if torid in moves %}
<td>{{ moves[torid].dest.dir }}</td>
<td>{{moves[torid].subdest}}</td>
@ -34,7 +34,6 @@
<td>?</td>
<td>?</td>
{% endif %}
<td>{{ "complete" if tor.is_finished else "pending" }}</td>
<td>
<a href="/move?thash={{ torid }}"><button type="button">Move</button></a>
<a href="/sort?thash={{ torid }}"><button type="button">Sort</button></a>
@ -42,7 +41,8 @@
</tr>
{% endif %}{% endfor %}
</table>
<input type="submit" value="Sort selected">
<br/>
<input type="submit" value="Autosort selected">
</form>
<h2>Downloading</h2>
<table>
@ -53,7 +53,7 @@
<th>progress</th>
<th>actions</th>
</tr>
{% for torid, tor in torrents.items() %}{% if not tor.is_finished %}
{% for torid, tor in torrents.items()|tsortbyname %}{% if not tor.is_finished %}
<tr>
<td>{{ torid[0:6] }}</td>
<td>{{ tor.name }}</td>

View File

@ -19,6 +19,16 @@
td {
border-bottom: 1px solid #666;
}
h2 {
margin-top: 30px;
}
table {
width: 100%;
}
span.small {
font-size: 10px;
color: #999;
}
</style>
</head>
<body>