View raw

1 {# -*- mode: web; -*- #} 2 3 {% extends "base.html" %} 4 5 {% block title %} 6 {% if current_user.is_authenticated %} 7 Welcome, {{ user.name_first }} {{ user.name_last }}! 8 {% else %} 9 Welcome to <code>mdl</code>, the music downloader 10 {% endif %} 11 {% endblock %} 12 13 {% block content %} 14 {% if current_user.is_authenticated %} 15 <div id="downloads"> 16 <div id="download-new"> 17 <h2>New</h2> 18 <form action="{{ url_for('main.download_remote') }}" method="POST"> 19 <fieldset> 20 <legend>Download audio from a URL to the server.</legend> 21 {% with form = form_download_remote %} 22 {{ form.csrf_token }} 23 {{ form.url.label() }} 24 {{ form.url() }} 25 {{ form.download_remote() }} 26 {% endwith %} 27 </fieldset> 28 </form> 29 </div> 30 {% if pending_files %} 31 <div id="download-pending"> 32 <h2>Pending</h2> 33 {% for file in pending_files %} 34 <form action="#" method="POST"> 35 <fieldset> 36 <legend>{{ file }}</legend> 37 </fieldset> 38 </form> 39 {% endfor %} 40 </div> 41 {% endif %} 42 {% if downloaded_files %} 43 <div id="download-finished"> 44 <h2>Finished</h2> 45 {% for file in downloaded_files %} 46 <form action="{{ url_for('main.manage_remote') }}" method="POST"> 47 <fieldset> 48 <legend>{{ file }}</legend> 49 {% with form = form_manage_remote %} 50 {{ form.csrf_token }} 51 {{ form.file_name(value=file) }} 52 {{ form.download_local() }} 53 {{ form.remove_remote() }} 54 {% endwith %} 55 </fieldset> 56 </form> 57 {% endfor %} 58 </div> 59 {% endif %} 60 </div> 61 <h2>Download history</h2> 62 <table> 63 <thead> 64 <tr> 65 <th>ID</th> 66 <th>Title</th> 67 <th>Downloaded</th> 68 <th>User</th> 69 </tr> 70 </thead> 71 <tbody> 72 {% for file in download_history %} 73 <tr> 74 <td>{{ file.primary_key }}</td> 75 <td><a href="{{ file.url }}">{{ file.title }}</a></td> 76 <td>{{ file.date_time_downloaded }}</td> 77 <td>{{ file.user.username }}</td> 78 </tr> 79 {% endfor %} 80 </tbody> 81 </table> 82 {% else %} 83 <p>You need to be logged in before using this web app.</p> 84 {% endif %} 85 86 {% endblock %} 87