~hristoast/mousikofidi

3c05e466a2f941542bbe9f7b2759726a6c832542 — Hristos N. Triantafillou 9 months ago 5723a73 0.6
Playlists can be deleted too
4 files changed, 22 insertions(+), 4 deletions(-)

M mousikofidi.py
M static/css/fidi.css
M static/css/fidi.min.css
M templates/playlist.html
M mousikofidi.py => mousikofidi.py +14 -2
@@ 456,12 456,24 @@ def handle_playlist_cmd(cmd: str, path: str, context: dict) -> dict:
        context["user_playlist"] = []

    elif cmd == "load":
        load_error = False
        loaded = []
        playlist_dir = context["playlist_dir"]
        to_load = request.form["to-load"]
        full_path = os.path.join(playlist_dir, to_load + ".m3u")

        if "delete" in request.form:
            if os.path.isfile(full_path):
                os.remove(full_path)
                flash(
                    '<p class="bold center green">The playlist "{}" was deleted!</p>'.format(
                        to_load
                    )
                )

            return context

        load_error = False
        loaded = []

        if os.path.isfile(full_path):
            dbg("Loading playlist: " + full_path)
            content = []

M static/css/fidi.css => static/css/fidi.css +5 -0
@@ 138,6 138,11 @@ input#bulk-add {
    margin-bottom: 25px;
}

select#to-load {
    margin: 0 auto;
    margin-bottom: 10px;
}

div.anchor {
    bottom: 100px;
    position: relative;

M static/css/fidi.min.css => static/css/fidi.min.css +1 -1
@@ 1,1 1,1 @@
audio{margin-top:25px;width:100%}video{margin-top:25px;width:100% !important;height:auto !important}footer{font-size:.5em;margin-top:25px}div#player button{display:inline-block}form#playlistctl input{display:inline-block}form#theme-picker label select{margin:0 auto}nav{height:50px;margin-bottom:0;padding-bottom:0;position:-webkit-sticky;position:sticky;top:0;z-index:34}nav ul{margin-bottom:0;margin-top:0;list-style-type:none;overflow:hidden;background-color:#333;padding-left:0;display:inline-block;width:100%}nav ul li{float:left}nav ul li#logo{float:right}nav ul li#logo a#logo{padding:0}nav ul li#logo a#logo{-webkit-transition:none;transition:none;float:right;color:darkgray}nav ul li#logo a#logo:hover{background-color:#333}nav ul li a{display:block;color:white;text-align:center;padding:14px 16px;text-decoration:none}nav ul li a:hover{-webkit-transition:background-color .5s ease;transition:background-color .5s ease;background-color:#111}nav ul li a img{margin-top:9px;margin-right:9px;height:32px;width:32px}a:hover{text-decoration:none}div#content{min-height:315px;margin-top:20px}div#top-link{float:right;position:sticky;bottom:30px}div#top-link a{z-index:16;width:0;height:0;border-left:25px solid transparent;border-right:25px solid transparent;border-bottom:25px solid grey}input#bulk-add{margin:0 auto;margin-bottom:25px}div.anchor{bottom:100px;position:relative}div.play-arrow{width:0;height:0;border-top:10px solid transparent;border-bottom:10px solid transparent;border-left:10px solid green;float:left;margin-left:14px;margin-top:5px}input.plus{color:#41adff;font-size:1.9em;margin:0 0 0 10px;padding:0;background:none !important;width:20px}input.plus-btn{color:#41adff;font-size:1.9em;margin:0 auto}input.X{margin:0 0 0 20px;padding:0;font-size:1.4em;background:none !important}.active{background-color:green;color:pink;text-decoration:none}.center{text-align:center}.bold{font-weight:bold}.green{color:green}.red{color:red}
\ No newline at end of file
audio{margin-top:25px;width:100%}video{margin-top:25px;width:100% !important;height:auto !important}footer{font-size:.5em;margin-top:25px}div#player button{display:inline-block}form#playlistctl input{display:inline-block}form#theme-picker label select{margin:0 auto}nav{height:50px;margin-bottom:0;padding-bottom:0;position:-webkit-sticky;position:sticky;top:0;z-index:34}nav ul{margin-bottom:0;margin-top:0;list-style-type:none;overflow:hidden;background-color:#333;padding-left:0;display:inline-block;width:100%}nav ul li{float:left}nav ul li#logo{float:right}nav ul li#logo a#logo{padding:0}nav ul li#logo a#logo{-webkit-transition:none;transition:none;float:right;color:darkgray}nav ul li#logo a#logo:hover{background-color:#333}nav ul li a{display:block;color:white;text-align:center;padding:14px 16px;text-decoration:none}nav ul li a:hover{-webkit-transition:background-color .5s ease;transition:background-color .5s ease;background-color:#111}nav ul li a img{margin-top:9px;margin-right:9px;height:32px;width:32px}a:hover{text-decoration:none}div#content{min-height:315px;margin-top:20px}div#top-link{float:right;position:sticky;bottom:30px}div#top-link a{z-index:16;width:0;height:0;border-left:25px solid transparent;border-right:25px solid transparent;border-bottom:25px solid grey}input#bulk-add{margin:0 auto;margin-bottom:25px}select#to-load{margin:0 auto;margin-bottom:10px}div.anchor{bottom:100px;position:relative}div.play-arrow{width:0;height:0;border-top:10px solid transparent;border-bottom:10px solid transparent;border-left:10px solid green;float:left;margin-left:14px;margin-top:5px}input.plus{color:#41adff;font-size:1.9em;margin:0 0 0 10px;padding:0;background:none !important;width:20px}input.plus-btn{color:#41adff;font-size:1.9em;margin:0 auto}input.X{margin:0 0 0 20px;padding:0;font-size:1.4em;background:none !important}.active{background-color:green;color:pink;text-decoration:none}.center{text-align:center}.bold{font-weight:bold}.green{color:green}.red{color:red}
\ No newline at end of file

M templates/playlist.html => templates/playlist.html +2 -1
@@ 11,8 11,9 @@

  {% if playlists %}
    <form action="/playlist/load/%2Fload" class="center" id="playlistctl" method="post">
      <input class="center" id="delete" name="delete" title="Delete the selected playlist file." value="Delete Playlist" type="submit" /> 
      <input class="center" id="load" name="load" title="Load a playlist from a .m3u file." value="Load Playlist" type="submit" /> 
      <select id="to-load" name="to-load" style="margin: 0 auto; margin-bottom: 10px;" name="playlist">
      <select id="to-load" name="to-load" name="playlist" title="The name of the playlist to load.">
        {% for name in playlist_names %}
          <option value="{{ name }}">{{ name }}</option>
        {% endfor %}