Commit 74d6ee79778ebf0875921ed6442fef8f519bf343

Authored by Imanol-Mikel Barba Sabariego
1 parent 4a4152c1

--no commit message

src/com/upc/pbe/upcnews/Directoris.java
@@ -34,6 +34,7 @@ public class Directoris extends Activity implements OnClickListener { @@ -34,6 +34,7 @@ public class Directoris extends Activity implements OnClickListener {
34 34
35 this.crearButtons(); 35 this.crearButtons();
36 36
  37 + //Descarrega del HTML de l'index, busqueda de directoris i creacio dels botons
37 s = ((UpcApp) getApplication()).getDesc(); 38 s = ((UpcApp) getApplication()).getDesc();
38 39
39 HTMLParser pars = new HTMLParser(); 40 HTMLParser pars = new HTMLParser();
@@ -103,22 +104,21 @@ public class Directoris extends Activity implements OnClickListener { @@ -103,22 +104,21 @@ public class Directoris extends Activity implements OnClickListener {
103 } 104 }
104 105
105 public void buttonClicked(Button b) { 106 public void buttonClicked(Button b) {
  107 +
  108 + //Descarrega de la pàgina HTML del directori i busqueda d'un .m3u8 en ella
106 Log.d(TAG, "Click on " + b.getText()); 109 Log.d(TAG, "Click on " + b.getText());
107 d = new Descarrega(url + "/" + b.getText() + "/", file, folder); 110 d = new Descarrega(url + "/" + b.getText() + "/", file, folder);
108 String str = d.doInBackground(); 111 String str = d.doInBackground();
109 -  
110 HTMLParser pars = new HTMLParser(); 112 HTMLParser pars = new HTMLParser();
111 String urlvideo = pars.findvideo(str, url + "/" + b.getText() + "/"); 113 String urlvideo = pars.findvideo(str, url + "/" + b.getText() + "/");
112 -  
113 Log.d(TAG, urlvideo); 114 Log.d(TAG, urlvideo);
114 - 115 +
  116 + //Descarrega de l'arxiu .m3u8 (si existeix) i parseig
115 if (urlvideo.equalsIgnoreCase("No s'ha trobat")) { 117 if (urlvideo.equalsIgnoreCase("No s'ha trobat")) {
116 Toast.makeText(this, "The directory " + b.getText() + " does not contain any '.m3u8' file", Toast.LENGTH_LONG).show(); 118 Toast.makeText(this, "The directory " + b.getText() + " does not contain any '.m3u8' file", Toast.LENGTH_LONG).show();
117 } else { 119 } else {
118 d = new Descarrega(urlvideo, file, folder); 120 d = new Descarrega(urlvideo, file, folder);
119 String m3u8 = d.doInBackground(); 121 String m3u8 = d.doInBackground();
120 -  
121 - // m3u8 --> PARSE!  
122 Parser p = new Parser(); 122 Parser p = new Parser();
123 try { 123 try {
124 ArrayList<ParentList> m3u8parsed = p.parseFile(m3u8); 124 ArrayList<ParentList> m3u8parsed = p.parseFile(m3u8);