|
@@ -29,7 +29,7 @@ public class PLReader
|
|
|
* //Defaultet zu 1,0 falls nicht gefunden
|
|
|
* #IZPL:INCLUDE|PrioMultiplier|Expand//INCLUDE sagt dass hier ne referenzierte IZPL liegt Expand sagt Liste kann aufgeteilt werden
|
|
|
* /Pfad/zu/andererListe.iZpl //prioMultiplier bei include mutipliziert Multiopliers des Includes
|
|
|
- * #IZPL:INCLUDE|PrioMultiplier|NoExpand //NoExpand sagt dass File Als ein Block behandelt werden muss (Includes innerhalb werden auch beachtet
|
|
|
+ * #IZPL:INCLUDE|PrioMultiplier|NoExpand //NoExpand sagt dass File Als ein Block behandelt werden muss (Includes innerhalb werden auch beachtet aber keine multiplizierungen eingebaut
|
|
|
* /Pfad/zu/UnsplittbarerListe.iZpl
|
|
|
*/
|
|
|
private static Yaml yp = new Yaml();
|
|
@@ -281,10 +281,40 @@ public class PLReader
|
|
|
{
|
|
|
for (String[] elements : tempo)
|
|
|
{
|
|
|
+ String lfid=elements[0];
|
|
|
+ if(lfid==null||lfid.equals("null"))
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if(!lfid.substring(1,2).equals(":"))//absoluterPfad
|
|
|
+ {
|
|
|
+ lfid=FileTK.getFilePath(path)+"\\"+lfid;
|
|
|
+ }
|
|
|
+ elements[0]=lfid;
|
|
|
+
|
|
|
+
|
|
|
String[] metadata=elements[2].substring(6).split("\\|");
|
|
|
+ if(metadata[0].equalsIgnoreCase("include"))
|
|
|
+ {
|
|
|
+ System.out.println("incl;"+elements[0]);
|
|
|
+ retval.addAll(readListAlternativeNoexpandAux(elements[0], rd-1));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ retval.add(elements);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- return null;
|
|
|
+
|
|
|
+ System.out.println("ArrayResult of reading in as NoExpa:"+path);
|
|
|
+ System.out.println("Depth:"+rd);
|
|
|
+ System.out.println("\n"+yp.dump(retval));//macht das log leichter parsbar in NPP mit Ansicht=yaml
|
|
|
+ System.out.println("ENd of Block:"+path);
|
|
|
+ System.out.println("###########################################################################");
|
|
|
+ System.out.println("---------------------------------------------------------------------------");
|
|
|
+ System.out.println("###########################################################################");
|
|
|
+
|
|
|
+ return retval;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -295,7 +325,7 @@ public class PLReader
|
|
|
{
|
|
|
String[] playListRaw = FileTK.fileload(path);//temporär ne bestimmte hardcoden
|
|
|
ArrayList<String[]> tempo=new ArrayList<>();
|
|
|
- if(playListRaw.length>=2 && playListRaw[0].equalsIgnoreCase("EXTM3U")&&playListRaw[1].equalsIgnoreCase("#IZPL"))
|
|
|
+ if(playListRaw.length>=2 && playListRaw[0].equalsIgnoreCase("#EXTM3U")&&playListRaw[1].equalsIgnoreCase("#IZPL"))
|
|
|
{
|
|
|
String[] buffer = new String[3]; //0 path; 1=extm3u,2=izpl-data
|
|
|
int cntr=0;
|
|
@@ -321,6 +351,7 @@ public class PLReader
|
|
|
cntr=0;
|
|
|
buffer[0]=line;
|
|
|
tempo.add(buffer);
|
|
|
+ buffer = new String[3];//<<ARSCHLOCH hatte dich vergessen ...
|
|
|
buffer[0]="";
|
|
|
buffer[1]="";
|
|
|
buffer[2]="#IZPL:1|0";
|
|
@@ -345,63 +376,75 @@ public class PLReader
|
|
|
}
|
|
|
|
|
|
List<String[]> tempo = readListAlternativeAuxPrepare(path);
|
|
|
+ System.out.println("##########################Raw List input##############################################");
|
|
|
+ System.out.println(yp.dump(tempo));
|
|
|
+ System.out.println("#####################End Raw List input###############################################");
|
|
|
+
|
|
|
if(tempo!=null)
|
|
|
{
|
|
|
//\\//\\//
|
|
|
//0 pfad; 1=extinf;2=izpl;
|
|
|
//verarbeiten.....
|
|
|
HashMap<Integer,ArrayList<String[]>> groupprep = new HashMap<>();
|
|
|
- groupprep.put(0,new ArrayList<String[]>());
|
|
|
+ //groupprep.put(0,new ArrayList<String[]>());
|
|
|
for (String[] elements : tempo)
|
|
|
{
|
|
|
String lfid=elements[0];
|
|
|
+ if(lfid==null||lfid.equals("null"))
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
if(!lfid.substring(1,2).equals(":"))//absoluterPfad
|
|
|
{
|
|
|
lfid=FileTK.getFilePath(path)+"\\"+lfid;
|
|
|
}
|
|
|
elements[0]=lfid;
|
|
|
String[] metadata=elements[2].substring(6).split("\\|");
|
|
|
- if(metadata[1].equalsIgnoreCase("include"))
|
|
|
+ if(metadata[0].equalsIgnoreCase("include"))
|
|
|
{
|
|
|
System.out.println("Includebranch");
|
|
|
if(metadata[2].equalsIgnoreCase("EXPAND"))
|
|
|
{
|
|
|
- HashMap<String,PlayListItem> recurseret = readListAlternative(elements[0], rd-1, Integer.valueOf(metadata[1]));//nätig in beiden fällen
|
|
|
+ HashMap<String,PlayListItem> recurseret = readListAlternative(elements[0], rd-1, Integer.valueOf(metadata[1].trim()));//nätig in beiden fällen
|
|
|
Set<String> keys= recurseret.keySet();
|
|
|
for (String itemkey : keys)
|
|
|
{
|
|
|
PlayListItem pli = recurseret.get(itemkey);
|
|
|
if(pli instanceof SinglePlayListItem)//multiitems instapasthru
|
|
|
{
|
|
|
- if(retval.containsKey(itemkey))
|
|
|
+ if(retval.containsKey(pli+""))
|
|
|
{
|
|
|
- PlayListItem tpli = retval.get(itemkey);
|
|
|
+ PlayListItem tpli = retval.get(pli+"");
|
|
|
tpli.setTargetPlaycount(tpli.getTargetPlaycount()+prioritybase*pli.getTargetPlaycount());
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- retval.put(itemkey,pli);
|
|
|
+ retval.put(pli+"",pli);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- retval.put(itemkey,pli);
|
|
|
+ retval.put(pli+"",pli);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- MultiPlayListItem pli = new MultiPlayListItem(new String[]{}, new String[]{}, Integer.valueOf(metadata[1])*prioritybase);
|
|
|
+ MultiPlayListItem pli = new MultiPlayListItem(new String[]{}, new String[]{}, Integer.valueOf(metadata[1].trim())*prioritybase);
|
|
|
//target der liste :P
|
|
|
List<String[]> listraw = readListAlternativeNoexpandAux(elements[0], rd-1);
|
|
|
-
|
|
|
+ for (String[] item : listraw)
|
|
|
+ {
|
|
|
+ pli.addTitle(item[0], item[1]);
|
|
|
+ }
|
|
|
+ retval.put(pli+"", pli);//multiItems sind nicht mit pfad referenziert...
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//1,0=fefault :P
|
|
|
- int gid = Integer.valueOf(metadata[1]);
|
|
|
+ int gid = Integer.valueOf(metadata[1].trim());
|
|
|
if(gid>0)
|
|
|
{
|
|
|
if(!groupprep.containsKey(gid))
|
|
@@ -413,25 +456,27 @@ public class PLReader
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- if(retval.containsKey(elements[0]))//summieren...
|
|
|
+ PlayListItem it = new SinglePlayListItem(elements[0], elements[1], Integer.valueOf(metadata[0].trim())*prioritybase);
|
|
|
+ if(retval.containsKey(it+""))//summieren...
|
|
|
{
|
|
|
- PlayListItem it = retval.get(elements[0]);
|
|
|
+ it = retval.get(it+"");
|
|
|
int cpc = it.getTargetPlaycount();
|
|
|
- it.setTargetPlaycount(cpc+(prioritybase*Integer.valueOf(metadata[1])));//zusammenaddieren da unter dem =en path nur das selbe lied liegen kann also de-dupe
|
|
|
+ it.setTargetPlaycount(cpc+(prioritybase*Integer.valueOf(metadata[0].trim())));//zusammenaddieren da unter dem =en path nur das selbe lied liegen kann also de-dupe
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- PlayListItem it = new SinglePlayListItem(elements[0], elements[1], Integer.valueOf(metadata[1])*prioritybase);
|
|
|
- retval.put(elements[0],it);
|
|
|
+
|
|
|
+ retval.put(it+"",it);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
Set<Integer> keys = groupprep.keySet();
|
|
|
for (Integer i:keys)
|
|
|
- { //HAXX
|
|
|
- MultiPlayListItem pli = new MultiPlayListItem(new String[]{}, new String[]{}, prioritybase*Integer.valueOf(tempo.get(0)[2].substring(6).split("\\|")[1]));
|
|
|
- tempo=groupprep.get(i);
|
|
|
+ {
|
|
|
+ tempo=groupprep.get(i); //HAXX
|
|
|
+ MultiPlayListItem pli = new MultiPlayListItem(new String[]{}, new String[]{}, prioritybase*Integer.valueOf(tempo.get(0)[2].substring(6).split("\\|")[1].trim()));
|
|
|
+
|
|
|
for (String[] elem : tempo)
|
|
|
{
|
|
|
String lfid=elem[0];
|
|
@@ -442,12 +487,20 @@ public class PLReader
|
|
|
elem[0]=lfid;
|
|
|
pli.addTitle(elem[0], elem[1]);
|
|
|
}
|
|
|
- retval.put(pli+"", pli);//multiItems sind nicht mit pfad referenziert...
|
|
|
+ retval.put(pli+"", pli);//multiItems sind nicht mit pfad referenziert... außer NoexpandIncludes
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- return null;
|
|
|
+ System.out.println("ArrayResult of reading in:"+path);
|
|
|
+ System.out.println("Depth:"+rd);
|
|
|
+ System.out.println("\n"+yp.dump(retval));//macht das log leichter parsbar in NPP mit Ansicht=yaml
|
|
|
+ System.out.println("ENd of Block:"+path);
|
|
|
+ System.out.println("###########################################################################");
|
|
|
+ System.out.println("---------------------------------------------------------------------------");
|
|
|
+ System.out.println("###########################################################################");
|
|
|
+
|
|
|
+ return retval;
|
|
|
}
|
|
|
|
|
|
|