diff --git a/app.py b/app.py
index b09d0d0..74f4eca 100755
--- a/app.py
+++ b/app.py
@@ -213,7 +213,9 @@ def sendCommand(host, arg0, arg1, arg2):
m3u_content += m3u_prefix + item.get("duration") + ", " + item.get("name") + "\n" + item.get("uri") + "\n"
playlist_duration += int(item.get("duration"))
# ~ item_info = item.get("id") + " : " + item.get("name") + " - " + sec2min( int( item.get("duration") ) )
- item_info = item.get("id") + ";" + item.get("name") + ";" + sec2min( int( item.get("duration") ) )
+ item_info = item.get("id") + ";" + item.get("name") + ";" + sec2min( int( item.get("duration") ) ) + ";"
+ if "current" in item.keys():
+ item_info += item.get("current")
item_list.append(item_info)
playlist_overview = {
diff --git a/static/script.js b/static/script.js
index d321067..4b84966 100644
--- a/static/script.js
+++ b/static/script.js
@@ -1,9 +1,106 @@
+// Timeline drag and drop
+const tl_cont_attr = {id:"tl_cont", ondrop: "drop(event, this)", ondragover:"allowDrop(event)"};
+const tl_drag_attr = {id:"tl_drag", draggable:"true", ondragstart:"drag(event, this)"};
+
+var src_id = "";
+
+function updatePlaylist(){
+ var new_list = [];
+ var media_count = document.getElementById("timeline").children.length;
+ for (i=media_count,l=0;i>l;i--) {
+ //~ new_list.push(document.getElementById("timeline").children[i].children[0].getAttribute("media_id"));
+ toMove = document.getElementById("timeline").children[i-1].children[0].getAttribute("media_id");
+ console.log(toMove);
+ sendCmd("/all/move/" + toMove + "/1");
+ }
+}
+
+function findTargetIndex(element, index, array, thisArg){
+ if (element == this) {
+ return index+1;
+ }
+ return 0;
+};
+
+function moveElements(target) {
+ var elem_list = Array.from(src_id.parentElement.children);
+ var elem_list_slice = elem_list;
+ var source_idx = elem_list.findIndex(findTargetIndex, src_id);
+ var target_idx = elem_list.findIndex(findTargetIndex, target);
+ var idx;
+ if (source_idx < target_idx) {
+ elem_list_slice = elem_list.slice(source_idx+1, target_idx+1);
+ idx = source_idx;
+ } else {
+ elem_list_slice = elem_list.slice(target_idx, source_idx );
+ idx = target_idx+1;
+ }
+ for (i=0, l=elem_list_slice.length; iId " +
- "Filename " +
- "Duration " +
- "";
- for (var j = 0, k=items_array.length; j" + item_meta[0] + " " +
- "" + item_meta[1] + " " +
- "" + item_meta[2] + " " +
- "" ;
- }
- html_table += "";
- document.getElementById("playlist_"+infos_array[i].host).innerHTML += html_table;
- };
- break;
- case "/scan":
- var host_up = infos_array[0];
- var host_down = infos_array[1];
- for ( var i=0, l=host_up.length; iFilename " +
- "Duration " +
- "";
- for (var j = 0, k=infos_array.length; j" + infos_array[j] + " " +
- "" + "00:00" + " " +
- "" ;
- }
- html_table += "";
- document.getElementById("filelist").innerHTML += html_table;
- break;
- case "/all/rssi":
- var signal_color = 40;
- var best_rssi = 30;
- var worst_rssi = 70;
- for (var j = 0, k=infos_array.length; jId " +
+ "Filename " +
+ "Duration " +
+ "";
+ for (var j = 0, k=items_array.length; j" + item_meta[0] + " " +
+ "" + item_meta[1] + " " +
+ "" + item_meta[2] + " " +
+ "" ;
+ // Timeline
+ var child_node = addElement("div", tl_drag_attr, item_meta, j);
+ var len = document.getElementById("timeline").children.length;
+ if ( len < items_array.length ) {
+ document.getElementById("timeline").appendChild( addElement("div", tl_cont_attr, [], len) );
+ }
+ document.getElementById(tl_cont_attr.id + j).replaceChildren(child_node);
+ if (item_meta[3] != ""){
+ document.getElementById(tl_cont_attr.id + j).children[0].style.borderBottom = "4px solid #ff8300";
+ }
+ }
+ html_table += "";
+ document.getElementById("playlist_"+infos_array[i].host).innerHTML += html_table;
+ };
+ break;
+ case "/scan":
+ var host_up = infos_array[0];
+ var host_down = infos_array[1];
+ for ( var i=0, l=host_up.length; iFilename " +
+ "Duration " +
+ "";
+ for (var j = 0, k=infos_array.length; j" + infos_array[j] + " " +
+ "" + "00:00" + " " +
+ "" ;
+ }
+ html_table += "";
+ document.getElementById("filelist").innerHTML += html_table;
+ break;
+ case "/all/rssi":
+ var signal_color = 40;
+ var best_rssi = 30;
+ var worst_rssi = 70;
+ for (var j = 0, k=infos_array.length; j
listes
-
+