From 245ac197112b653193be4672ed9940bfd0c83d0e Mon Sep 17 00:00:00 2001 From: ulrich Date: Fri, 09 Apr 2021 07:52:36 +0000 Subject: [PATCH] ID3 Tags werden bis zur Abspielliste durchgereicht --- www/ui/js/app.js | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 50 insertions(+), 8 deletions(-) diff --git a/www/ui/js/app.js b/www/ui/js/app.js index 3f8f2b6..6b62511 100644 --- a/www/ui/js/app.js +++ b/www/ui/js/app.js @@ -74,19 +74,28 @@ /* ---------------- Titel einer Abspielliste ----------------- */ this.titel_liste = function() { - self.http_get('../api/store/Ablageort/liste/', function (responseText) { - self.vorlage_laden_und_fuellen("data/tpl/ablageort_liste.tpl", JSON.parse(responseText), function (html) { + self.reset_top_buttons(); + var plname = document.querySelector('#playlist').value; + self.http_get('../api/alist/' + plname, function (responseText) { + self.vorlage_laden_und_fuellen("data/tpl/titel_liste.tpl", JSON.parse(responseText), function (html) { document.querySelector(".zentraler-inhalt").innerHTML = html; self.addEvtListener('.entity-eintrag', 'click', function (event) { var t = event.target; + self.removeClassMulti('selected'); + t.classList.add('selected'); + + /* self.http_get('../api/store/Ablageort/' + t.textContent, function(responseText){ var ablageort = JSON.parse(responseText); self.ablageort_form(ablageort); }); + */ }); + /* self.addEvtListener('#neu-btn', 'click', function (event) { eval("self.ablageort_form" + "(this)"); - }); + }); + */ }); }); }; @@ -138,8 +147,12 @@ } self.media_liste(); } else { - self.removeClassMulti('selected'); - t.classList.add('selected'); + if(t.classList.contains('selected')) { + self.addSelectedTitel(); + } else { + self.removeClassMulti('selected'); + t.classList.add('selected'); + } //self.selTitel = new Titel(t.textContent, self.ortPfad); } }); @@ -163,9 +176,34 @@ } }; + /* + + {"Medialiste": [{"name":"sound_city.m4v","typ":"video","interpret":"","titelAnzName":"","album":""},{"name":"sub","typ":"folder","interpret":"","titelAnzName":"","album":""},{"name":"Aufnahmen.ods","typ":"file","interpret":"","titelAnzName":"","album":""},{"name":"index.html","typ":"file","interpret":"","titelAnzName":"","album":""},{"name":"A","typ":"folder","interpret":"","titelAnzName":"","album":""},{"name":"sleepers.m4v","typ":"video","interpret":"","titelAnzName":"","album":""}]} + + + function Titel(n, p, u, i, t, a) { + this.katalogUrl = u; + this.pfad = p; + this.name = n; + this.interpret = i; + this.titelAnzName = t; + this.album = a; + } + + */ + this.addSelectedTitel = function() { - var titelName = document.querySelector(".selected").textContent; - var titel = new Titel(self.mediaPfad + titelName, self.ortPfad); + var elem = document.querySelector(".selected"); + var titelName = elem.textContent; + var album = elem.attributes.album.nodeValue; + var interpret = elem.attributes.interpret.nodeValue; + var anzName = elem.attributes.titelAnzName.nodeValue; + var titel; + if(self.mediaPfad.endsWith('/')) { + titel = new Titel(titelName, self.mediaPfad, self.ortPfad, interpret, anzName, album); + } else { + titel = new Titel(titelName, self.mediaPfad + '/', self.ortPfad, interpret, anzName, album); + } var plname = document.querySelector('#playlist').value; self.http_put('../api/alist/' + plname, JSON.stringify(titel), function(responseText) { self.meldung_mit_timeout(responseText, 1500); @@ -693,7 +731,11 @@ this.name = n; } -function Titel(n, u) { +function Titel(n, p, u, i, t, a) { this.katalogUrl = u; + this.pfad = p; this.name = n; + this.interpret = i; + this.titelAnzName = t; + this.album = a; } \ No newline at end of file -- Gitblit v1.9.3