Skip to content

Commit

Permalink
Merge branch 'release/2.1.1'
Browse files Browse the repository at this point in the history
closed #75
  • Loading branch information
alex1702 committed Dec 1, 2016
2 parents af78519 + a63518b commit ea2911c
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 75 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import java.nio.file.Files
sourceCompatibility = 1.8
targetCompatibility = 1.8
mainClassName = 'mSearch.Main'
version = '2.1.0'
version = '2.1.1'

compileJava {
options.encoding = "UTF-8"
Expand Down
43 changes: 20 additions & 23 deletions src/main/java/mSearch/filmlisten/FilmlisteLesen.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,6 @@
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonToken;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URI;
import java.net.URISyntaxException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.zip.ZipInputStream;
import javax.swing.event.EventListenerList;
import mSearch.Config;
import mSearch.Const;
import mSearch.daten.DatenFilm;
Expand All @@ -44,6 +33,18 @@
import mSearch.tool.ProgressMonitorInputStream;
import org.tukaani.xz.XZInputStream;

import javax.swing.event.EventListenerList;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URI;
import java.net.URISyntaxException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.zip.ZipInputStream;

public class FilmlisteLesen {

public enum WorkMode {
Expand Down Expand Up @@ -122,7 +123,6 @@ public void readFilmListe(String source, final ListeFilme listeFilme, int days)
Log.sysLog("Liste Filme lesen von: " + source);
JsonToken jsonToken;
String sender = "", thema = "";
JsonParser jp = null;
listeFilme.clear();
this.notifyStart(source, PROGRESS_MAX); // für die Progressanzeige

Expand All @@ -133,9 +133,9 @@ public void readFilmListe(String source, final ListeFilme listeFilme, int days)
seconds = 0;
}

try {
InputStream in = selectDecompressor(source, getInputStreamForLocation(source));
jp = new JsonFactory().createParser(in);
try (InputStream in = selectDecompressor(source, getInputStreamForLocation(source));
JsonParser jp = new JsonFactory().createParser(in)) {

if (jp.nextToken() != JsonToken.START_OBJECT) {
throw new IllegalStateException("Expected data to start with an Object");
}
Expand Down Expand Up @@ -179,6 +179,10 @@ public void readFilmListe(String source, final ListeFilme listeFilme, int days)
}
}

// if (DatenFilm.JSON_NAMES[i] == DatenFilm.FILM_TITEL) {
// //convert UNICODE et al to java strings.
// datenFilm.arr[DatenFilm.JSON_NAMES[i]] = StringEscapeUtils.unescapeJava(jp.nextTextValue());
// } else
if (DatenFilm.JSON_NAMES[i] == DatenFilm.FILM_NEU) {
final String value = jp.nextTextValue();
//This value is unused...
Expand Down Expand Up @@ -214,21 +218,14 @@ public void readFilmListe(String source, final ListeFilme listeFilme, int days)
}
}
}
jp.close();
} catch (FileNotFoundException ex) {
Log.errorLog(894512369, "FilmListe existiert nicht: " + source);
listeFilme.clear();
} catch (Exception ex) {
Log.errorLog(945123641, ex, "FilmListe: " + source);
listeFilme.clear();
} finally {
try {
if (jp != null) {
jp.close();
}
} catch (Exception ignored) {
}
}

