Commit af26ffa5d390f7b027cfd1abacfd922ad70e5677

Authored by Imanol-Mikel Barba Sabariego
1 parent f496e3d8

Directoris coge la carpeta raíz

src/com/upc/pbe/upcnews/Directoris.java
... ... @@ -40,7 +40,14 @@ public class Directoris extends Activity implements OnClickListener {
40 40 for (int i = 0; i < dirs.size(); i++) {
41 41 Log.d(TAG, "Directori " + dirs.get(i).toString());
42 42 buttons.get(i).setVisibility(View.VISIBLE);
43   - buttons.get(i).setText(dirs.get(i));
  43 + if(dirs.get(i).equals(""))
  44 + {
  45 + buttons.get(i).setText("<Current Folder>");
  46 + }
  47 + else
  48 + {
  49 + buttons.get(i).setText(dirs.get(i));
  50 + }
44 51 }
45 52 }
46 53  
... ... @@ -104,10 +111,16 @@ public class Directoris extends Activity implements OnClickListener {
104 111  
105 112 //Descarrega de la p�gina HTML del directori i busqueda d'un .m3u8 en ella
106 113 Log.d(TAG, "Click on " + b.getText());
  114 + String path = b.getText().toString();
  115 + if(path.equals("<Current Folder>"))
  116 + {
  117 + path = "";
  118 + }
  119 + path += "/";
107 120 d = new Descarrega();
108   - String str = d.doInBackground(url + "/" + b.getText() + "/");
  121 + String str = d.doInBackground(url + "/" + path);
109 122 HTMLParser pars = new HTMLParser();
110   - String urlvideo = pars.findvideo(str, url + "/" + b.getText() + "/");
  123 + String urlvideo = pars.findvideo(str, url + "/" + path);
111 124 Log.d(TAG, urlvideo);
112 125  
113 126 //Descarrega de l'arxiu .m3u8 (si existeix) i parseig
... ...
src/com/upc/pbe/upcnews/HTMLParser.java
... ... @@ -10,6 +10,7 @@ public class HTMLParser {
10 10 public HTMLParser(){
11 11 this.code = null;
12 12 directoris = new ArrayList<String>();
  13 + directoris.add("");
13 14 }
14 15  
15 16 public ArrayList<String> parse(String code){
... ... @@ -37,16 +38,4 @@ public class HTMLParser {
37 38 }
38 39 return "No s'ha trobat";
39 40 }
40   -
41   - public String processar(String text){
42   - //Elimina els car�cters no desitjats dels noms dels directoris.
43   -
44   - char[] c = text.toCharArray();
45   - for (int i=0; i<c.length; i++){
46   - if(c[i]=='-'){
47   - c[i]=' ';
48   - }
49   - }
50   - return new String(c);
51   - }
52 41 }
... ...