コード例 #1
0
  private void rubrik(String rubrikUrl) {
    final String MUSTER =
        "/website/includes/medianew-playlist.xml.jsp?logic=start_multimedia_document_logic_";
    final String MUSTER_TITEL = "<meta property=\"og:title\" content=\"";

    rubrikSeite = getUrlIo.getUri_Iso(SENDERNAME, rubrikUrl, rubrikSeite, "");
    String url, thema;

    // 1. Titel (= Thema) holen
    thema =
        rubrikSeite.extract(
            MUSTER_TITEL,
            "\""); // <meta property="og:title" content="Alle Wetter | Fernsehen | hr-online.de"/>
    if (thema.contains("|")) {
      thema = thema.substring(0, thema.indexOf("|")).trim();
    }

    // 2. suchen nach XML Liste
    url = rubrikSeite.extract(MUSTER, "&");
    if (!url.equals("")) {
      url =
          "http://www.hr-online.de/website/includes/medianew-playlist.xml.jsp?logic=start_multimedia_document_logic_"
              + url;
      String[] add = new String[] {url, thema, rubrikUrl};
      if (!istInListe(listeThemen, url, 0)) {
        listeThemen.add(add);
      }
    } else {
      MSLog.fehlerMeldung(653210697, "keine URL");
    }
  }
コード例 #2
0
 @Override
 public void run() {
   try {
     meldungAddThread();
     String link[];
     while (!MSConfig.getStop() && (link = listeThemen.getListeThemen()) != null) {
       meldungProgress(link[0] /*url*/);
       seite.setLength(0);
       addFilme(link[0] /*url*/, link[1] /*thema*/, link[2] /*filmsite*/);
     }
   } catch (Exception ex) {
     MSLog.fehlerMeldung(894330854, ex);
   }
   meldungThreadUndFertig();
 }
コード例 #3
0
 private String getDate(String url) {
   String ret = "";
   try {
     String tmp = MSFunktionen.getDateiName(url);
     if (tmp.length() > 8) {
       tmp = tmp.substring(0, 8);
       SimpleDateFormat sdfIn = new SimpleDateFormat("yyyyMMdd");
       Date filmDate = sdfIn.parse(tmp);
       SimpleDateFormat sdfOut;
       sdfOut = new SimpleDateFormat("dd.MM.yyyy");
       ret = sdfOut.format(filmDate);
     }
   } catch (Exception ex) {
     ret = "";
     MSLog.fehlerMeldung(356408790, "kein Datum");
   }
   return ret;
 }
コード例 #4
0
    private void addFilme(String xmlWebsite, String thema_, String filmSite) {
      final String MUSTER_ITEM_1 = "<videos>";

      final String MUSTER_TITEL = "<title>"; // <title>Sonnenziel Valencia</title>
      final String MUSTER_URL =
          "<url type=\"mp4\">"; // <url
                                // type="mp4">http://www.hr.gl-systemhaus.de/video/fs/servicereisen/2014_11/141114214510_service_re_44765.mp4</url>
      final String MUSTER_URL_LOW = "<url type=\"mp4-small\">";
      final String MUSTER_DATUM = "<date>"; // <date>14.11.2014 18:50</date>
      final String MUSTER_THEMA = "<author>"; // <author>service: reisen</author>

      final String MUSTER_DURATION = "<duration>"; // <duration>00:43:32</duration>
      final String MUSTER_DESCRIPTION = "<description>";
      final String END = "</";
      meldung(xmlWebsite);
      seite1 = getUrl.getUri_Iso(SENDERNAME, xmlWebsite, seite1, "");
      try {
        int posItem1 = 0;
        String url = "", url_low;
        String datum, zeit = "";
        String titel, thema;
        long duration = 0;
        String description;
        while (!MSConfig.getStop() && (posItem1 = seite1.indexOf(MUSTER_ITEM_1, posItem1)) != -1) {
          posItem1 += MUSTER_ITEM_1.length();

          String d = seite1.extract(MUSTER_DURATION, END, posItem1);
          try {
            if (!d.equals("")) {
              duration = 0;
              String[] parts = d.split(":");
              long power = 1;
              for (int i = parts.length - 1; i >= 0; i--) {
                duration += Long.parseLong(parts[i]) * power;
                power *= 60;
              }
            }
          } catch (Exception ex) {
            MSLog.fehlerMeldung(708096931, "d: " + d);
          }
          description = seite1.extract(MUSTER_DESCRIPTION, END, posItem1);
          datum = seite1.extract(MUSTER_DATUM, END, posItem1);
          if (datum.contains(" ")) {
            zeit = datum.substring(datum.indexOf(" ")).trim() + ":00";
            datum = datum.substring(0, datum.indexOf(" "));
          }
          titel = seite1.extract(MUSTER_TITEL, END, posItem1);

          thema = seite1.extract(MUSTER_THEMA, END, posItem1);
          if (thema.isEmpty()) {
            thema = thema_;
          }
          if (thema.isEmpty()) {
            thema = titel;
          }
          url = seite1.extract(MUSTER_URL, END, posItem1);
          url_low = seite1.extract(MUSTER_URL_LOW, END, posItem1);
          if (url.equals(url_low)) {
            url_low = "";
          }
          if (!url.isEmpty()) {
            if (datum.equals("")) {
              datum = getDate(url);
            }
            // DatenFilm film = new DatenFilm(nameSenderMReader, thema, strUrlFeed, titel, url,
            // furl, datum, "");
            DatenFilm film =
                new DatenFilm(
                    SENDERNAME,
                    thema,
                    filmSite,
                    titel,
                    url,
                    "",
                    datum,
                    zeit,
                    duration,
                    description);
            if (!url_low.isEmpty()) {
              film.addUrlKlein(url_low, "");
            }
            String subtitle = url.replace(".mp4", ".xml");
            if (urlExists(subtitle)) {
              film.addUrlSubtitle(subtitle);
            }
            addFilm(film);
          } else {
            MSLog.fehlerMeldung(649882036, "keine URL");
          }
        }
        if (url.isEmpty()) {
          MSLog.fehlerMeldung(761236458, "keine URL für: " + xmlWebsite);
        }
      } catch (Exception ex) {
        MSLog.fehlerMeldung(487774126, ex);
      }
    }