summaryrefslogtreecommitdiff
path: root/app/templates/home.html
blob: a71a0d4567c71e22abbfc9196a5ae2ae30f40a81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
{# -*- mode: web; -*- #}

{% extends "base.html" %}

{% block title %}
{% if current_user.is_authenticated %}
Welcome, {{ user.name_first }} {{ user.name_last }}!
{% else %}
Welcome to <code>mdl</code>, the music downloader
{% endif %}
{% endblock %}

{% block content %}
{% if current_user.is_authenticated %}
<div id="downloads">
    <div id="download-new">
	<h2>New</h2>
	<form action="{{ url_for('main.download_remote') }}" method="POST">
	    <fieldset>
		<legend>Download audio from a URL to the server.</legend>
		{% with form = form_download_remote %}
		{{ form.csrf_token }}
		{{ form.url.label() }}
		{{ form.url() }}
		{{ form.download_remote() }}
		{% endwith %}
	    </fieldset>
	</form>
    </div>
    {% if pending_files %}
    <div id="download-pending">
	<h2>Pending</h2>
	{% for file in pending_files %}
	<form action="#" method="POST">
	    <fieldset>
		<legend>{{ file }}</legend>
	    </fieldset>
	</form>
	{% endfor %}
    </div>
    {% endif %}
    {% if downloaded_files %}
    <div id="download-finished">
	<h2>Finished</h2>
	{% for file in downloaded_files %}
	<form action="{{ url_for('main.manage_remote') }}" method="POST">
	    <fieldset>
		<legend>{{ file }}</legend>
		{% with form = form_manage_remote %}
		{{ form.csrf_token }}
		{{ form.file_name(value=file) }}
		{{ form.download_local() }}
		{{ form.remove_remote() }}
		{% endwith %}
	    </fieldset>
	</form>
	{% endfor %}
    </div>
    {% endif %}
</div>
<h2>Download history</h2>
<table>
    <thead>
	<tr>
	    <th>ID</th>
	    <th>Title</th>
	    <th>Downloaded</th>
	    <th>User</th>
	</tr>
    </thead>
    <tbody>
	{% for file in download_history %}
	<tr>
	    <td>{{ file.primary_key }}</td>
	    <td><a href="{{ file.url }}">{{ file.title }}</a></td>
	    <td>{{ file.date_time_downloaded }}</td>
	    <td>{{ file.user.username }}</td>
	</tr>
	{% endfor %}
    </tbody>
</table>
{% else %}
<p>You need to be logged in before using this web app.</p>
{% endif %}

{% endblock %}
Copyright 2019--2024 Marius PETER