Titel aus Abspielliste loeschen fertig, Abspielliste abspielen Entwurf fertig zum Test
| | |
| | | protected boolean delete(HttpExchange e) { |
| | | String path = e.getRequestURI().toString(); |
| | | String[] elems = path.split(Server.SLASH); |
| | | String plname = elems[elems.length - 2]; |
| | | String listName = elems[elems.length - 3]; |
| | | String listName = elems[elems.length - 2]; |
| | | |
| | | FileStorage fs = new FileStorage(App.getInitParameter(App.getRs(App.RB_AP_CONF))); |
| | | Entity entity = fs.read(Abspielliste.class.getSimpleName(), listName); |
| | |
| | | import de.uhilger.mediaz.store.Storage; |
| | | import java.io.IOException; |
| | | import java.net.HttpURLConnection; |
| | | import java.net.MalformedURLException; |
| | | import java.net.URL; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | |
| | | } |
| | | break; |
| | | case 8: |
| | | response = erstenListentitelSpielen(fs, elems[4], elems[7]); |
| | | response = ersterTitel(fs, elems[4], elems[7]); |
| | | break; |
| | | default: |
| | | response = "Ungueltiger URL"; |
| | |
| | | return response; |
| | | } |
| | | |
| | | private String meldung(String text, int code) { |
| | | setReturnCode(code); |
| | | return text; |
| | | private String ersterTitel(Storage s, String aName, String lName) { |
| | | String response; |
| | | Entity entity = s.read(FileStorage.ST_ABSPIELLISTE, lName); |
| | | if (entity instanceof Abspielliste) { |
| | | Abspielliste liste = (Abspielliste) entity; |
| | | response = listentitelSpielen(s, aName, liste, 0); |
| | | } else { |
| | | response = meldung("Abspielliste nicht gefunden.", AbstractHandler.RTC_NOT_FOUND); |
| | | } |
| | | return response; |
| | | } |
| | | |
| | | private String naechsterTitel(Storage s, String abspielerName) { |
| | |
| | | return response; |
| | | } |
| | | |
| | | private String erstenListentitelSpielen(Storage s, String aName, String lName) { |
| | | String response; |
| | | Entity entity = s.read(FileStorage.ST_ABSPIELLISTE, lName); |
| | | if (entity instanceof Abspielliste) { |
| | | Abspielliste liste = (Abspielliste) entity; |
| | | response = listentitelSpielen(s, aName, liste, 0); |
| | | } else { |
| | | response = meldung("Abspielliste nicht gefunden.", AbstractHandler.RTC_NOT_FOUND); |
| | | } |
| | | return response; |
| | | } |
| | | |
| | | private String listentitelSpielen(Storage s, String aName, Abspielliste liste, int titelNr) { |
| | | String response; |
| | | Entity entity = s.read(FileStorage.ST_ABSPIELER, aName); |
| | |
| | | String kommando = kommandoFuerTitel(s, liste, abspieler, titelNr); |
| | | //String kommando = kmd.toString(); |
| | | logger.info(kommando); |
| | | //abspielerKommandoSenden(kommando); |
| | | abspielerKommandoSenden(kommando); |
| | | response = "Abspielen der Liste " + liste.getName() + " auf Abspieler " + aName + " gestartet."; |
| | | } else { |
| | | response = meldung("Abspieler nicht gefunden.", AbstractHandler.RTC_NOT_FOUND); |
| | |
| | | } |
| | | } |
| | | |
| | | private String meldung(String text, int code) { |
| | | setReturnCode(code); |
| | | return text; |
| | | } |
| | | |
| | | // rpi4-az:9090/avd/play?titel=/Filme/S/sound_city.m4v&th=60&ti=60&o=local |
| | | // aUrl http://rpi4-wz:9090/ |
| | |
| | | this.removeSelectedTitel = function() { |
| | | var elem = document.querySelector(".selected"); |
| | | var parentElem = elem.parentNode; |
| | | console.log("elem: " + elem.nodeName + ", parent: " + parentElem.nodeName + ", len: " + parentElem.childNodes.length); |
| | | var liElems = parentElem.getElementsByTagName(elem.nodeName); |
| | | console.log("liElems.anz: " + liElems.length); |
| | | for(var i = 0; i < liElems.length; i++) { |
| | | console.log(liElems.item(i).textContent); |
| | | if(liElems.item(i).textContent === elem.textContent) { |
| | | console.log(elem.textContent + ' hat Index ' + i); |
| | | //console.log("elem: " + elem.nodeName + ", parent: " + parentElem.nodeName + ", len: " + parentElem.childNodes.length); |
| | | var liElems = parentElem.getElementsByTagName(elem.nodeName); // nur die LI Elemente |
| | | //console.log("liElems.anz: " + liElems.length); |
| | | var gefunden = false; |
| | | for(var i = 0; i < liElems.length && !gefunden; i++) { |
| | | //console.log(liElems.item(i).textContent); |
| | | if(liElems.item(i).classList.contains("selected")) { |
| | | gefunden = true; |
| | | var index = i; |
| | | //console.log(elem.textContent + ' hat Index ' + i); |
| | | } |
| | | } |
| | | // /mz/api/alist/[pl-name]/[nr] |
| | | var plname = document.querySelector('#playlist').value; |
| | | self.http_delete('../api/alist/' + plname + '/' + index,'', function(responseText) { |
| | | // DELETE http://localhost:9090/mz/api/alist/liste1/0 |
| | | self.meldung_mit_timeout(responseText, 1500); |
| | | self.titel_liste(); |
| | | }); |
| | | |
| | | }; |
| | | |
| | | /* Unterer Einblendbereich */ |
| | |
| | | self.abspielliste_auswahl_fuellen(); |
| | | self.addEvtListener('#dazu-btn', 'click', self.addSelectedTitel); |
| | | self.addEvtListener('#play-btn', 'click', self.play); |
| | | // /mz/api/alist/[pl-name]/[nr] |
| | | self.addEvtListener('#weg-btn', 'click', self.removeSelectedTitel); |
| | | self.media_liste(); |
| | | }); |
| | |
| | | }; |
| | | |
| | | this.http_delete = function (u, data, cb) { |
| | | console.log("delete " + u); |
| | | // console.log("delete " + u); |
| | | self.http_call('DELETE', u, data, cb); |
| | | }; |
| | | |