Comparing only the timestamps when deleting an item from the playlist, should remove it faster.
114 lines
3.9 KiB
HTML
114 lines
3.9 KiB
HTML
{% macro dirlisting(dir, path='') -%}
|
|
<ul>
|
|
{% for subdirname, subdirobj in dir.get_subdirs().items() %}
|
|
{%- set subdirpath = os.path.relpath(subdirobj.fullpath, music_library.fullpath) %}
|
|
<li class="directory">
|
|
<span>{{ subdirname }}/ </span>
|
|
<form method="post" class="directory form1">
|
|
<input type="text" value="{{ subdirpath }}" name="add_folder" hidden>
|
|
<input type="submit" value="Add all tracks from this folder">
|
|
</form>
|
|
<form method="post" class="directory form2">
|
|
<input type="text" value="{{ subdirpath }}" name="add_folder_recursively" hidden>
|
|
<input type="submit" value="Add all tracks from this folder (recursively)">
|
|
</form>
|
|
<form action="./download" method="get" class="directory form3">
|
|
<input type="text" value="{{ subdirpath }}" name="directory" hidden>
|
|
<input type="submit" value="Download entire directory">
|
|
</form>
|
|
</li>
|
|
{{- dirlisting(subdirobj, subdirpath) -}}
|
|
{% endfor %}
|
|
{%- set files = dir.get_files() %}
|
|
{%- if files %}
|
|
{% for file in files %}
|
|
{% set filepath = os.path.relpath(os.path.join(dir.fullpath, file), music_library.fullpath) %}
|
|
<li class="file">
|
|
<form method="post" class="file file_add">
|
|
<input type="text" value="{{ filepath }}" name="add_file" hidden>
|
|
<input type="submit" value="Add">
|
|
</form>
|
|
<form action="./download" method="get" class="file file_download">
|
|
<input type="text" value="{{ filepath }}" name="file" hidden>
|
|
<input type="submit" value="Download">
|
|
{{ file }}
|
|
</form>
|
|
</li>
|
|
{% endfor %}
|
|
{%- endif %}
|
|
</ul>
|
|
{%- endmacro %}
|
|
|
|
<!DOCTYPE html>
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title></title>
|
|
<link rel="stylesheet" href="{{ url_for('static', filename='index.css') }}">
|
|
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
|
|
<META HTTP-EQUIV="Expires" CONTENT="-1">
|
|
</head>
|
|
<body>
|
|
<a href="."><h5>Refresh</h5></a>
|
|
<br>
|
|
|
|
<div id="upload">
|
|
<form action="./upload" method="post" enctype="multipart/form-data">
|
|
<input type="file" name="file" value="Browse Music file"/>
|
|
Upload into
|
|
<input list="targetdirs" id="targetdir" name="targetdir" placeholder="uploads" />
|
|
<datalist id="targetdirs">
|
|
<option value="uploads">
|
|
{% for dir in music_library.get_subdirs_recursively() %}
|
|
<option value="{{ dir }}">
|
|
{% endfor %}
|
|
</datalist>
|
|
<input type="submit" value="Upload"/>
|
|
</form>
|
|
</div>
|
|
|
|
<br />
|
|
|
|
<div id="playlist">
|
|
Currently Playing :
|
|
{% if current_music %}
|
|
{{ current_music[0] }} {{ current_music[1] }}
|
|
{% if current_music[2] %}
|
|
(<a href="{{ current_music[2] }}">{{ current_music[2] }}</a>)
|
|
{% endif %}
|
|
{% else %}
|
|
No music
|
|
{% endif %}
|
|
<br />
|
|
Playlist :
|
|
<form method="post"><input type="text" value="randomize" name="action" hidden><input type="submit" value="Randomize playlist"></form>
|
|
|
|
<ul>
|
|
{% for m in playlist %}
|
|
<li>{{ m[1] }}
|
|
<form method="post"><input type="text" value="{{ m[2] }}" name="delete_music" hidden><input type="submit" value="X"></form>
|
|
</li>
|
|
{% endfor %}
|
|
</ul>
|
|
<h2>Music library:</h2>
|
|
<form action="./download" method="get" class="directory form1">
|
|
<input type="text" value="./" name="directory" hidden>
|
|
<input type="submit" value="Download entire music library">
|
|
</form>
|
|
<form method="post" class="directory form3">
|
|
<input type="text" value="./" name="add_folder_recursively" hidden>
|
|
<input type="submit" value="Add all tracks from music library (recursively)">
|
|
</form>
|
|
<br />
|
|
{{ dirlisting(music_library) }}
|
|
|
|
|
|
</div>
|
|
<div id="browser">
|
|
|
|
</div>
|
|
<div id="upload">
|
|
|
|
</div>
|
|
</body>
|
|
</html>
|