initial commit
This commit is contained in:
Generated
+5
@@ -31,6 +31,11 @@
|
||||
<option name="name" value="bintray" />
|
||||
<option name="url" value="https://jcenter.bintray.com" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="mvnrepository" />
|
||||
<option name="name" value="mvnrepository" />
|
||||
<option name="url" value="http://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jcenter" />
|
||||
<option name="name" value="jcenter" />
|
||||
|
||||
@@ -36,6 +36,16 @@
|
||||
<name>jcenter</name>
|
||||
<url>https://jcenter.bintray.com</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>mvnrepository</id>
|
||||
<url>http://repo1.maven.org/maven2</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
@@ -106,11 +116,19 @@
|
||||
<artifactId>silvertail</artifactId>
|
||||
<version>${zk.version}</version>
|
||||
</dependency>
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>info.movito</groupId>
|
||||
<artifactId>themoviedbapi</artifactId>
|
||||
<version>1.10</version>
|
||||
</dependency>
|
||||
-->
|
||||
<!-- https://mvnrepository.com/artifact/com.omertron/themoviedbapi -->
|
||||
<dependency>
|
||||
<groupId>com.omertron</groupId>
|
||||
<artifactId>themoviedbapi</artifactId>
|
||||
<version>4.3</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
|
||||
@@ -1,12 +1,30 @@
|
||||
package at.windesign.application.serie;
|
||||
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import com.omertron.themoviedbapi.TheMovieDbApi;
|
||||
import com.omertron.themoviedbapi.enumeration.TVMethod;
|
||||
import com.omertron.themoviedbapi.methods.TmdbSeasons;
|
||||
import com.omertron.themoviedbapi.methods.TmdbTV;
|
||||
import com.omertron.themoviedbapi.model.Genre;
|
||||
import com.omertron.themoviedbapi.model.credits.MediaCreditCast;
|
||||
import com.omertron.themoviedbapi.model.credits.MediaCreditCrew;
|
||||
import com.omertron.themoviedbapi.model.movie.ProductionCompany;
|
||||
import com.omertron.themoviedbapi.model.network.Network;
|
||||
import com.omertron.themoviedbapi.model.person.PersonBasic;
|
||||
import com.omertron.themoviedbapi.model.tv.*;
|
||||
import com.omertron.themoviedbapi.tools.HttpTools;
|
||||
import org.yamj.api.common.http.SimpleHttpClientBuilder;
|
||||
import org.zkoss.zul.ListModelList;
|
||||
import org.apache.http.client.HttpClient;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import static org.zkoss.zk.ui.util.Clients.alert;
|
||||
|
||||
class serieData
|
||||
{
|
||||
private int m_seriesID;
|
||||
@@ -548,7 +566,7 @@ class serieData
|
||||
try
|
||||
{
|
||||
Connection conn = ds.getConnection();
|
||||
Statement stmt = conn.createStatement();
|
||||
Statement stmt = conn.createStatement();
|
||||
stmt.execute("DELETE FROM serie WHERE seriesID=" + m_seriesID + ";");
|
||||
|
||||
PreparedStatement ps = conn.prepareStatement("INSERT INTO serie (" +
|
||||
@@ -650,4 +668,225 @@ class serieData
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
String personListToString(List<PersonBasic> personList)
|
||||
{
|
||||
String str = "";
|
||||
boolean first = true;
|
||||
|
||||
for(PersonBasic p : personList)
|
||||
{
|
||||
if(first)
|
||||
first = false;
|
||||
else
|
||||
str = str + ",";
|
||||
str = str + p.getName();
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
String stringListToString(List<String> stringList)
|
||||
{
|
||||
String str = "";
|
||||
boolean first = true;
|
||||
|
||||
for(String s : stringList)
|
||||
{
|
||||
if(first)
|
||||
first = false;
|
||||
else
|
||||
str = str + ",";
|
||||
str = str + s;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
String networkListToString(List<Network> networkList)
|
||||
{
|
||||
String str = "";
|
||||
boolean first = true;
|
||||
|
||||
for(Network n : networkList)
|
||||
{
|
||||
if(first)
|
||||
first = false;
|
||||
else
|
||||
str = str + ",";
|
||||
str = str + n.getName();
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
String productionCompaniesListToString(List<ProductionCompany> productionCompanyList)
|
||||
{
|
||||
String str = "";
|
||||
boolean first = true;
|
||||
|
||||
for(ProductionCompany c : productionCompanyList)
|
||||
{
|
||||
if(first)
|
||||
first = false;
|
||||
else
|
||||
str = str + ",";
|
||||
str = str + c.getName();
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
String castListToString(List<MediaCreditCast> castList)
|
||||
{
|
||||
String str = "";
|
||||
boolean first = true;
|
||||
|
||||
for(MediaCreditCast p : castList)
|
||||
{
|
||||
if(first)
|
||||
first = false;
|
||||
else
|
||||
str = str + "|";
|
||||
str = str + p.getName() + "," + p.getCharacter();
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
String crewListToString(List<MediaCreditCrew> crewList)
|
||||
{
|
||||
String str = "";
|
||||
boolean first = true;
|
||||
|
||||
for(MediaCreditCrew p : crewList)
|
||||
{
|
||||
if(first)
|
||||
first = false;
|
||||
else
|
||||
str = str + "|";
|
||||
str = str + p.getName() + "," + p.getJob();
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
String genreListToString(List<Genre> genreList)
|
||||
{
|
||||
String str = "";
|
||||
boolean first = true;
|
||||
|
||||
for(Genre g : genreList)
|
||||
{
|
||||
if(first)
|
||||
first = false;
|
||||
else
|
||||
str = str + ",";
|
||||
str = str + g.getName();
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
Date string2Date(String strDate)
|
||||
{
|
||||
if(strDate == null)
|
||||
return new Date(1900, 1, 1);
|
||||
else
|
||||
return Date.valueOf(strDate);
|
||||
}
|
||||
|
||||
public boolean fromTMDB(int id) throws MovieDbException
|
||||
{
|
||||
HttpClient httpClient;
|
||||
HttpTools httpTools;
|
||||
|
||||
httpClient = new SimpleHttpClientBuilder().build();
|
||||
httpTools = new HttpTools(httpClient);
|
||||
|
||||
TheMovieDbApi api = new TheMovieDbApi("a33271b9e54cdcb9a80680eaf5522f1b", httpClient);
|
||||
return fromTMDB(id, api);
|
||||
}
|
||||
|
||||
public boolean fromTMDB(int id, TheMovieDbApi api) throws MovieDbException
|
||||
{
|
||||
String appendToResponse = "credits,external_ids";
|
||||
|
||||
TVInfo series = api.getTVInfo(id, "de", appendToResponse);
|
||||
|
||||
m_seriesID = series.getId();
|
||||
m_seriesName = series.getName();
|
||||
m_seriesOriginalName = series.getOriginalName();
|
||||
m_seriesBackdrop = series.getBackdropPath();
|
||||
m_seriesCreatedBy = personListToString(series.getCreatedBy());
|
||||
m_seriesHomepage = series.getHomepage();
|
||||
m_seriesLastAired = string2Date(series.getLastAirDate());
|
||||
m_seriesLanguages = stringListToString(series.getLanguages());
|
||||
m_seriesNetworks = networkListToString(series.getNetworks());
|
||||
m_seriesNrEpisodes = series.getNumberOfEpisodes();
|
||||
m_seriesNrSeasons = series.getNumberOfSeasons();
|
||||
m_seriesOriginCountries = stringListToString(series.getOriginCountry());
|
||||
m_seriesOriginalLanguage = series.getOriginalLanguage();
|
||||
m_seriesPopularity = series.getPopularity();
|
||||
m_seriesPoster = series.getPosterPath();
|
||||
m_seriesProductionCompanies = productionCompaniesListToString(series.getProductionCompanies());
|
||||
m_seriesType = series.getType();
|
||||
m_seriesVoteAverage = series.getVoteAverage();
|
||||
m_seriesVoteCount = series.getVoteCount();
|
||||
m_seriesOverview = series.getOverview();
|
||||
m_seriesFirstAired = string2Date(series.getFirstAirDate());
|
||||
m_seriesCast = castListToString(series.getCredits().getCast());
|
||||
m_seriesCrew = crewListToString(series.getCredits().getCrew());
|
||||
m_seriesGenre = genreListToString(series.getGenres());
|
||||
m_seriesIMDBID = series.getExternalIDs().getImdbId();
|
||||
m_seriesFreebaseMID = series.getExternalIDs().getFreebaseMid();
|
||||
m_seriesFreebaseID = series.getExternalIDs().getFreebaseId();
|
||||
m_seriesTVDBID = series.getExternalIDs().getTvdbId();
|
||||
m_seriesTVRageID = series.getExternalIDs().getTvrageId();
|
||||
m_seriesStatus = series.getStatus();
|
||||
|
||||
if(series.getSeasons() != null)
|
||||
{
|
||||
for(TVSeasonBasic season : series.getSeasons())
|
||||
{
|
||||
TVSeasonInfo seasons = api.getSeasonInfo(id, season.getSeasonNumber(), "de");
|
||||
seasonData sData = new seasonData();
|
||||
|
||||
//sData.setSeason_ID();
|
||||
sData.setSeasonAirDate(string2Date(seasons.getAirDate()));
|
||||
sData.setSeasonName(seasons.getName());
|
||||
sData.setSeasonOverview(seasons.getOverview());
|
||||
sData.setSeasonID(seasons.getId());
|
||||
sData.setSeasonPosterPath(seasons.getPosterPath());
|
||||
sData.setSeasonNumber(seasons.getSeasonNumber());
|
||||
sData.setSerie(this);
|
||||
m_seasons.put(season.getSeasonNumber(), sData);
|
||||
|
||||
if(seasons.getEpisodes() != null)
|
||||
{
|
||||
for(TVEpisodeInfo episode : seasons.getEpisodes())
|
||||
{
|
||||
episodeData eData = new episodeData();
|
||||
|
||||
eData.setEpisodeID(episode.getId());
|
||||
eData.setEpisodeName(episode.getName());
|
||||
eData.setEpisodeNumber(episode.getEpisodeNumber());
|
||||
eData.setEpisodeAirDate(string2Date(episode.getAirDate()));
|
||||
eData.setEpisodeGuestStars(castListToString(episode.getGuestStars()));
|
||||
eData.setEpisodeOverview(episode.getOverview());
|
||||
eData.setEpisodeProductionCode(episode.getProductionCode());
|
||||
eData.setSeason(sData);
|
||||
eData.setSerie(this);
|
||||
eData.setEpisodeStillPath(episode.getStillPath());
|
||||
eData.setEpisodeVoteAverage(episode.getVoteAverage());
|
||||
eData.setEpisodeVoteCount(episode.getVoteCount());
|
||||
eData.setEpisodeCrew(crewListToString(episode.getCrew()));
|
||||
sData.setEpisode(eData.getEpisodeNumber(), eData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,10 +18,6 @@ import java.sql.Statement;
|
||||
import java.util.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import info.movito.themoviedbapi.TmdbApi;
|
||||
import info.movito.themoviedbapi.TmdbMovies;
|
||||
import info.movito.themoviedbapi.model.MovieDb;
|
||||
|
||||
public class serieDetailsForwardComposer extends GenericForwardComposer<Component>
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package at.windesign.application.serie;
|
||||
|
||||
import info.movito.themoviedbapi.TmdbApi;
|
||||
import info.movito.themoviedbapi.TmdbTV;
|
||||
import info.movito.themoviedbapi.model.tv.TvSeason;
|
||||
import info.movito.themoviedbapi.model.tv.TvSeries;
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.select.SelectorComposer;
|
||||
@@ -64,13 +61,55 @@ public class serieDetailsSelectorComposer extends SelectorComposer<Component>
|
||||
public void update()
|
||||
{
|
||||
serieData serie = (serieData) detailsSerie.getAttribute("serie");
|
||||
/*
|
||||
TmdbApi tmdbAPI = new TmdbApi("a33271b9e54cdcb9a80680eaf5522f1b");
|
||||
TmdbTV tmdbTV = tmdbAPI.getTvSeries();
|
||||
TvSeries series = tmdbTV.getSeries(60948, "de");
|
||||
serieData serieNew;
|
||||
|
||||
TvSeason season = tmdbAPI.getTvSeasons().getSeason(60948, 2, "de");
|
||||
*/
|
||||
try
|
||||
{
|
||||
serieNew = new serieData();
|
||||
serieNew.fromTMDB(serie.getSeriesID());
|
||||
serieNew.setSeriesDownload(serie.getSeriesDownload());
|
||||
serieNew.setSeriesLocalPath(serie.getSeriesLocalPath());
|
||||
serieNew.setSeriesResolution(serie.getSeriesResolution());
|
||||
serieNew.setSeriesCliffhanger(serie.getSeriesCliffhanger());
|
||||
|
||||
for(int season : serieNew.getSeasons().keySet())
|
||||
{
|
||||
seasonData sDataOriginal = serie.getSeasons().get(season);
|
||||
|
||||
if(sDataOriginal != null)
|
||||
{
|
||||
seasonData sData = serieNew.getSeasons().get(season);
|
||||
|
||||
for(int episode : sData.getEpisodes().keySet())
|
||||
{
|
||||
episodeData eDataOriginal = sDataOriginal.getEpisodes().get(episode);
|
||||
|
||||
if(eDataOriginal != null)
|
||||
{
|
||||
episodeData eData = sData.getEpisodes().get(episode);
|
||||
|
||||
eData.setEpisodeState(eDataOriginal.getEpisodeState());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
serieNew.recalcState();
|
||||
serieNew.save();
|
||||
|
||||
Listitem item = (Listitem) detailsSerie.getAttribute("item");
|
||||
ListModelList model = serie.getModel();
|
||||
|
||||
int index = item.getIndex();
|
||||
|
||||
serieNew.setModel(model);
|
||||
model.remove(index);
|
||||
model.add(index, serieNew);
|
||||
}
|
||||
catch(MovieDbException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
detailsSerie.onClose();
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
pack="center">
|
||||
<button id="saveButton" label="Save"/>
|
||||
<button id="cancelButton" label="Cancel"/>
|
||||
<button id="updateButton" label="Update"/>
|
||||
<button id="updateButton" label="Update from TMDB"/>
|
||||
<button id="deleteButton" label="Delete"/>
|
||||
</hbox>
|
||||
</window>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,5 +1,5 @@
|
||||
#Generated by Maven
|
||||
#Tue Nov 24 15:50:38 CET 2020
|
||||
#Wed Nov 25 09:49:24 CET 2020
|
||||
groupId=at.windesign.application
|
||||
artifactId=multimedia
|
||||
version=1.0-SNAPSHOT
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
at\windesign\application\serie\serieDataSource.class
|
||||
at\windesign\application\serie\serieListForwardComposer.class
|
||||
at\windesign\application\testing\testForwardComposer.class
|
||||
at\windesign\application\serie\seasonData.class
|
||||
at\windesign\application\serie\serieRenderer.class
|
||||
at\windesign\application\serie\serieData.class
|
||||
at\windesign\application\serie\serieDetailsForwardComposer$1.class
|
||||
at\windesign\application\serie\serieDetailsForwardComposer.class
|
||||
at\windesign\application\serie\serieDetailsSelectorComposer$1.class
|
||||
at\windesign\application\serie\serieDataSource.class
|
||||
at\windesign\application\serie\serieListForwardComposer.class
|
||||
at\windesign\application\serie\serieDetailsSelectorComposer.class
|
||||
at\windesign\application\testing\testForwardComposer.class
|
||||
at\windesign\application\serie\serieListSelectorComposer.class
|
||||
at\windesign\application\serie\episodeData.class
|
||||
at\windesign\application\main\indexForwardComposer.class
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,92 @@
|
||||
<window id="test"
|
||||
title="Hi"
|
||||
contentStyle="overflow:auto"
|
||||
border="normal"
|
||||
apply="at.windesign.application.testing.testForwardComposer"
|
||||
width="500px"
|
||||
height="500px"
|
||||
>
|
||||
|
||||
<style>
|
||||
.grid {
|
||||
display: grid;
|
||||
grid-template-columns: 4fr 4fr 1fr 1fr;
|
||||
grid-gap: 10px;
|
||||
justify-items: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
<groupbox id="overview"
|
||||
>
|
||||
<caption>Overview</caption>
|
||||
<label id="overviewLabel"
|
||||
value=""/>
|
||||
</groupbox>
|
||||
|
||||
<groupbox id="settings"
|
||||
>
|
||||
<caption>Settings</caption>
|
||||
|
||||
<nodom>
|
||||
<div sclass="grid"
|
||||
width="100%">
|
||||
<label value="Download Link"/>
|
||||
<label value="Local Path"/>
|
||||
<label value="Resolution"/>
|
||||
<label value="Cliffhanger"/>
|
||||
<textbox id="downloadLink"
|
||||
width="100%"
|
||||
tabindex="1"/>
|
||||
<textbox id="localPath"
|
||||
width="100%"
|
||||
tabindex="2"/>
|
||||
<combobox id="resolution"
|
||||
width="100%"
|
||||
tabindex="3"/>
|
||||
<checkbox id="cliffhanger"
|
||||
tabindex="4"/>
|
||||
</div>
|
||||
</nodom>
|
||||
</groupbox>
|
||||
|
||||
<groupbox
|
||||
>
|
||||
<caption>Test</caption>
|
||||
|
||||
<vlayout>
|
||||
<label value="blablabla"/>
|
||||
<label value="blablabla"/>
|
||||
<label value="blablabla"/>
|
||||
<label value="blablabla"/>
|
||||
<label value="blablabla"/>
|
||||
<label value="blablabla"/>
|
||||
<label value="blablabla"/>
|
||||
<label value="blablabla"/>
|
||||
<label value="blablabla"/>
|
||||
<label value="blablabla"/>
|
||||
<label value="blablabla"/>
|
||||
<label value="blablabla"/>
|
||||
<label value="blablabla"/>
|
||||
<label value="blablabla"/>
|
||||
<label value="blablabla"/>
|
||||
<label value="blablabla"/>
|
||||
<label value="blablabla"/>
|
||||
<label value="blablabla"/>
|
||||
<label value="blablabla"/>
|
||||
<label value="blablabla"/>
|
||||
<label value="blablabla"/>
|
||||
<label value="blablabla"/>
|
||||
<label value="blablabla"/>
|
||||
<label value="blablabla"/>
|
||||
<label value="blablabla"/>
|
||||
</vlayout>
|
||||
</groupbox>
|
||||
|
||||
<hbox id="buttons"
|
||||
width="100%"
|
||||
pack="center">
|
||||
<button id="saveButton" label="Save"/>
|
||||
<button id="cancelButton" label="Cancel"/>
|
||||
<button id="deleteButton" label="Delete"/>
|
||||
</hbox>
|
||||
</window>
|
||||
Reference in New Issue
Block a user