if (Config.getStop()) {
Log.sysLog("--> Abbruch");
listeFilme.clear();
Expand Down
105 changes: 58 additions & 47 deletions src/main/java/mSearch/filmlisten/FilmlistenSuchen.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,22 @@
*/
package mSearch.filmlisten;

import mSearch.Config;
import mSearch.Const;
import mSearch.tool.Functions;
import mSearch.tool.Log;

import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.Random;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import mSearch.Config;
import mSearch.Const;
import mSearch.tool.Functions;
import mSearch.tool.Log;

public class FilmlistenSuchen {

Expand Down Expand Up @@ -89,63 +90,67 @@ public String suchenDiff(ArrayList<String> bereitsVersucht) {
return retUrl;
}

public void updateURLsFilmlisten(boolean akt /*sonst diff*/) {
/**
* Add our default full list servers.
*/
private void insertDefaultActiveServers()
{
listeFilmlistenUrls_akt.add(new DatenFilmlisteUrl("http://m.picn.de/f/Filmliste-akt.xz", DatenFilmlisteUrl.SERVER_ART_AKT));
listeFilmlistenUrls_akt.add(new DatenFilmlisteUrl("http://m1.picn.de/f/Filmliste-akt.xz", DatenFilmlisteUrl.SERVER_ART_AKT));
listeFilmlistenUrls_akt.add(new DatenFilmlisteUrl("http://m2.picn.de/f/Filmliste-akt.xz", DatenFilmlisteUrl.SERVER_ART_AKT));
listeFilmlistenUrls_akt.add(new DatenFilmlisteUrl("http://download10.onlinetvrecorder.com/mediathekview/Filmliste-akt.xz", DatenFilmlisteUrl.SERVER_ART_AKT));
listeFilmlistenUrls_akt.add(new DatenFilmlisteUrl("http://mediathekview.jankal.me/Filmliste-akt.xz", DatenFilmlisteUrl.SERVER_ART_AKT));
listeFilmlistenUrls_akt.add(new DatenFilmlisteUrl("http://verteiler1.mediathekview.de/Filmliste-akt.xz", DatenFilmlisteUrl.SERVER_ART_AKT));
listeFilmlistenUrls_akt.add(new DatenFilmlisteUrl("http://verteiler2.mediathekview.de/Filmliste-akt.xz", DatenFilmlisteUrl.SERVER_ART_AKT));
listeFilmlistenUrls_akt.add(new DatenFilmlisteUrl("http://verteiler3.mediathekview.de/Filmliste-akt.xz", DatenFilmlisteUrl.SERVER_ART_AKT));
}

/**
* Add our default diff list servers.
*/
private void insertDefaultDifferentialListServers()
{
listeFilmlistenUrls_diff.add(new DatenFilmlisteUrl("http://m.picn.de/f/Filmliste-diff.xz", DatenFilmlisteUrl.SERVER_ART_DIFF));
listeFilmlistenUrls_diff.add(new DatenFilmlisteUrl("http://m1.picn.de/f/Filmliste-diff.xz", DatenFilmlisteUrl.SERVER_ART_DIFF));
listeFilmlistenUrls_diff.add(new DatenFilmlisteUrl("http://m2.picn.de/f/Filmliste-diff.xz", DatenFilmlisteUrl.SERVER_ART_DIFF));
listeFilmlistenUrls_diff.add(new DatenFilmlisteUrl("http://download10.onlinetvrecorder.com/mediathekview/Filmliste-diff.xz", DatenFilmlisteUrl.SERVER_ART_DIFF));
listeFilmlistenUrls_diff.add(new DatenFilmlisteUrl("http://mediathekview.jankal.me/Filmliste-diff.xz", DatenFilmlisteUrl.SERVER_ART_DIFF));
listeFilmlistenUrls_diff.add(new DatenFilmlisteUrl("http://verteiler1.mediathekview.de/Filmliste-diff.xz", DatenFilmlisteUrl.SERVER_ART_DIFF));
listeFilmlistenUrls_diff.add(new DatenFilmlisteUrl("http://verteiler2.mediathekview.de/Filmliste-diff.xz", DatenFilmlisteUrl.SERVER_ART_DIFF));
listeFilmlistenUrls_diff.add(new DatenFilmlisteUrl("http://verteiler3.mediathekview.de/Filmliste-diff.xz", DatenFilmlisteUrl.SERVER_ART_DIFF));
}

/**
* Update the download server URLs.
* @param updateFullList if true, update full list server, otherwise diff servers.
**/
public void updateURLsFilmlisten(final boolean updateFullList) {
ListeFilmlistenUrls tmp = new ListeFilmlistenUrls();
if (akt) {
if (updateFullList) {
getDownloadUrlsFilmlisten(Const.ADRESSE_FILMLISTEN_SERVER_AKT, tmp, Config.getUserAgent(), DatenFilmlisteUrl.SERVER_ART_AKT);
// if (tmp.isEmpty()) {
// getDownloadUrlsFilmlisten(Const.ADRESSE_FILMLISTEN_SERVER_AKT_RES, tmp, Config.getUserAgent(), DatenFilmlisteUrl.SERVER_ART_AKT);
// }
if (!tmp.isEmpty()) {
listeFilmlistenUrls_akt = tmp;
} else if (listeFilmlistenUrls_akt.isEmpty()) {
listeFilmlistenUrls_akt.add(new DatenFilmlisteUrl("http://wp11128329.server-he.de/filme/Filmliste-akt.xz", DatenFilmlisteUrl.SERVER_ART_AKT));
listeFilmlistenUrls_akt.add(new DatenFilmlisteUrl("http://wp11234018.server-he.de/filme/Filmliste-akt.xz", DatenFilmlisteUrl.SERVER_ART_AKT));
listeFilmlistenUrls_akt.add(new DatenFilmlisteUrl("http://mv.mynews.de/filme/Filmliste-akt.xz", DatenFilmlisteUrl.SERVER_ART_AKT));
listeFilmlistenUrls_akt.add(new DatenFilmlisteUrl("http://mv.hostingkunde.de/filme/Filmliste-akt.xz", DatenFilmlisteUrl.SERVER_ART_AKT));
listeFilmlistenUrls_akt.add(new DatenFilmlisteUrl("http://mv-1.df-kunde.de/filme/Filmliste-akt.xz", DatenFilmlisteUrl.SERVER_ART_AKT));
listeFilmlistenUrls_akt.add(new DatenFilmlisteUrl("http://mv-2.df-kunde.de/filme/Filmliste-akt.xz", DatenFilmlisteUrl.SERVER_ART_AKT));
listeFilmlistenUrls_akt.add(new DatenFilmlisteUrl("http://mv-3.df-kunde.de/filme/Filmliste-akt.xz", DatenFilmlisteUrl.SERVER_ART_AKT));

listeFilmlistenUrls_akt.add(new DatenFilmlisteUrl("http://hosting1735.af906.netcup.net/filme/Filmliste-akt.xz", DatenFilmlisteUrl.SERVER_ART_AKT));
listeFilmlistenUrls_akt.add(new DatenFilmlisteUrl("http://hosting1766.af915.netcup.net/filme/Filmliste-akt.xz", DatenFilmlisteUrl.SERVER_ART_AKT));
listeFilmlistenUrls_akt.add(new DatenFilmlisteUrl("http://hosting1767.af915.netcup.net/filme/Filmliste-akt.xz", DatenFilmlisteUrl.SERVER_ART_AKT));
listeFilmlistenUrls_akt.add(new DatenFilmlisteUrl("http://mediathek.alfahosting.org/filme/Filmliste-akt.xz", DatenFilmlisteUrl.SERVER_ART_AKT));
listeFilmlistenUrls_akt.add(new DatenFilmlisteUrl("http://mediathekview.alfahosting.org/filme/Filmliste-akt.xz", DatenFilmlisteUrl.SERVER_ART_AKT));
insertDefaultActiveServers();
}
listeFilmlistenUrls_akt.sort();
} else {
getDownloadUrlsFilmlisten(Const.ADRESSE_FILMLISTEN_SERVER_DIFF, tmp, Config.getUserAgent(), DatenFilmlisteUrl.SERVER_ART_DIFF);
// if (tmp.isEmpty()) {
// getDownloadUrlsFilmlisten(Const.ADRESSE_FILMLISTEN_SERVER_DIFF_RES, tmp, Config.getUserAgent(), DatenFilmlisteUrl.SERVER_ART_DIFF);
// }
if (!tmp.isEmpty()) {
listeFilmlistenUrls_diff = tmp;
} else if (listeFilmlistenUrls_diff.isEmpty()) {
listeFilmlistenUrls_diff.add(new DatenFilmlisteUrl("http://wp11128329.server-he.de/filme/Filmliste-diff.xz", DatenFilmlisteUrl.SERVER_ART_DIFF));
listeFilmlistenUrls_diff.add(new DatenFilmlisteUrl("http://wp11234018.server-he.de/filme/Filmliste-diff.xz", DatenFilmlisteUrl.SERVER_ART_DIFF));
listeFilmlistenUrls_diff.add(new DatenFilmlisteUrl("http://mv.mynews.de/filme/Filmliste-diff.xz", DatenFilmlisteUrl.SERVER_ART_DIFF));
listeFilmlistenUrls_diff.add(new DatenFilmlisteUrl("http://mv.hostingkunde.de/filme/Filmliste-diff.xz", DatenFilmlisteUrl.SERVER_ART_DIFF));
listeFilmlistenUrls_diff.add(new DatenFilmlisteUrl("http://mv-1.df-kunde.de/filme/Filmliste-diff.xz", DatenFilmlisteUrl.SERVER_ART_DIFF));
listeFilmlistenUrls_diff.add(new DatenFilmlisteUrl("http://mv-2.df-kunde.de/filme/Filmliste-diff.xz", DatenFilmlisteUrl.SERVER_ART_DIFF));
listeFilmlistenUrls_diff.add(new DatenFilmlisteUrl("http://mv-3.df-kunde.de/filme/Filmliste-diff.xz", DatenFilmlisteUrl.SERVER_ART_DIFF));

listeFilmlistenUrls_diff.add(new DatenFilmlisteUrl("http://hosting1735.af906.netcup.net/filme/Filmliste-diff.xz", DatenFilmlisteUrl.SERVER_ART_DIFF));
listeFilmlistenUrls_diff.add(new DatenFilmlisteUrl("http://hosting1766.af915.netcup.net/filme/Filmliste-diff.xz", DatenFilmlisteUrl.SERVER_ART_DIFF));
listeFilmlistenUrls_diff.add(new DatenFilmlisteUrl("http://hosting1767.af915.netcup.net/filme/Filmliste-diff.xz", DatenFilmlisteUrl.SERVER_ART_DIFF));
listeFilmlistenUrls_diff.add(new DatenFilmlisteUrl("http://mediathek.alfahosting.org/filme/Filmliste-diff.xz", DatenFilmlisteUrl.SERVER_ART_DIFF));
listeFilmlistenUrls_diff.add(new DatenFilmlisteUrl("http://mediathekview.alfahosting.org/filme/Filmliste-diff.xz", DatenFilmlisteUrl.SERVER_ART_DIFF));
insertDefaultDifferentialListServers();
}
listeFilmlistenUrls_diff.sort();
}
if (tmp.isEmpty()) {
Log.errorLog(491203216, new String[]{"Es ist ein Fehler aufgetreten!",
"Es konnten keine Updateserver zum aktualisieren der Filme",
"gefunden werden."});
"Es konnten keine Updateserver zum aktualisieren der Filme",
"gefunden werden."});
}
}

public static void getDownloadUrlsFilmlisten(String dateiUrl, ListeFilmlistenUrls listeFilmlistenUrls, String userAgent, String art) {
public void getDownloadUrlsFilmlisten(String dateiUrl, ListeFilmlistenUrls listeFilmlistenUrls, String userAgent, String art) {
//String[] ret = new String[]{""/* version */, ""/* release */, ""/* updateUrl */};
try {
int event;
Expand Down Expand Up @@ -177,7 +182,7 @@ public static void getDownloadUrlsFilmlisten(String dateiUrl, ListeFilmlistenUrl
String parsername = parser.getLocalName();
if (parsername.equals("Server")) {
//wieder ein neuer Server, toll
getServer(parser, listeFilmlistenUrls, art);
parseServerEntry(parser, listeFilmlistenUrls, art);
}
}
}
Expand All @@ -186,7 +191,13 @@ public static void getDownloadUrlsFilmlisten(String dateiUrl, ListeFilmlistenUrl
}
}

private static void getServer(XMLStreamReader parser, ListeFilmlistenUrls listeFilmlistenUrls, String art) {
/**
* Parse the server XML file.
* @param parser
* @param listeFilmlistenUrls
* @param art
*/
private void parseServerEntry(XMLStreamReader parser, ListeFilmlistenUrls listeFilmlistenUrls, String art) {
String serverUrl = "";
String prio = "";
int event;
Expand Down
12 changes: 8 additions & 4 deletions src/main/java/mSearch/tool/Functions.java
Original file line number Diff line number Diff line change
Expand Up @@ -177,17 +177,21 @@ public static String getBuildNr() {
}

public static void unescape(DatenFilm film) {
// Thema
film.arr[DatenFilm.FILM_THEMA] = StringEscapeUtils.unescapeXml(film.arr[DatenFilm.FILM_THEMA].trim());
film.arr[DatenFilm.FILM_THEMA] = StringEscapeUtils.unescapeHtml4(film.arr[DatenFilm.FILM_THEMA].trim());
film.arr[DatenFilm.FILM_THEMA] = StringEscapeUtils.unescapeJava(film.arr[DatenFilm.FILM_THEMA].trim());

// Titel
film.arr[DatenFilm.FILM_TITEL] = StringEscapeUtils.unescapeXml(film.arr[DatenFilm.FILM_TITEL].trim());
film.arr[DatenFilm.FILM_TITEL] = StringEscapeUtils.unescapeHtml4(film.arr[DatenFilm.FILM_TITEL].trim());
film.arr[DatenFilm.FILM_TITEL] = StringEscapeUtils.unescapeJava(film.arr[DatenFilm.FILM_TITEL].trim());

// Beschreibung
film.arr[DatenFilm.FILM_BESCHREIBUNG] = StringEscapeUtils.unescapeXml(film.arr[DatenFilm.FILM_BESCHREIBUNG].trim());
film.arr[DatenFilm.FILM_BESCHREIBUNG] = StringEscapeUtils.unescapeHtml4(film.arr[DatenFilm.FILM_BESCHREIBUNG].trim());
film.arr[DatenFilm.FILM_BESCHREIBUNG] = StringEscapeUtils.unescapeJava(film.arr[DatenFilm.FILM_BESCHREIBUNG].trim());
film.arr[DatenFilm.FILM_BESCHREIBUNG] = removeHtml(film.arr[DatenFilm.FILM_BESCHREIBUNG]);

// Titel
film.arr[DatenFilm.FILM_TITEL] = StringEscapeUtils.unescapeXml(film.arr[DatenFilm.FILM_TITEL].trim());
film.arr[DatenFilm.FILM_TITEL] = StringEscapeUtils.unescapeHtml4(film.arr[DatenFilm.FILM_TITEL].trim());
}

// public static String utf8(String ret) {
Expand Down

0 comments on commit ea2911c

Please sign in to comment.