From af26ffa5d390f7b027cfd1abacfd922ad70e5677 Mon Sep 17 00:00:00 2001 From: Equip de Desenvolupadors de PBE Date: Fri, 7 Dec 2012 04:23:08 +0000 Subject: [PATCH] Directoris coge la carpeta raíz --- src/com/upc/pbe/upcnews/Directoris.java | 19 ++++++++++++++++--- src/com/upc/pbe/upcnews/HTMLParser.java | 13 +------------ 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/com/upc/pbe/upcnews/Directoris.java b/src/com/upc/pbe/upcnews/Directoris.java index 7a2a634..957204a 100644 --- a/src/com/upc/pbe/upcnews/Directoris.java +++ b/src/com/upc/pbe/upcnews/Directoris.java @@ -40,7 +40,14 @@ public class Directoris extends Activity implements OnClickListener { for (int i = 0; i < dirs.size(); i++) { Log.d(TAG, "Directori " + dirs.get(i).toString()); buttons.get(i).setVisibility(View.VISIBLE); - buttons.get(i).setText(dirs.get(i)); + if(dirs.get(i).equals("")) + { + buttons.get(i).setText(""); + } + else + { + buttons.get(i).setText(dirs.get(i)); + } } } @@ -104,10 +111,16 @@ public class Directoris extends Activity implements OnClickListener { //Descarrega de la p�gina HTML del directori i busqueda d'un .m3u8 en ella Log.d(TAG, "Click on " + b.getText()); + String path = b.getText().toString(); + if(path.equals("")) + { + path = ""; + } + path += "/"; d = new Descarrega(); - String str = d.doInBackground(url + "/" + b.getText() + "/"); + String str = d.doInBackground(url + "/" + path); HTMLParser pars = new HTMLParser(); - String urlvideo = pars.findvideo(str, url + "/" + b.getText() + "/"); + String urlvideo = pars.findvideo(str, url + "/" + path); Log.d(TAG, urlvideo); //Descarrega de l'arxiu .m3u8 (si existeix) i parseig diff --git a/src/com/upc/pbe/upcnews/HTMLParser.java b/src/com/upc/pbe/upcnews/HTMLParser.java index d2508ee..78dc319 100644 --- a/src/com/upc/pbe/upcnews/HTMLParser.java +++ b/src/com/upc/pbe/upcnews/HTMLParser.java @@ -10,6 +10,7 @@ public class HTMLParser { public HTMLParser(){ this.code = null; directoris = new ArrayList(); + directoris.add(""); } public ArrayList parse(String code){ @@ -37,16 +38,4 @@ public class HTMLParser { } return "No s'ha trobat"; } - - public String processar(String text){ - //Elimina els car�cters no desitjats dels noms dels directoris. - - char[] c = text.toCharArray(); - for (int i=0; i