.
This commit is contained in:
@@ -236,6 +236,7 @@ void cEdit::on_m_lpTabWidget_tabBarClicked(int index)
|
||||
{
|
||||
if(!m_bLoaded)
|
||||
{
|
||||
/*
|
||||
cMessageAnimateDialog* lpDialog = new cMessageAnimateDialog(this);
|
||||
lpDialog->setTitle("Edit");
|
||||
lpDialog->setMessage("Loading");
|
||||
@@ -271,6 +272,7 @@ void cEdit::on_m_lpTabWidget_tabBarClicked(int index)
|
||||
delete lpDialog;
|
||||
|
||||
m_bLoaded = true;
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+67
-98
@@ -1,25 +1,25 @@
|
||||
#include "cepisode.h"
|
||||
#include "common.h"
|
||||
|
||||
|
||||
#define DELETE(x) { if(x) delete x;x = 0;}
|
||||
|
||||
cEpisode::cEpisode() :
|
||||
m_iID(-1),
|
||||
m_szDirector(""),
|
||||
m_szEpisodeName(""),
|
||||
m_szName(""),
|
||||
m_iEpisodeNumber(-1),
|
||||
m_firstAired(QDate(1900, 1, 1)),
|
||||
m_szGuestStars(""),
|
||||
m_szIMDBID(""),
|
||||
m_szLanguage(""),
|
||||
m_airDate(QDate(1900, 1, 1)),
|
||||
m_szOverview(""),
|
||||
m_szProductionCode(""),
|
||||
m_dRating(-1.0),
|
||||
m_iRatingCount(-1),
|
||||
m_iSeasonNumber(-1),
|
||||
m_szWriter(""),
|
||||
m_iSeasonID(-1),
|
||||
m_iSeriesID(-1),
|
||||
m_szStillPath(""),
|
||||
m_dVoteAverage(-1.0),
|
||||
m_iVoteCount(-1),
|
||||
// m_szFileName(""),
|
||||
// m_iThumbHeight(-1),
|
||||
// m_iThumbWidth(-1),
|
||||
m_state(cEpisode::StateInit),
|
||||
m_lpGroup(0),
|
||||
m_lpLabel(0),
|
||||
@@ -44,31 +44,14 @@ qint32 cEpisode::id()
|
||||
return(m_iID);
|
||||
}
|
||||
|
||||
void cEpisode::setDirector(const QString& szDirector)
|
||||
void cEpisode::setName(const QString& szName)
|
||||
{
|
||||
m_szDirector = szDirector.split("|");
|
||||
m_szDirector.removeAll("");
|
||||
m_szName = szName;
|
||||
}
|
||||
|
||||
void cEpisode::setDirector(const QStringList& szDirector)
|
||||
QString cEpisode::name()
|
||||
{
|
||||
m_szDirector = szDirector;
|
||||
m_szDirector.removeAll("");
|
||||
}
|
||||
|
||||
QStringList cEpisode::director()
|
||||
{
|
||||
return(m_szDirector);
|
||||
}
|
||||
|
||||
void cEpisode::setEpisodeName(const QString& szEpisodeName)
|
||||
{
|
||||
m_szEpisodeName = szEpisodeName;
|
||||
}
|
||||
|
||||
QString cEpisode::episodeName()
|
||||
{
|
||||
return(m_szEpisodeName);
|
||||
return(m_szName);
|
||||
}
|
||||
|
||||
void cEpisode::setEpisodeNumber(const qint16& iEpisodeNumber)
|
||||
@@ -81,31 +64,29 @@ qint16 cEpisode::episodeNumber()
|
||||
return(m_iEpisodeNumber);
|
||||
}
|
||||
|
||||
void cEpisode::setFirstAired(const QString& szFirstAired)
|
||||
void cEpisode::setAirDate(const QString& szAirDate)
|
||||
{
|
||||
m_firstAired = QDate::fromString(szFirstAired, "yyyy-MM-dd");
|
||||
m_airDate = QDate::fromString(szAirDate, "yyyy-MM-dd");
|
||||
}
|
||||
|
||||
void cEpisode::setFirstAired(const QDate& firstAired)
|
||||
void cEpisode::setAirDate(const QDate& airDate)
|
||||
{
|
||||
m_firstAired = firstAired;
|
||||
m_airDate = airDate;
|
||||
}
|
||||
|
||||
QDate cEpisode::firstAired()
|
||||
QDate cEpisode::airDate()
|
||||
{
|
||||
return(m_firstAired);
|
||||
return(m_airDate);
|
||||
}
|
||||
|
||||
void cEpisode::setGuestStars(const QString& szGuestStars)
|
||||
{
|
||||
m_szGuestStars = szGuestStars.split("|");
|
||||
m_szGuestStars.removeAll("");
|
||||
}
|
||||
|
||||
void cEpisode::setGuestStars(const QStringList& szGuestStars)
|
||||
{
|
||||
m_szGuestStars = szGuestStars;
|
||||
m_szGuestStars.removeAll("");
|
||||
m_szGuestStars = cleanList(szGuestStars);
|
||||
}
|
||||
|
||||
QStringList cEpisode::guestStars()
|
||||
@@ -113,26 +94,6 @@ QStringList cEpisode::guestStars()
|
||||
return(m_szGuestStars);
|
||||
}
|
||||
|
||||
void cEpisode::setIMDBID(const QString& szIMDBID)
|
||||
{
|
||||
m_szIMDBID = szIMDBID;
|
||||
}
|
||||
|
||||
QString cEpisode::imdbID()
|
||||
{
|
||||
return(m_szIMDBID);
|
||||
}
|
||||
|
||||
void cEpisode::setLanguage(const QString& szLanguage)
|
||||
{
|
||||
m_szLanguage = szLanguage;
|
||||
}
|
||||
|
||||
QString cEpisode::language()
|
||||
{
|
||||
return(m_szLanguage);
|
||||
}
|
||||
|
||||
void cEpisode::setOverview(const QString& szOverview)
|
||||
{
|
||||
m_szOverview = szOverview;
|
||||
@@ -153,26 +114,6 @@ QString cEpisode::productionCode()
|
||||
return(m_szProductionCode);
|
||||
}
|
||||
|
||||
void cEpisode::setRating(const qreal& dRating)
|
||||
{
|
||||
m_dRating = dRating;
|
||||
}
|
||||
|
||||
qreal cEpisode::rating()
|
||||
{
|
||||
return(m_dRating);
|
||||
}
|
||||
|
||||
void cEpisode::setRatingCount(const qint32& iRatingCount)
|
||||
{
|
||||
m_iRatingCount = iRatingCount;
|
||||
}
|
||||
|
||||
qint32 cEpisode::ratingCount()
|
||||
{
|
||||
return(m_iRatingCount);
|
||||
}
|
||||
|
||||
void cEpisode::setSeasonNumber(const qint16& iSeasonNumber)
|
||||
{
|
||||
m_iSeasonNumber = iSeasonNumber;
|
||||
@@ -183,23 +124,6 @@ qint16 cEpisode::seasonNumber()
|
||||
return(m_iSeasonNumber);
|
||||
}
|
||||
|
||||
void cEpisode::setWriter(const QString& szWriter)
|
||||
{
|
||||
m_szWriter = szWriter.split("|");
|
||||
m_szWriter.removeAll("");
|
||||
}
|
||||
|
||||
void cEpisode::setWriter(const QStringList& szWriter)
|
||||
{
|
||||
m_szWriter = szWriter;
|
||||
m_szWriter.removeAll("");
|
||||
}
|
||||
|
||||
QStringList cEpisode::writer()
|
||||
{
|
||||
return(m_szWriter);
|
||||
}
|
||||
|
||||
void cEpisode::setSeasonID(const qint32& iSeasonID)
|
||||
{
|
||||
m_iSeasonID = iSeasonID;
|
||||
@@ -220,6 +144,51 @@ qint32 cEpisode::seriesID()
|
||||
return(m_iSeriesID);
|
||||
}
|
||||
|
||||
void cEpisode::setStillPath(const QString& szStillPath)
|
||||
{
|
||||
m_szStillPath = szStillPath;
|
||||
}
|
||||
|
||||
QString cEpisode::stillPath()
|
||||
{
|
||||
return(m_szStillPath);
|
||||
}
|
||||
|
||||
void cEpisode::setVoteAverage(const qreal& dVoteAverage)
|
||||
{
|
||||
m_dVoteAverage = dVoteAverage;
|
||||
}
|
||||
|
||||
qreal cEpisode::voteAverage()
|
||||
{
|
||||
return(m_dVoteAverage);
|
||||
}
|
||||
|
||||
void cEpisode::setVoteCount(const qint16& iVoteCount)
|
||||
{
|
||||
m_iVoteCount = iVoteCount;
|
||||
}
|
||||
|
||||
qint16 cEpisode::voteCount()
|
||||
{
|
||||
return(m_iVoteCount);
|
||||
}
|
||||
|
||||
void cEpisode::setCrew(const QString& szCrew)
|
||||
{
|
||||
m_szCrew = szCrew.split("|");
|
||||
}
|
||||
|
||||
void cEpisode::setCrew(const QStringList& szCrew)
|
||||
{
|
||||
m_szCrew = szCrew;
|
||||
}
|
||||
|
||||
QStringList cEpisode::crew()
|
||||
{
|
||||
return(m_szCrew);
|
||||
}
|
||||
|
||||
void cEpisode::setState(const State& state)
|
||||
{
|
||||
m_state = state;
|
||||
@@ -258,7 +227,7 @@ cEpisode::State cEpisode::state()
|
||||
{
|
||||
return(m_state);
|
||||
}
|
||||
|
||||
/*
|
||||
void cEpisode::setFileName(const QString& szFileName)
|
||||
{
|
||||
m_szFileName = szFileName;
|
||||
@@ -288,7 +257,7 @@ qint16 cEpisode::thumbWidth()
|
||||
{
|
||||
return(m_iThumbWidth);
|
||||
}
|
||||
|
||||
*/
|
||||
bool cEpisode::isValid()
|
||||
{
|
||||
if(m_iSeasonID != -1 && m_iEpisodeNumber != -1 && m_iSeasonNumber != -1)
|
||||
|
||||
+35
-45
@@ -28,55 +28,48 @@ public:
|
||||
void setID(const qint32& iID);
|
||||
qint32 id();
|
||||
|
||||
void setDirector(const QString& szDirector);
|
||||
void setDirector(const QStringList& szDirector);
|
||||
QStringList director();
|
||||
|
||||
void setEpisodeName(const QString& szEpisodeName);
|
||||
QString episodeName();
|
||||
void setName(const QString& szName);
|
||||
QString name();
|
||||
|
||||
void setEpisodeNumber(const qint16& iEpisodeNumber);
|
||||
qint16 episodeNumber();
|
||||
|
||||
void setFirstAired(const QString& szFirstAired);
|
||||
void setFirstAired(const QDate& firstAired);
|
||||
QDate firstAired();
|
||||
void setAirDate(const QString& szAirDate);
|
||||
void setAirDate(const QDate& airDate);
|
||||
QDate airDate();
|
||||
|
||||
void setGuestStars(const QString& szGuestStars);
|
||||
void setGuestStars(const QStringList& szGuestStars);
|
||||
QStringList guestStars();
|
||||
|
||||
void setIMDBID(const QString& szIMDBID);
|
||||
QString imdbID();
|
||||
|
||||
void setLanguage(const QString& szLanguage);
|
||||
QString language();
|
||||
|
||||
void setOverview(const QString& szOverview);
|
||||
QString overview();
|
||||
|
||||
void setProductionCode(const QString& szProductionCode);
|
||||
QString productionCode();
|
||||
|
||||
void setRating(const qreal& dRating);
|
||||
qreal rating();
|
||||
|
||||
void setRatingCount(const qint32& iRatingCount);
|
||||
qint32 ratingCount();
|
||||
|
||||
void setSeasonNumber(const qint16& iSeasonNumber);
|
||||
qint16 seasonNumber();
|
||||
|
||||
void setWriter(const QString& szWriter);
|
||||
void setWriter(const QStringList& szWriter);
|
||||
QStringList writer();
|
||||
|
||||
void setSeasonID(const qint32& iSeasonID);
|
||||
qint32 seasonID();
|
||||
|
||||
void setSeriesID(const qint32& iSeriesID);
|
||||
qint32 seriesID();
|
||||
|
||||
void setStillPath(const QString& szStillPath);
|
||||
QString stillPath();
|
||||
|
||||
void setVoteAverage(const qreal& dVoteAverage);
|
||||
qreal voteAverage();
|
||||
|
||||
void setVoteCount(const qint16& iVoteCount);
|
||||
qint16 voteCount();
|
||||
|
||||
void setCrew(const QString& szCrew);
|
||||
void setCrew(const QStringList& szCrew);
|
||||
QStringList crew();
|
||||
|
||||
void setState(const State& state);
|
||||
State state();
|
||||
|
||||
@@ -100,26 +93,23 @@ public:
|
||||
void updateState();
|
||||
void deleteResources();
|
||||
private:
|
||||
qint32 m_iID;
|
||||
QStringList m_szDirector;
|
||||
QString m_szEpisodeName;
|
||||
qint16 m_iEpisodeNumber;
|
||||
QDate m_firstAired;
|
||||
QStringList m_szGuestStars;
|
||||
QString m_szIMDBID;
|
||||
QString m_szLanguage;
|
||||
QString m_szOverview;
|
||||
QString m_szProductionCode;
|
||||
qreal m_dRating;
|
||||
qint32 m_iRatingCount;
|
||||
qint16 m_iSeasonNumber;
|
||||
QStringList m_szWriter;
|
||||
qint32 m_iSeasonID;
|
||||
qint32 m_iSeriesID;
|
||||
State m_state;
|
||||
QString m_szFileName;
|
||||
qint16 m_iThumbHeight;
|
||||
qint16 m_iThumbWidth;
|
||||
qint32 m_iID;
|
||||
QString m_szName;
|
||||
qint16 m_iEpisodeNumber;
|
||||
QDate m_airDate;
|
||||
QStringList m_szGuestStars;
|
||||
QString m_szOverview;
|
||||
QString m_szProductionCode;
|
||||
qint16 m_iSeasonNumber;
|
||||
qint32 m_iSeasonID;
|
||||
qint32 m_iSeriesID;
|
||||
QString m_szStillPath;
|
||||
qreal m_dVoteAverage;
|
||||
qint16 m_iVoteCount;
|
||||
QStringList m_szCrew;
|
||||
State m_state;
|
||||
// qint16 m_iThumbHeight;
|
||||
// qint16 m_iThumbWidth;
|
||||
QButtonGroup* m_lpGroup;
|
||||
QLabel* m_lpLabel;
|
||||
QRadioButton* m_lpButton1;
|
||||
|
||||
+3
-3
@@ -24,7 +24,7 @@ cEpisodeDetails::~cEpisodeDetails()
|
||||
void cEpisodeDetails::setEpisode(cEpisode* lpEpisode)
|
||||
{
|
||||
m_lpEpisode = lpEpisode;
|
||||
ui->m_lpEpisodeTitle->setText(lpEpisode->episodeName());
|
||||
ui->m_lpEpisodeTitle->setText(lpEpisode->name());
|
||||
ui->m_lpOverview->setText(lpEpisode->overview());
|
||||
}
|
||||
|
||||
@@ -40,11 +40,11 @@ void cEpisodeDetails::loadImages()
|
||||
lpDialog->setTitle("Details");
|
||||
lpDialog->setMessage("Loading Images");
|
||||
lpDialog->show();
|
||||
|
||||
/*
|
||||
cImage image;
|
||||
QPixmap pixmap = image.getImage(m_lpEpisode->fileName()).scaledToHeight(200);
|
||||
ui->m_lpEpisodeThumb->setPixmap(pixmap);
|
||||
|
||||
*/
|
||||
delete lpDialog;
|
||||
|
||||
m_bLoaded = true;
|
||||
|
||||
+121
-72
@@ -3,7 +3,6 @@
|
||||
#include "cmainwindow.h"
|
||||
#include "ui_cmainwindow.h"
|
||||
|
||||
#include "cthetvdbv2.h"
|
||||
#include "cseasondelegate.h"
|
||||
#include "csearch.h"
|
||||
#include "cmoviesearch.h"
|
||||
@@ -216,29 +215,23 @@ void cMainWindow::initDB()
|
||||
|
||||
if(!m_db.tables().contains("episode"))
|
||||
{
|
||||
/*
|
||||
query.exec("CREATE TABLE episode ("
|
||||
" episodeID INTEGER,"
|
||||
" episodeName STRING,"
|
||||
" id INTEGER,"
|
||||
" name STRING,"
|
||||
" episodeNumber INTEGER,"
|
||||
" firstAired DATE,"
|
||||
" imdbid STRING,"
|
||||
" language STRING,"
|
||||
" airDate DATE,"
|
||||
" guestStars STRING,"
|
||||
" overview TEXT,"
|
||||
" productioncode STRING,"
|
||||
" rating DOUBLE,"
|
||||
" ratingCount INTEGER,"
|
||||
" seasonNumber INTEGER,"
|
||||
" seasonID INTEGER,"
|
||||
" seriesID INTEGER,"
|
||||
" state INT,"
|
||||
" filename STRING,"
|
||||
" thumb_height INT,"
|
||||
" thumb_width INT,"
|
||||
" director STRING,"
|
||||
" gueststars STRING,"
|
||||
" episode_writer STRING);");
|
||||
*/
|
||||
" stillPath STRING,"
|
||||
" voteAverage DOUBLE,"
|
||||
" voteCount INTEGER,"
|
||||
" crew STRING,"
|
||||
" state INT);");
|
||||
|
||||
}
|
||||
if(!m_db.tables().contains("movie"))
|
||||
{
|
||||
@@ -276,29 +269,84 @@ void cMainWindow::initDB()
|
||||
|
||||
void cMainWindow::loadDB()
|
||||
{
|
||||
// convertSeries();
|
||||
loadSeriesDB();
|
||||
loadMoviesDB();
|
||||
}
|
||||
|
||||
void cMainWindow::convertSeries()
|
||||
{
|
||||
QSqlQuery query;
|
||||
QString szOldIMDBID = "";
|
||||
cTheMovieDBV3 theMovieDB;
|
||||
cSerie* lpSerie = 0;
|
||||
|
||||
if(query.exec("SELECT s.imdbid, s.download, s.cliffhanger, e.episodeNumber, e.seasonNumber, e.state FROM serie_old s LEFT JOIN episode_old e ON s.id = e.seriesID WHERE s.imdbid IS NOT NULL AND s.imdbid <> \"\" ORDER BY s.imdbid, e.seasonNumber, e.episodeNumber;"))
|
||||
{
|
||||
while(query.next())
|
||||
{
|
||||
QString szIMDBID = query.value("imdbid").toString();
|
||||
|
||||
if(!szIMDBID.isEmpty())
|
||||
{
|
||||
if(szIMDBID != szOldIMDBID)
|
||||
{
|
||||
if(lpSerie)
|
||||
{
|
||||
lpSerie->save(m_db);
|
||||
delete lpSerie;
|
||||
lpSerie = 0;
|
||||
}
|
||||
|
||||
szOldIMDBID = szIMDBID;
|
||||
lpSerie = theMovieDB.loadSerie(szIMDBID);
|
||||
if(lpSerie)
|
||||
{
|
||||
lpSerie->setDownload(query.value("download").toString());
|
||||
lpSerie->setCliffhanger(query.value("cliffhanger").toBool());
|
||||
}
|
||||
}
|
||||
|
||||
if(lpSerie)
|
||||
{
|
||||
cSeason* lpSeason = lpSerie->findSeason(query.value("seasonNumber").toInt());
|
||||
if(lpSeason)
|
||||
{
|
||||
cEpisode* lpEpisode = lpSeason->findEpisode(query.value("episodeNumber").toInt());
|
||||
if(lpEpisode)
|
||||
lpEpisode->setState((cEpisode::State)query.value("state").toInt());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(lpSerie)
|
||||
{
|
||||
lpSerie->save(m_db);
|
||||
delete lpSerie;
|
||||
lpSerie = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void cMainWindow::loadSeriesDB()
|
||||
{
|
||||
m_serieList.clear();
|
||||
|
||||
QSqlQuery query;
|
||||
|
||||
qint32 iOldSeriesID = -1;
|
||||
qint32 iOldSeasonID = -1;
|
||||
qint32 iOldSeriesID = -1;
|
||||
qint32 iOldSeasonNumber = -1;
|
||||
qint32 iSeriesID;
|
||||
qint32 iSeasonID;
|
||||
qint32 iSeasonNumber;
|
||||
cSeason* lpSeason;
|
||||
cEpisode* lpEpisode;
|
||||
/*
|
||||
if(query.exec("SELECT serie.seriesID, serie.seriesName, serie.language, serie.banner, serie.overview, serie.firstAired, serie.network, serie.imdbid, serie.id, serie.contentRating, serie.rating, serie.ratingCount, serie.runtime, serie.status, serie.download, serie.cliffhanger, serie.actor, serie.genre, episode.episodeID, episode.episodeName, episode.episodeNumber, episode.firstAired, episode.imdbid, episode.language, episode.overview, episode.productioncode, episode.rating, episode.ratingCount, episode.seasonNumber, episode.seasonID, episode.seriesID, episode.state, episode.filename, episode.thumb_height, episode.thumb_width, episode.director, episode.gueststars, episode.episode_writer FROM serie LEFT JOIN episode ON serie.id = episode.seriesID ORDER BY serie.seriesName, episode.seasonNumber, episode.episodeNumber;"))
|
||||
|
||||
if(query.exec("SELECT serie.seriesID,serie.seriesName,serie.originalName,serie.backdropPath,serie.createdBy,serie.homepage,serie.lastAired,serie.networks,serie.nrEpisodes,serie.nrSeasons,serie.originCountries,serie.originalLanguage,serie.popularity,serie.posterPath,serie.productionCompanies,serie.type,serie.voteAverage,serie.voteCount,serie.overview,serie.firstAired,serie.cast,serie.crew,serie.genre,serie.status,serie.download,serie.cliffhanger,episode.id,episode.name,episode.episodeNumber,episode.airDate,episode.guestStars,episode.overview,episode.productioncode,episode.seasonNumber,episode.seasonID,episode.seriesID,episode.stillPath,episode.voteAverage,episode.voteCount,episode.crew,episode.state FROM serie LEFT JOIN episode ON serie.seriesID = episode.seriesID ORDER BY serie.seriesName, episode.seasonNumber, episode.episodeNumber;"))
|
||||
{
|
||||
while(query.next())
|
||||
{
|
||||
iSeriesID = query.value( 8).toInt();
|
||||
iSeasonID = query.value(29).toInt();
|
||||
iSeriesID = query.value("seriesID").toInt();
|
||||
iSeasonNumber = query.value("seasonNumber").toInt();
|
||||
|
||||
if(iSeriesID != iOldSeriesID)
|
||||
{
|
||||
@@ -307,53 +355,57 @@ void cMainWindow::loadSeriesDB()
|
||||
}
|
||||
|
||||
cSerie* lpSerie = m_serieList.add(iSeriesID);
|
||||
lpSerie->setSeriesID(query.value(0).toInt());
|
||||
lpSerie->setSeriesName(query.value(1).toString());
|
||||
lpSerie->setLanguage(query.value(2).toString());
|
||||
lpSerie->setBanner(query.value(3).toString());
|
||||
lpSerie->setOverview(query.value(4).toString());
|
||||
lpSerie->setFirstAired(query.value(5).toDate());
|
||||
lpSerie->setNetwork(query.value(6).toString());
|
||||
lpSerie->setIMDBID(query.value(7).toString());
|
||||
lpSerie->setContentRating(query.value(9).toString());
|
||||
lpSerie->setRating(query.value(10).toDouble());
|
||||
lpSerie->setRatingCount(query.value(11).toInt());
|
||||
lpSerie->setRuntime(query.value(12).toInt());
|
||||
lpSerie->setStatus(query.value(13).toString());
|
||||
lpSerie->setDownload(query.value(14).toString());
|
||||
lpSerie->setCliffhanger(query.value(15).toBool());
|
||||
lpSerie->setActors(query.value(16).toString().split("|"));
|
||||
lpSerie->setGenre(query.value(17).toString().split(","));
|
||||
lpSerie->setSeriesName(query.value("seriesName").toString());
|
||||
lpSerie->setOriginalName(query.value("originalName").toString());
|
||||
lpSerie->setBackdropPath(query.value("backdropPath").toString());
|
||||
lpSerie->setCreatedBy(query.value("createdBy").toString());
|
||||
lpSerie->setHomepage(query.value("homepage").toString());
|
||||
lpSerie->setLastAired(query.value("lastAired").toString());
|
||||
lpSerie->setNetworks(query.value("networks").toString());
|
||||
lpSerie->setEpisodes(query.value("nrEpisodes").toInt());
|
||||
lpSerie->setSeasons(query.value("nrSeasons").toInt());
|
||||
lpSerie->setOriginCountries(query.value("originCountries").toString());
|
||||
lpSerie->setOriginalLanguage(query.value("originalLanguage").toString());
|
||||
lpSerie->setPopularity(query.value("popularity").toDouble());
|
||||
lpSerie->setPosterPath(query.value("posterPath").toString());
|
||||
lpSerie->setProductionCompanies(query.value("productionCompanies").toString());
|
||||
lpSerie->setType(query.value("type").toString());
|
||||
lpSerie->setVoteAverage(query.value("voteAverage").toDouble());
|
||||
lpSerie->setVoteCount(query.value("voteCount").toInt());
|
||||
lpSerie->setOverview(query.value("overview").toString());
|
||||
lpSerie->setFirstAired(query.value("firstAired").toString());
|
||||
lpSerie->setCast(query.value("cast").toString().split("|"));
|
||||
lpSerie->setCrew(query.value("crew").toString().split("|"));
|
||||
lpSerie->setGenre(query.value("genre").toString());
|
||||
lpSerie->setStatus(query.value("status").toString());
|
||||
lpSerie->setDownload(query.value("download").toString());
|
||||
lpSerie->setCliffhanger(query.value("cliffhanger").toBool());
|
||||
|
||||
if(iSeasonID != iOldSeasonID)
|
||||
if(iSeasonNumber != iOldSeasonNumber)
|
||||
{
|
||||
lpSeason = lpSerie->addSeason(query.value(28).toInt());
|
||||
iOldSeasonID = iSeasonID;
|
||||
lpSeason = lpSerie->addSeason(query.value("seasonNumber").toInt());
|
||||
iOldSeasonNumber = iSeasonNumber;
|
||||
}
|
||||
|
||||
lpEpisode = lpSeason->addEpisode(query.value(20).toInt());
|
||||
lpEpisode->setID(query.value(18).toInt());
|
||||
lpEpisode->setEpisodeName(query.value(19).toString());
|
||||
lpEpisode->setFirstAired(query.value(21).toDate());
|
||||
lpEpisode->setIMDBID(query.value(22).toString());
|
||||
lpEpisode->setLanguage(query.value(23).toString());
|
||||
lpEpisode->setOverview(query.value(24).toString());
|
||||
lpEpisode->setProductionCode(query.value(25).toString());
|
||||
lpEpisode->setRating(query.value(26).toDouble());
|
||||
lpEpisode->setRatingCount(query.value(27).toInt());
|
||||
lpEpisode->setSeasonNumber(query.value(28).toInt());
|
||||
lpEpisode->setSeasonID(query.value(29).toInt());
|
||||
lpEpisode->setSeriesID(query.value(30).toInt());
|
||||
lpEpisode->setState((cEpisode::State)query.value(31).toInt());
|
||||
lpEpisode->setFileName(query.value(32).toString());
|
||||
lpEpisode->setThumbHeight(query.value(33).toInt());
|
||||
lpEpisode->setThumbWidth(query.value(34).toInt());
|
||||
lpEpisode->setDirector(query.value(35).toString().split(","));
|
||||
lpEpisode->setGuestStars(query.value(36).toString().split(","));
|
||||
lpEpisode->setWriter(query.value(37).toString().split(","));
|
||||
lpEpisode = lpSeason->addEpisode(iSeasonNumber);
|
||||
|
||||
lpEpisode->setID(query.value("id").toInt());
|
||||
lpEpisode->setName(query.value("name").toString());
|
||||
lpEpisode->setEpisodeNumber(query.value("episodeNumber").toInt());
|
||||
lpEpisode->setAirDate(query.value("airDate").toString());
|
||||
lpEpisode->setGuestStars(query.value("guestStars").toString());
|
||||
lpEpisode->setOverview(query.value("overview").toString());
|
||||
lpEpisode->setProductionCode(query.value("productioncode").toString());
|
||||
lpEpisode->setSeasonNumber(query.value("seasonNumber").toInt());
|
||||
lpEpisode->setSeasonID(query.value("seasonID").toInt());
|
||||
lpEpisode->setSeriesID(query.value("seriesID").toInt());
|
||||
lpEpisode->setStillPath(query.value("stillPath").toString());
|
||||
lpEpisode->setVoteAverage(query.value("voteAverage").toDouble());
|
||||
lpEpisode->setVoteCount(query.value("voteCount").toInt());
|
||||
lpEpisode->setCrew(query.value("crew").toString());
|
||||
lpEpisode->setState((cEpisode::State)query.value("state").toInt());
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void cMainWindow::loadMoviesDB()
|
||||
@@ -701,10 +753,7 @@ void cMainWindow::showSeriesContextMenu(QTreeView* lpTreeView, const QPoint &pos
|
||||
lpMenu->addAction("delete", this, SLOT(onActionDelete()));
|
||||
lpMenu->addAction("edit", this, SLOT(onActionEdit()));
|
||||
lpMenu->addSeparator();
|
||||
/*
|
||||
if(!lpSerie->imdbID().isEmpty())
|
||||
lpMenu->addAction("open IMDB", this, SLOT(onActionGotoIMDB()));
|
||||
*/
|
||||
|
||||
if(!lpSerie->download().isEmpty())
|
||||
{
|
||||
lpMenu->addAction("open download link", this, SLOT(onActionGotoDownload()));
|
||||
@@ -942,11 +991,11 @@ void cMainWindow::onActionAdd()
|
||||
if(id == -1)
|
||||
return;
|
||||
|
||||
cTheTVDBV2 tvDB2;
|
||||
cTheMovieDBV3 movieDB3;
|
||||
|
||||
lpSerie = tvDB2.load(id, "de");
|
||||
lpSerie = movieDB3.loadSerie(id, "de");
|
||||
if(!lpSerie)
|
||||
lpSerie = tvDB2.load(id, "en");
|
||||
lpSerie = movieDB3.loadSerie(id, "en");
|
||||
|
||||
delete lpDialog;
|
||||
|
||||
|
||||
+3
-1
@@ -55,7 +55,6 @@ private slots:
|
||||
void onActionUpdate();
|
||||
void onActionDelete();
|
||||
void onActionEdit();
|
||||
void onActionGotoIMDB();
|
||||
void onActionGotoDownload();
|
||||
void onActionCopyDownload();
|
||||
void onActionLoadPictures();
|
||||
@@ -107,6 +106,9 @@ private:
|
||||
|
||||
void initDB();
|
||||
void loadDB();
|
||||
|
||||
void convertSeries();
|
||||
|
||||
void loadSeriesDB();
|
||||
void loadMoviesDB();
|
||||
|
||||
|
||||
+1
-11
@@ -1,4 +1,5 @@
|
||||
#include "cmovie.h"
|
||||
#include "common.h"
|
||||
|
||||
#include <QStringList>
|
||||
#include <QSqlQuery>
|
||||
@@ -110,17 +111,6 @@ void cMovie::setGenres(const QString& szGenres)
|
||||
m_szGenres = szGenres.split(",");
|
||||
}
|
||||
|
||||
QStringList cleanList(const QStringList& list)
|
||||
{
|
||||
QStringList list1;
|
||||
|
||||
for(int x = 0;x < list.count();x++)
|
||||
{
|
||||
if(!list.at(x).isEmpty())
|
||||
list1.append(list.at(x));
|
||||
}
|
||||
return(list1);
|
||||
}
|
||||
void cMovie::setGenres(const QStringList& szGenres)
|
||||
{
|
||||
m_szGenres = cleanList(szGenres);
|
||||
|
||||
+12
@@ -17,3 +17,15 @@ QString rootPath()
|
||||
|
||||
return(szPath);
|
||||
}
|
||||
|
||||
QStringList cleanList(const QStringList& list)
|
||||
{
|
||||
QStringList list1;
|
||||
|
||||
for(int x = 0;x < list.count();x++)
|
||||
{
|
||||
if(!list.at(x).isEmpty())
|
||||
list1.append(list.at(x));
|
||||
}
|
||||
return(list1);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
|
||||
QString rootPath();
|
||||
QStringList cleanList(const QStringList& list);
|
||||
|
||||
|
||||
#endif // COMMON_H
|
||||
|
||||
+2
-1
@@ -23,7 +23,7 @@ void cPicturesThread::stop()
|
||||
void cPicturesThread::run()
|
||||
{
|
||||
qint16 iCurrent = 0;
|
||||
|
||||
/*
|
||||
for(int z = 0;z < m_items.count();z++)
|
||||
{
|
||||
cSerie* lpSerie = m_items.at(z);
|
||||
@@ -55,6 +55,7 @@ void cPicturesThread::run()
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void cPicturesThread::setData(cMessageDialog* lpMessageDialog, const QList<cSerie *> &list)
|
||||
|
||||
+2
-5
@@ -1,7 +1,6 @@
|
||||
#include "csearch.h"
|
||||
#include "ui_csearch.h"
|
||||
|
||||
#include "cthetvdbv2.h"
|
||||
#include "cthemoviedbv3.h"
|
||||
|
||||
#include "cserie.h"
|
||||
@@ -43,17 +42,15 @@ void cSearch::on_m_lpSearchButton_clicked()
|
||||
lpDialog->setMessage("Searching");
|
||||
lpDialog->show();
|
||||
|
||||
cTheTVDBV2 theTVDBV2;
|
||||
cTheMovieDBV3 theMovieDBV3;
|
||||
|
||||
QList<cSerie*> serieList2 = theTVDBV2.search(ui->m_lpSearch->text());
|
||||
QList<cSerie*> serieList3 = theMovieDBV3.searchSerie(ui->m_lpSearch->text(), -1, "de");
|
||||
|
||||
ui->m_lpResults->clear();
|
||||
|
||||
for(int z = 0;z < serieList2.count();z++)
|
||||
for(int z = 0;z < serieList3.count();z++)
|
||||
{
|
||||
cSerie* lpSerie = serieList2.at(z);
|
||||
cSerie* lpSerie = serieList3.at(z);
|
||||
QTreeWidgetItem* lpNew = new QTreeWidgetItem(ui->m_lpResults);
|
||||
lpNew->setText(0, lpSerie->seriesName());
|
||||
lpNew->setText(2, QString("%1").arg(lpSerie->firstAired().year()));
|
||||
|
||||
+10
@@ -64,6 +64,16 @@ QList<cEpisode*> cSeason::episodeList()
|
||||
return(m_episodeList);
|
||||
}
|
||||
|
||||
cEpisode* cSeason::findEpisode(qint16 iNumber)
|
||||
{
|
||||
for(int x = 0;x < m_episodeList.count();x++)
|
||||
{
|
||||
if(m_episodeList.at(x)->episodeNumber() == iNumber)
|
||||
return(m_episodeList.at(x));
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
qint16 cSeason::episodeCount()
|
||||
{
|
||||
qint16 iTotal = -1;
|
||||
|
||||
@@ -31,6 +31,7 @@ public:
|
||||
cEpisode* addEpisode(qint16 iNumber);
|
||||
cEpisode* addEpisode(cEpisode* lpEpisode);
|
||||
QList<cEpisode*> episodeList();
|
||||
cEpisode* findEpisode(qint16 iNumber);
|
||||
|
||||
qint16 episodeCount();
|
||||
|
||||
|
||||
+220
-190
@@ -1,4 +1,6 @@
|
||||
#include "cserie.h"
|
||||
#include "common.h"
|
||||
|
||||
#include <QStringList>
|
||||
#include <QSqlQuery>
|
||||
#include <QVariant>
|
||||
@@ -8,19 +10,18 @@ cSerie::cSerie() :
|
||||
m_szSeriesName(""),
|
||||
m_szOriginalName(""),
|
||||
m_iSeriesID(-1),
|
||||
m_szLanguage(""),
|
||||
m_szBanner(""),
|
||||
m_szBackdropPath(""),
|
||||
m_szHomepage(""),
|
||||
m_lastAired(QDate(1900, 1, 1)),
|
||||
m_iEpisodes(-1),
|
||||
m_iSeasons(-1),
|
||||
m_szOriginalLanguage(""),
|
||||
m_dPopularity(-1.0),
|
||||
m_szType(""),
|
||||
m_dVoteAverage(-1.0),
|
||||
m_iVoteCount(-1),
|
||||
m_szOverview(""),
|
||||
m_firstAired(QDate(1900, 1, 1)),
|
||||
m_szNetwork(""),
|
||||
m_szIMDBID(""),
|
||||
m_iID(-1),
|
||||
m_szActors(),
|
||||
m_szContentRating(""),
|
||||
m_szGenre(),
|
||||
m_dRating(-1.0),
|
||||
m_iRatingCount(-1),
|
||||
m_iRuntime(-1),
|
||||
m_szStatus(""),
|
||||
m_szDownload(""),
|
||||
m_bCliffhanger(false)
|
||||
@@ -37,9 +38,6 @@ QString cSerie::seriesName()
|
||||
return(m_szSeriesName);
|
||||
}
|
||||
|
||||
void setOriginalName(const QString& szOriginalName); //New
|
||||
QString originalName();
|
||||
|
||||
void cSerie::setOriginalName(const QString& szOriginalName)
|
||||
{
|
||||
m_szOriginalName = szOriginalName;
|
||||
@@ -60,76 +58,179 @@ qint32 cSerie::seriesID()
|
||||
return(m_iSeriesID);
|
||||
}
|
||||
|
||||
void setBackdropPath(const QString& szBackdropPath); //New
|
||||
QString backdropPath();
|
||||
|
||||
void setCreatedBy(const QStringList& szCreatedBy); //New
|
||||
void setCreatedBy(const QString& szCreatedBy);
|
||||
QStringList createdBy();
|
||||
|
||||
void setHomepage(const QString& szHomepage); //New
|
||||
QString homepage();
|
||||
|
||||
void setLastAired(const QString& szLAstAired); //New
|
||||
void setLastAired(const QDate& lastAired);
|
||||
QDate lastAired();
|
||||
|
||||
void setNetworks(const QStringList& szNetworks); //New
|
||||
void setNetworks(const QString& szNetworks);
|
||||
QStringList networks();
|
||||
|
||||
void setNrEpisodes(const qint16& iEpisodes); //New
|
||||
qint16 nrEpisodes();
|
||||
|
||||
void setNrSeasons(const qint16& iSeasons); //New
|
||||
qint16 nrSeasons();
|
||||
|
||||
void setOriginCountries(const QStringList& szOriginCountrues); //New
|
||||
void setOriginCountries(const QString& szOriginCountries);
|
||||
QStringList originCountries();
|
||||
|
||||
void setOriginalLanguage(const QString& szOriginalLanguage); //New
|
||||
QString originalLanguage();
|
||||
|
||||
void setPopularity(const qreal& dPopularity); //New
|
||||
qreal popularity();
|
||||
|
||||
void setPosterPath(const QString& szPosterPath); //New
|
||||
QString posterPath();
|
||||
|
||||
void setProductionCompanies(const QStringList& szProductionCompanies); //New
|
||||
void setProductionCompanies(const QString& szProductionCompanies);
|
||||
QStringList productionCompanies();
|
||||
|
||||
void setType(const QString& szType); //New
|
||||
QString type();
|
||||
|
||||
void setVoteAverage(const qreal& dVoteAverage); //New
|
||||
qreal voteAverage();
|
||||
|
||||
void setVoteCount(const qint16& iVoteCount); //New
|
||||
qint16 voteCount();
|
||||
/*
|
||||
void cSerie::setLanguage(const QString& szLanguage)
|
||||
void cSerie::setBackdropPath(const QString& szBackdropPath)
|
||||
{
|
||||
m_szLanguage = szLanguage;
|
||||
m_szBackdropPath = szBackdropPath;
|
||||
}
|
||||
|
||||
QString cSerie::language()
|
||||
QString cSerie::backdropPath()
|
||||
{
|
||||
return(m_szLanguage);
|
||||
return(m_szBackdropPath);
|
||||
}
|
||||
|
||||
void cSerie::setBanner(const QString& szBanner)
|
||||
void cSerie::setCreatedBy(const QStringList& szCreatedBy)
|
||||
{
|
||||
m_szBanner = szBanner;
|
||||
m_szCreatedBy = cleanList(szCreatedBy);
|
||||
}
|
||||
|
||||
QString cSerie::banner()
|
||||
void cSerie::setCreatedBy(const QString& szCreatedBy)
|
||||
{
|
||||
return(m_szBanner);
|
||||
m_szCreatedBy = szCreatedBy.split(",");
|
||||
}
|
||||
*/
|
||||
|
||||
QStringList cSerie::createdBy()
|
||||
{
|
||||
return(m_szCreatedBy);
|
||||
}
|
||||
|
||||
void cSerie::setHomepage(const QString& szHomepage)
|
||||
{
|
||||
m_szHomepage = szHomepage;
|
||||
}
|
||||
|
||||
QString cSerie::homepage()
|
||||
{
|
||||
return(m_szHomepage);
|
||||
}
|
||||
|
||||
void cSerie::setLastAired(const QString& szLastAired)
|
||||
{
|
||||
m_lastAired = QDate::fromString(szLastAired, "yyyy-MM-dd");
|
||||
}
|
||||
|
||||
void cSerie::setLastAired(const QDate& lastAired)
|
||||
{
|
||||
m_lastAired = lastAired;
|
||||
}
|
||||
|
||||
QDate cSerie::lastAired()
|
||||
{
|
||||
return(m_lastAired);
|
||||
}
|
||||
|
||||
void cSerie::setNetworks(const QStringList& szNetworks)
|
||||
{
|
||||
m_szNetworks = cleanList(szNetworks);
|
||||
}
|
||||
void cSerie::setNetworks(const QString& szNetworks)
|
||||
{
|
||||
m_szNetworks = szNetworks.split(",");
|
||||
}
|
||||
|
||||
QStringList cSerie::networks()
|
||||
{
|
||||
return(m_szNetworks);
|
||||
}
|
||||
|
||||
void cSerie::setEpisodes(const qint16& iEpisodes)
|
||||
{
|
||||
m_iEpisodes = iEpisodes;
|
||||
}
|
||||
|
||||
qint16 cSerie::episodes()
|
||||
{
|
||||
return(m_iEpisodes);
|
||||
}
|
||||
|
||||
void cSerie::setSeasons(const qint16& iSeasons)
|
||||
{
|
||||
m_iSeasons = iSeasons;
|
||||
}
|
||||
|
||||
qint16 cSerie::seasons()
|
||||
{
|
||||
return(m_iSeasons);
|
||||
}
|
||||
|
||||
void cSerie::setOriginCountries(const QStringList& szOriginCountries)
|
||||
{
|
||||
m_szOriginCountries = cleanList(szOriginCountries);
|
||||
}
|
||||
|
||||
void cSerie::setOriginCountries(const QString& szOriginCountries)
|
||||
{
|
||||
m_szOriginCountries = szOriginCountries.split(",");
|
||||
}
|
||||
|
||||
QStringList cSerie::originCountries()
|
||||
{
|
||||
return(m_szOriginCountries);
|
||||
}
|
||||
|
||||
void cSerie::setOriginalLanguage(const QString& szOriginalLanguage)
|
||||
{
|
||||
m_szOriginalLanguage = szOriginalLanguage;
|
||||
}
|
||||
|
||||
QString cSerie::originalLanguage()
|
||||
{
|
||||
return(m_szOriginalLanguage);
|
||||
}
|
||||
|
||||
void cSerie::setPopularity(const qreal& dPopularity)
|
||||
{
|
||||
m_dPopularity = dPopularity;
|
||||
}
|
||||
|
||||
qreal cSerie::popularity()
|
||||
{
|
||||
return(m_dPopularity);
|
||||
}
|
||||
|
||||
void cSerie::setPosterPath(const QString& szPosterPath)
|
||||
{
|
||||
m_szPosterPath = szPosterPath;
|
||||
}
|
||||
|
||||
QString cSerie::posterPath()
|
||||
{
|
||||
return(m_szPosterPath);
|
||||
}
|
||||
|
||||
void cSerie::setProductionCompanies(const QStringList& szProductionCompanies)
|
||||
{
|
||||
m_szProductionCompanies = cleanList(szProductionCompanies);
|
||||
}
|
||||
|
||||
void cSerie::setProductionCompanies(const QString& szProductionCompanies)
|
||||
{
|
||||
m_szProductionCompanies = szProductionCompanies.split(",");
|
||||
}
|
||||
|
||||
QStringList cSerie::productionCompanies()
|
||||
{
|
||||
return(m_szProductionCompanies);
|
||||
}
|
||||
|
||||
void cSerie::setType(const QString& szType)
|
||||
{
|
||||
m_szType = szType;
|
||||
}
|
||||
QString cSerie::type()
|
||||
{
|
||||
return(m_szType);
|
||||
}
|
||||
|
||||
void cSerie::setVoteAverage(const qreal& dVoteAverage)
|
||||
{
|
||||
m_dVoteAverage = dVoteAverage;
|
||||
}
|
||||
|
||||
qreal cSerie::voteAverage()
|
||||
{
|
||||
return(m_dVoteAverage);
|
||||
}
|
||||
|
||||
void cSerie::setVoteCount(const qint16& iVoteCount)
|
||||
{
|
||||
m_iVoteCount = iVoteCount;
|
||||
}
|
||||
|
||||
qint16 cSerie::voteCount()
|
||||
{
|
||||
return(m_iVoteCount);
|
||||
}
|
||||
|
||||
void cSerie::setOverview(const QString& szOverview)
|
||||
{
|
||||
m_szOverview = szOverview;
|
||||
@@ -154,71 +255,27 @@ QDate cSerie::firstAired()
|
||||
{
|
||||
return(m_firstAired);
|
||||
}
|
||||
/*
|
||||
void cSerie::setNetwork(const QString& szNetwork)
|
||||
|
||||
void cSerie::setCast(const QStringList& szCast)
|
||||
{
|
||||
m_szNetwork = szNetwork;
|
||||
m_szCast = szCast;
|
||||
}
|
||||
|
||||
QString cSerie::network()
|
||||
QStringList cSerie::cast()
|
||||
{
|
||||
return(m_szNetwork);
|
||||
return(m_szCast);
|
||||
}
|
||||
|
||||
void cSerie::setIMDBID(const QString& szIMDBID)
|
||||
void cSerie::setCrew(const QStringList& szCrew)
|
||||
{
|
||||
m_szIMDBID = szIMDBID;
|
||||
m_szCrew = szCrew;
|
||||
}
|
||||
|
||||
QString cSerie::imdbID()
|
||||
QStringList cSerie::crew()
|
||||
{
|
||||
return(m_szIMDBID);
|
||||
return(m_szCrew);
|
||||
}
|
||||
|
||||
void cSerie::setID(const qint32& iID)
|
||||
{
|
||||
m_iID = iID;
|
||||
}
|
||||
|
||||
qint32 cSerie::id()
|
||||
{
|
||||
return(m_iID);
|
||||
}
|
||||
|
||||
void cSerie::setActors(const QString& szActors)
|
||||
{
|
||||
m_szActors = szActors.split("|");
|
||||
m_szActors.removeAll("");
|
||||
}
|
||||
|
||||
void cSerie::setActors(const QStringList& szActors)
|
||||
{
|
||||
m_szActors = szActors;
|
||||
m_szActors.removeAll("");
|
||||
}
|
||||
|
||||
QStringList cSerie::actors()
|
||||
{
|
||||
return(m_szActors);
|
||||
}
|
||||
|
||||
void cSerie::setContentRating(const QString& szContentRating)
|
||||
{
|
||||
m_szContentRating = szContentRating;
|
||||
}
|
||||
|
||||
QString cSerie::contentRating()
|
||||
{
|
||||
return(m_szContentRating);
|
||||
}
|
||||
*/
|
||||
|
||||
void setCast(const QStringList& szCast); //New
|
||||
QStringList cast();
|
||||
|
||||
void setCrew(const QStringList& szCrew); //New
|
||||
QStringList crew();
|
||||
|
||||
void cSerie::setGenre(const QString& szGenre)
|
||||
{
|
||||
m_szGenre = szGenre.split("|");
|
||||
@@ -235,37 +292,7 @@ QStringList cSerie::genre()
|
||||
{
|
||||
return(m_szGenre);
|
||||
}
|
||||
/*
|
||||
void cSerie::setRating(const qreal& dRating)
|
||||
{
|
||||
m_dRating = dRating;
|
||||
}
|
||||
|
||||
qreal cSerie::rating()
|
||||
{
|
||||
return(m_dRating);
|
||||
}
|
||||
|
||||
void cSerie::setRatingCount(const qint16& iRatingCount)
|
||||
{
|
||||
m_iRatingCount = iRatingCount;
|
||||
}
|
||||
|
||||
qint16 cSerie::ratingCount()
|
||||
{
|
||||
return(m_iRatingCount);
|
||||
}
|
||||
|
||||
void cSerie::setRuntime(const qint16& iRuntime)
|
||||
{
|
||||
m_iRuntime = iRuntime;
|
||||
}
|
||||
|
||||
qint16 cSerie::runime()
|
||||
{
|
||||
return(m_iRuntime);
|
||||
}
|
||||
*/
|
||||
void cSerie::setStatus(const QString& szStatus)
|
||||
{
|
||||
m_szStatus = szStatus;
|
||||
@@ -380,45 +407,53 @@ qint16 cSerie::maxEpisode()
|
||||
|
||||
bool cSerie::save(QSqlDatabase &db)
|
||||
{
|
||||
/*
|
||||
QSqlQuery query;
|
||||
QSqlQuery querySerie;
|
||||
QSqlQuery queryEpisode;
|
||||
|
||||
querySerie.prepare("INSERT INTO serie (seriesID,seriesName,language,banner,overview,firstAired,network,imdbid,id,contentRating,rating,ratingCount,runtime,status,download,cliffhanger,actor,genre)"
|
||||
" VALUES (:seriesID,:seriesName,:language,:banner,:overview,:firstAired,:network,:imdbid,:id,:contentRating,:rating,:ratingCount,:runtime,:status,:download,:cliffhanger,:actor,:genre);");
|
||||
queryEpisode.prepare("INSERT INTO episode (episodeID,episodeName,episodeNumber,firstAired,imdbid,language,overview,productioncode,rating,ratingCount,seasonNumber,seasonID,seriesID,state,filename,thumb_height,thumb_width,director,gueststars,episode_writer) VALUES (:episodeID,:episodeName,:episodeNumber,:firstAired,:imdbid,:language,:overview,:productioncode,:rating,:ratingCount,:seasonNumber,:seasonID,:seriesID,:state,:filename,:thumb_height,:thumb_width,:director,:gueststars,:episode_writer);");
|
||||
querySerie.prepare("INSERT INTO serie (seriesID,seriesName,originalName,backdropPath,createdBy,homepage,lastAired,networks,nrEpisodes,nrSeasons,originCountries,originalLanguage,popularity,posterPath,productionCompanies,type,voteAverage,voteCount,overview,firstAired,cast,crew,genre,status,download,cliffhanger)"
|
||||
" VALUES (:seriesID,:seriesName,:originalName,:backdropPath,:createdBy,:homepage,:lastAired,:networks,:nrEpisodes,:nrSeasons,:originCountries,:originalLanguage,:popularity,:posterPath,:productionCompanies,:type,:voteAverage,:voteCount,:overview,:firstAired,:cast,:crew,:genre,:status,:download,:cliffhanger);");
|
||||
queryEpisode.prepare("INSERT INTO episode (id,name,episodeNumber,airDate,guestStars,overview,productioncode,seasonNumber,seasonID,seriesID,stillPath,voteAverage,voteCount,crew,state)"
|
||||
" VALUES (:id,:name,:episodeNumber,:airDate,:guestStars,:overview,:productioncode,:seasonNumber,:seasonID,:seriesID,:stillPath,:voteAverage,:voteCount,:crew,:state);");
|
||||
|
||||
db.transaction();
|
||||
query.exec(QString("SELECT id FROM serie WHERE id=%1;").arg(id()));
|
||||
query.exec(QString("SELECT seriesID FROM serie WHERE seriesID=%1;").arg(seriesID()));
|
||||
if(!query.next())
|
||||
{
|
||||
query.prepare(QString("SELECT episodeID FROM episode WHERE episodeID=:episodeID"));
|
||||
query.prepare(QString("SELECT id FROM episode WHERE id=:id"));
|
||||
|
||||
querySerie.bindValue(":seriesID", seriesID());
|
||||
querySerie.bindValue(":seriesName", seriesName());
|
||||
querySerie.bindValue(":language", language());
|
||||
querySerie.bindValue(":banner", banner());
|
||||
querySerie.bindValue(":originalName", originalName());
|
||||
querySerie.bindValue(":backdropPath", backdropPath());
|
||||
querySerie.bindValue(":createdBy", createdBy().join(","));
|
||||
querySerie.bindValue(":homepage", homepage());
|
||||
querySerie.bindValue(":lastAired", lastAired());
|
||||
querySerie.bindValue(":networks", networks().join(","));
|
||||
querySerie.bindValue(":nrEpisodes", episodes());
|
||||
querySerie.bindValue(":nrSeasons", seasons());
|
||||
querySerie.bindValue(":originCountries", originCountries().join(","));
|
||||
querySerie.bindValue(":originalLanguage", originalLanguage());
|
||||
querySerie.bindValue(":popularity", popularity());
|
||||
querySerie.bindValue(":posterPath", posterPath());
|
||||
querySerie.bindValue(":productionCompanies", productionCompanies().join(","));
|
||||
querySerie.bindValue(":type", type());
|
||||
querySerie.bindValue(":voteAverage", voteAverage());
|
||||
querySerie.bindValue(":voteCount", voteCount());
|
||||
querySerie.bindValue(":overview", overview());
|
||||
querySerie.bindValue(":firstAired", firstAired());
|
||||
querySerie.bindValue(":network", network());
|
||||
querySerie.bindValue(":imdbid", imdbID());
|
||||
querySerie.bindValue(":id", id());
|
||||
querySerie.bindValue(":contentRating", contentRating());
|
||||
querySerie.bindValue(":rating", rating());
|
||||
querySerie.bindValue(":ratingCount", ratingCount());
|
||||
querySerie.bindValue(":runtime", runime());
|
||||
querySerie.bindValue(":cast", cast().join("|"));
|
||||
querySerie.bindValue(":crew", crew().join("|"));
|
||||
querySerie.bindValue(":genre", genre().join(","));
|
||||
querySerie.bindValue(":status", status());
|
||||
querySerie.bindValue(":download", download());
|
||||
querySerie.bindValue(":cliffhanger", cliffhanger());
|
||||
querySerie.bindValue(":actor", actors().join("|"));
|
||||
querySerie.bindValue(":genre", genre().join(","));
|
||||
if(querySerie.exec())
|
||||
{
|
||||
QList<cSeason*> seasonList = this->seasonList();
|
||||
for(int season = 0;season < seasonList.count();season++)
|
||||
QList<cSeason*> seasonList1 = seasonList();
|
||||
for(int season = 0;season < seasonList1.count();season++)
|
||||
{
|
||||
QList<cEpisode*> episodeList = seasonList.at(season)->episodeList();
|
||||
QList<cEpisode*> episodeList = seasonList1.at(season)->episodeList();
|
||||
for(int episode = 0;episode < episodeList.count();episode++)
|
||||
{
|
||||
cEpisode* lpEpisode = episodeList.at(episode);
|
||||
@@ -427,26 +462,21 @@ bool cSerie::save(QSqlDatabase &db)
|
||||
//query.exec();
|
||||
//if(!query.next())
|
||||
{
|
||||
queryEpisode.bindValue(":episodeID", lpEpisode->id());
|
||||
queryEpisode.bindValue(":episodeName", lpEpisode->episodeName());
|
||||
queryEpisode.bindValue(":id", lpEpisode->id());
|
||||
queryEpisode.bindValue(":name", lpEpisode->name());
|
||||
queryEpisode.bindValue(":episodeNumber", lpEpisode->episodeNumber());
|
||||
queryEpisode.bindValue(":firstAired", lpEpisode->firstAired());
|
||||
queryEpisode.bindValue(":imdbid", lpEpisode->imdbID());
|
||||
queryEpisode.bindValue(":language", lpEpisode->language());
|
||||
queryEpisode.bindValue(":airDate", lpEpisode->airDate());
|
||||
queryEpisode.bindValue(":guestStars", lpEpisode->guestStars().join("|"));
|
||||
queryEpisode.bindValue(":overview", lpEpisode->overview());
|
||||
queryEpisode.bindValue(":productioncode", lpEpisode->productionCode());
|
||||
queryEpisode.bindValue(":rating", lpEpisode->rating());
|
||||
queryEpisode.bindValue(":ratingCount", lpEpisode->ratingCount());
|
||||
queryEpisode.bindValue(":seasonNumber", lpEpisode->seasonNumber());
|
||||
queryEpisode.bindValue(":seasonID", lpEpisode->seasonID());
|
||||
queryEpisode.bindValue(":seriesID", lpEpisode->seriesID());
|
||||
queryEpisode.bindValue(":stillPath", lpEpisode->stillPath());
|
||||
queryEpisode.bindValue(":voteAverage", lpEpisode->voteAverage());
|
||||
queryEpisode.bindValue(":voteCount", lpEpisode->voteCount());
|
||||
queryEpisode.bindValue(":crew", lpEpisode->crew().join("|"));
|
||||
queryEpisode.bindValue(":state", lpEpisode->state());
|
||||
queryEpisode.bindValue(":filename", lpEpisode->fileName());
|
||||
queryEpisode.bindValue(":thumb_height", lpEpisode->thumbHeight());
|
||||
queryEpisode.bindValue(":thumb_width", lpEpisode->thumbWidth());
|
||||
queryEpisode.bindValue(":director", lpEpisode->director().join(","));
|
||||
queryEpisode.bindValue(":gueststars", lpEpisode->guestStars().join(","));
|
||||
queryEpisode.bindValue(":episode_writer", lpEpisode->writer().join(","));
|
||||
if(queryEpisode.exec())
|
||||
{
|
||||
}
|
||||
@@ -456,7 +486,7 @@ bool cSerie::save(QSqlDatabase &db)
|
||||
}
|
||||
}
|
||||
db.commit();
|
||||
*/
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,114 +14,83 @@ class cSerie
|
||||
public:
|
||||
cSerie();
|
||||
|
||||
void setSeriesName(const QString& szSeriesName); //OK
|
||||
void setSeriesName(const QString& szSeriesName);
|
||||
QString seriesName();
|
||||
|
||||
void setOriginalName(const QString& szOriginalName); //New
|
||||
void setOriginalName(const QString& szOriginalName);
|
||||
QString originalName();
|
||||
|
||||
void setSeriesID(const qint32& iSeriesID); //OK
|
||||
void setSeriesID(const qint32& iSeriesID);
|
||||
qint32 seriesID();
|
||||
|
||||
void setBackdropPath(const QString& szBackdropPath); //New
|
||||
void setBackdropPath(const QString& szBackdropPath);
|
||||
QString backdropPath();
|
||||
|
||||
void setCreatedBy(const QStringList& szCreatedBy); //New
|
||||
void setCreatedBy(const QStringList& szCreatedBy);
|
||||
void setCreatedBy(const QString& szCreatedBy);
|
||||
QStringList createdBy();
|
||||
|
||||
void setHomepage(const QString& szHomepage); //New
|
||||
void setHomepage(const QString& szHomepage);
|
||||
QString homepage();
|
||||
|
||||
void setLastAired(const QString& szLAstAired); //New
|
||||
void setLastAired(const QString& szLAstAired);
|
||||
void setLastAired(const QDate& lastAired);
|
||||
QDate lastAired();
|
||||
|
||||
void setNetworks(const QStringList& szNetworks); //New
|
||||
void setNetworks(const QStringList& szNetworks);
|
||||
void setNetworks(const QString& szNetworks);
|
||||
QStringList networks();
|
||||
|
||||
void setNrEpisodes(const qint16& iEpisodes); //New
|
||||
qint16 nrEpisodes();
|
||||
void setEpisodes(const qint16& iEpisodes);
|
||||
qint16 episodes();
|
||||
|
||||
void setNrSeasons(const qint16& iSeasons); //New
|
||||
qint16 nrSeasons();
|
||||
void setSeasons(const qint16& iSeasons);
|
||||
qint16 seasons();
|
||||
|
||||
void setOriginCountries(const QStringList& szOriginCountrues); //New
|
||||
void setOriginCountries(const QStringList& szOriginCountries);
|
||||
void setOriginCountries(const QString& szOriginCountries);
|
||||
QStringList originCountries();
|
||||
|
||||
void setOriginalLanguage(const QString& szOriginalLanguage); //New
|
||||
void setOriginalLanguage(const QString& szOriginalLanguage);
|
||||
QString originalLanguage();
|
||||
|
||||
void setPopularity(const qreal& dPopularity); //New
|
||||
void setPopularity(const qreal& dPopularity);
|
||||
qreal popularity();
|
||||
|
||||
void setPosterPath(const QString& szPosterPath); //New
|
||||
void setPosterPath(const QString& szPosterPath);
|
||||
QString posterPath();
|
||||
|
||||
void setProductionCompanies(const QStringList& szProductionCompanies); //New
|
||||
void setProductionCompanies(const QStringList& szProductionCompanies);
|
||||
void setProductionCompanies(const QString& szProductionCompanies);
|
||||
QStringList productionCompanies();
|
||||
|
||||
void setType(const QString& szType); //New
|
||||
void setType(const QString& szType);
|
||||
QString type();
|
||||
|
||||
void setVoteAverage(const qreal& dVoteAverage); //New
|
||||
void setVoteAverage(const qreal& dVoteAverage);
|
||||
qreal voteAverage();
|
||||
|
||||
void setVoteCount(const qint16& iVoteCount); //New
|
||||
void setVoteCount(const qint16& iVoteCount);
|
||||
qint16 voteCount();
|
||||
|
||||
// void setLanguage(const QString& szLanguage);
|
||||
// QString language();
|
||||
|
||||
// void setBanner(const QString& szBanner);
|
||||
// QString banner();
|
||||
|
||||
void setOverview(const QString& szOverview); //OK
|
||||
void setOverview(const QString& szOverview);
|
||||
QString overview();
|
||||
|
||||
void setFirstAired(const QString& szFirstAired); //OK
|
||||
void setFirstAired(const QString& szFirstAired);
|
||||
void setFirstAired(const QDate& firstAired);
|
||||
QDate firstAired();
|
||||
|
||||
// void setNetwork(const QString& szNetwork); //Old
|
||||
// QString network();
|
||||
|
||||
// void setIMDBID(const QString& szIMDBID);
|
||||
// QString imdbID();
|
||||
|
||||
// void setID(const qint32& iID);
|
||||
// qint32 id();
|
||||
|
||||
// void setActors(const QString& szActors);
|
||||
// void setActors(const QStringList& szActors);
|
||||
// QStringList actors();
|
||||
|
||||
// void setContentRating(const QString& szContentRating);
|
||||
// QString contentRating();
|
||||
|
||||
void setCast(const QStringList& szCast); //New
|
||||
void setCast(const QStringList& szCast);
|
||||
QStringList cast();
|
||||
|
||||
void setCrew(const QStringList& szCrew); //New
|
||||
void setCrew(const QStringList& szCrew);
|
||||
QStringList crew();
|
||||
|
||||
void setGenre(const QString& szGenre); //OK
|
||||
void setGenre(const QString& szGenre);
|
||||
void setGenre(const QStringList& szGenre);
|
||||
QStringList genre();
|
||||
|
||||
// void setRating(const qreal& dRating);
|
||||
// qreal rating();
|
||||
|
||||
// void setRatingCount(const qint16& iRatingCount);
|
||||
// qint16 ratingCount();
|
||||
|
||||
// void setRuntime(const qint16& iRuntime);
|
||||
// qint16 runime();
|
||||
|
||||
void setStatus(const QString& szStatus); //OK
|
||||
void setStatus(const QString& szStatus);
|
||||
QString status();
|
||||
|
||||
void setDownload(const QString& szDownload);
|
||||
@@ -161,19 +130,26 @@ private:
|
||||
QString m_szSeriesName;
|
||||
QString m_szOriginalName;
|
||||
qint32 m_iSeriesID;
|
||||
QString m_szLanguage;
|
||||
QString m_szBanner;
|
||||
QString m_szBackdropPath;
|
||||
QStringList m_szCreatedBy;
|
||||
QString m_szHomepage;
|
||||
QDate m_lastAired;
|
||||
QStringList m_szNetworks;
|
||||
qint16 m_iEpisodes;
|
||||
qint16 m_iSeasons;
|
||||
QStringList m_szOriginCountries;
|
||||
QString m_szOriginalLanguage;
|
||||
qreal m_dPopularity;
|
||||
QString m_szPosterPath;
|
||||
QStringList m_szProductionCompanies;
|
||||
QString m_szType;
|
||||
qreal m_dVoteAverage;
|
||||
qint16 m_iVoteCount;
|
||||
QString m_szOverview;
|
||||
QDate m_firstAired;
|
||||
QString m_szNetwork;
|
||||
QString m_szIMDBID;
|
||||
qint32 m_iID;
|
||||
QStringList m_szActors;
|
||||
QString m_szContentRating;
|
||||
QStringList m_szCast;
|
||||
QStringList m_szCrew;
|
||||
QStringList m_szGenre;
|
||||
qreal m_dRating;
|
||||
qint16 m_iRatingCount;
|
||||
qint16 m_iRuntime;
|
||||
QString m_szStatus;
|
||||
QString m_szDownload;
|
||||
bool m_bCliffhanger;
|
||||
|
||||
+11
-7
@@ -305,15 +305,19 @@ cSerie* cTheMovieDBV3::loadSerie(const QString& szIMDBID)
|
||||
QJsonDocument jsonResponse = QJsonDocument::fromJson(strReply.toUtf8());
|
||||
QJsonObject jsonObj = jsonResponse.object();
|
||||
|
||||
QJsonArray tmpArray;
|
||||
QJsonObject tmpObj;
|
||||
|
||||
delete reply;
|
||||
|
||||
tmpObj = jsonObj["tv_results"].toObject();
|
||||
iID = tmpObj["id"].toInt();
|
||||
tmpArray = jsonObj["tv_results"].toArray();
|
||||
tmpObj = tmpArray.at(0).toObject();
|
||||
iID = tmpObj["id"].toInt();
|
||||
|
||||
return(loadSerie(iID, "de"));
|
||||
}
|
||||
else
|
||||
qDebug() << reply->errorString();
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -351,6 +355,7 @@ cSerie* cTheMovieDBV3::loadSerie(const qint32 &iID, const QString& szLanguage)
|
||||
|
||||
lpSerie = new cSerie;
|
||||
|
||||
lpSerie->setSeriesID(iID);
|
||||
lpSerie->setBackdropPath(jsonObj["backdrop_path"].toString());
|
||||
tmpArray = jsonObj["created_by"].toArray();
|
||||
for(int x = 0;x < tmpArray.count();x++)
|
||||
@@ -371,8 +376,8 @@ cSerie* cTheMovieDBV3::loadSerie(const qint32 &iID, const QString& szLanguage)
|
||||
tmpList.append(tmpArray.at(x).toObject()["name"].toString());
|
||||
lpSerie->setNetworks(tmpList);
|
||||
tmpList.clear();
|
||||
lpSerie->setNrEpisodes(jsonObj["number_of_episodes"].toInt());
|
||||
lpSerie->setNrSeasons(jsonObj["number_of_seasons"].toInt());
|
||||
lpSerie->setEpisodes(jsonObj["number_of_episodes"].toInt());
|
||||
lpSerie->setSeasons(jsonObj["number_of_seasons"].toInt());
|
||||
tmpArray = jsonObj["origin_country"].toArray();
|
||||
for(int x = 0;x < tmpArray.count();x++) //!!!!!!!!!!
|
||||
tmpList.append(tmpArray.at(x).toObject()["name"].toString());
|
||||
@@ -433,7 +438,7 @@ cSerie* cTheMovieDBV3::loadSerie(const qint32 &iID, const QString& szLanguage)
|
||||
szCrew.append(QString("%1,%2").arg(tmpObj["name"].toString()).arg(tmpObj["job"].toString()));
|
||||
}
|
||||
if(szCrew.count())
|
||||
lpSeerie->setCrew(szCrew);
|
||||
lpSerie->setCrew(szCrew);
|
||||
}
|
||||
|
||||
tmpArray = jsonObj["seasons"].toArray();
|
||||
@@ -480,6 +485,7 @@ cSerie* cTheMovieDBV3::loadSerie(const qint32 &iID, const QString& szLanguage)
|
||||
lpEpisode->setStillPath(tmpObj["still_path"].toString());
|
||||
lpEpisode->setVoteAverage(tmpObj["vote_average"].toDouble());
|
||||
lpEpisode->setVoteCount(tmpObj["vote_count"].toInt());
|
||||
lpEpisode->setSeriesID(lpSerie->seriesID());
|
||||
|
||||
QJsonArray jsonArrayCrew = tmpObj["crew"].toArray();
|
||||
QJsonArray jsonArrayGuestStars = tmpObj["guest_start"].toArray();
|
||||
@@ -487,8 +493,6 @@ cSerie* cTheMovieDBV3::loadSerie(const qint32 &iID, const QString& szLanguage)
|
||||
QStringList szCrew;
|
||||
QStringList szGuestStars;
|
||||
|
||||
delete reply;
|
||||
|
||||
for(int x = 0;x < jsonArrayCrew.count();x++)
|
||||
{
|
||||
tmpObj = jsonArrayCrew.at(x).toObject();
|
||||
|
||||
-342
@@ -1,342 +0,0 @@
|
||||
#include "cthetvdbv2.h"
|
||||
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkRequest>
|
||||
#include <QNetworkReply>
|
||||
#include <QEventLoop>
|
||||
#include <QByteArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonArray>
|
||||
|
||||
|
||||
cTheTVDBV2::cTheTVDBV2()
|
||||
{
|
||||
QByteArray jsonRequest = "{\"apikey\":\"BC0893B659680049\"}";
|
||||
QByteArray postDataSize = QByteArray::number(jsonRequest.size());
|
||||
QNetworkAccessManager networkManager;
|
||||
|
||||
QNetworkRequest request(QUrl(QString("https://api.thetvdb.com/login")));
|
||||
|
||||
request.setRawHeader("Content-Type", "application/json");
|
||||
request.setRawHeader("Content-Length", postDataSize);
|
||||
|
||||
QNetworkReply* reply = networkManager.post(request, jsonRequest);
|
||||
QEventLoop loop;
|
||||
|
||||
QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
|
||||
loop.exec();
|
||||
|
||||
if (reply->error() == QNetworkReply::NoError)
|
||||
{
|
||||
QString strReply = (QString)reply->readAll();
|
||||
QJsonDocument jsonResponse = QJsonDocument::fromJson(strReply.toUtf8());
|
||||
QJsonObject jsonObj = jsonResponse.object();
|
||||
m_szToken = jsonObj["token"].toString();
|
||||
|
||||
delete reply;
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << reply->errorString();
|
||||
delete reply;
|
||||
}
|
||||
}
|
||||
|
||||
QList<cSerie*> cTheTVDBV2::search(const QString& szSerie, const QString& szLanguage)
|
||||
{
|
||||
QList<cSerie*> serieList;
|
||||
QNetworkAccessManager networkManager;
|
||||
QNetworkRequest request(QUrl(QString("https://api.thetvdb.com/search/series?name=%1").arg(szSerie)));
|
||||
|
||||
request.setRawHeader("Content-Type", "application/json");
|
||||
request.setRawHeader("Authorization", QString("Bearer %1").arg(m_szToken).toUtf8());
|
||||
if(!szLanguage.contains("all"))
|
||||
request.setRawHeader("Accept-Language", szLanguage.toUtf8());
|
||||
else
|
||||
request.setRawHeader("Accept-Language", "en");
|
||||
|
||||
QNetworkReply* reply = networkManager.get(request);
|
||||
QEventLoop loop;
|
||||
|
||||
QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
|
||||
loop.exec();
|
||||
|
||||
if (reply->error() == QNetworkReply::NoError)
|
||||
{
|
||||
QString strReply = (QString)reply->readAll();
|
||||
QJsonDocument jsonResponse = QJsonDocument::fromJson(strReply.toUtf8());
|
||||
QJsonObject jsonObj = jsonResponse.object();
|
||||
QJsonArray jsonArray = jsonObj["data"].toArray();
|
||||
|
||||
for(int z = 0;z < jsonArray.count();z++)
|
||||
{
|
||||
QJsonObject serie = jsonArray[z].toObject();
|
||||
cSerie* lpSerie = new cSerie;
|
||||
lpSerie->setID(serie["id"].toInt());
|
||||
lpSerie->setSeriesName(serie["seriesName"].toString());
|
||||
lpSerie->setFirstAired(serie["firstAired"].toString());
|
||||
serieList.append(lpSerie);
|
||||
}
|
||||
delete reply;
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << reply->errorString();
|
||||
delete reply;
|
||||
}
|
||||
return(serieList);
|
||||
}
|
||||
|
||||
cSerie* cTheTVDBV2::load(const qint32 &iID, const QString &szLanguage)
|
||||
{
|
||||
cSerie* lpSerie = 0;
|
||||
QNetworkAccessManager networkManager;
|
||||
QNetworkRequest request(QUrl(QString("https://api.thetvdb.com/series/%1").arg(iID)));
|
||||
|
||||
request.setRawHeader("Content-Type", "application/json");
|
||||
request.setRawHeader("Authorization", QString("Bearer %1").arg(m_szToken).toUtf8());
|
||||
if(!szLanguage.contains("all"))
|
||||
request.setRawHeader("Accept-Language", szLanguage.toUtf8());
|
||||
else
|
||||
request.setRawHeader("Accept-Language", "en");
|
||||
|
||||
QNetworkReply* reply = networkManager.get(request);
|
||||
QEventLoop loop;
|
||||
|
||||
QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
|
||||
loop.exec();
|
||||
|
||||
if(reply->error() != QNetworkReply::NoError)
|
||||
{
|
||||
qDebug() << reply->errorString();
|
||||
delete reply;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
QString strReply = (QString)reply->readAll();
|
||||
QJsonDocument jsonResponse = QJsonDocument::fromJson(strReply.toUtf8());
|
||||
QJsonObject jsonObj = jsonResponse.object();
|
||||
QJsonObject serieDetails = jsonObj["data"].toObject();
|
||||
|
||||
delete reply;
|
||||
|
||||
QJsonObject jsonError = jsonObj["errors"].toObject();
|
||||
if(!jsonError["invalidLanguage"].toString().isEmpty())
|
||||
{
|
||||
request = QNetworkRequest(QUrl(QString("https://api.thetvdb.com/series/%1").arg(iID)));
|
||||
request.setRawHeader("Content-Type", "application/json");
|
||||
request.setRawHeader("Authorization", QString("Bearer %1").arg(m_szToken).toUtf8());
|
||||
request.setRawHeader("Accept-Language", "en");
|
||||
|
||||
reply = networkManager.get(request);
|
||||
|
||||
QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
|
||||
loop.exec();
|
||||
|
||||
if(reply->error() != QNetworkReply::NoError)
|
||||
{
|
||||
qDebug() << reply->errorString();
|
||||
delete reply;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
strReply = (QString)reply->readAll();
|
||||
jsonResponse = QJsonDocument::fromJson(strReply.toUtf8());
|
||||
jsonObj = jsonResponse.object();
|
||||
serieDetails = jsonObj["data"].toObject();
|
||||
}
|
||||
|
||||
QJsonArray genreArray = serieDetails["genre"].toArray();
|
||||
QStringList genreList;
|
||||
|
||||
lpSerie = new cSerie;
|
||||
lpSerie->setSeriesName(serieDetails["seriesName"].toString());
|
||||
lpSerie->setSeriesID(serieDetails["seriesId"].toInt());
|
||||
lpSerie->setLanguage(szLanguage);
|
||||
lpSerie->setBanner(serieDetails["banner"].toString());
|
||||
lpSerie->setOverview(serieDetails["overview"].toString());
|
||||
lpSerie->setFirstAired(serieDetails["firstAired"].toString());
|
||||
lpSerie->setNetwork(serieDetails["network"].toString());
|
||||
lpSerie->setIMDBID(serieDetails["imdbId"].toString());
|
||||
lpSerie->setID(serieDetails["id"].toInt());
|
||||
lpSerie->setContentRating(serieDetails["rating"].toString());
|
||||
for(int z = 0;z < genreArray.count();z++)
|
||||
genreList.append(genreArray[z].toString());
|
||||
lpSerie->setGenre(genreList);
|
||||
lpSerie->setRating(serieDetails["siteRating"].toDouble());
|
||||
lpSerie->setRatingCount(serieDetails["siteRatingCount"].toInt());
|
||||
lpSerie->setRuntime(serieDetails["runtime"].toString().toInt());
|
||||
lpSerie->setStatus(serieDetails["status"].toString());
|
||||
|
||||
lpSerie->setActors(getActors(iID));
|
||||
|
||||
getEpisodes(lpSerie, szLanguage);
|
||||
|
||||
return(lpSerie);
|
||||
}
|
||||
|
||||
QStringList cTheTVDBV2::getActors(const qint32& iID)
|
||||
{
|
||||
QStringList actorsList;
|
||||
QNetworkAccessManager networkManager;
|
||||
QNetworkRequest request(QUrl(QString("https://api.thetvdb.com/series/%1/actors").arg(iID)));
|
||||
|
||||
request.setRawHeader("Content-Type", "application/json");
|
||||
request.setRawHeader("Authorization", QString("Bearer %1").arg(m_szToken).toUtf8());
|
||||
|
||||
QNetworkReply* reply = networkManager.get(request);
|
||||
QEventLoop loop;
|
||||
|
||||
QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
|
||||
loop.exec();
|
||||
|
||||
if (reply->error() == QNetworkReply::NoError)
|
||||
{
|
||||
QString strReply = (QString)reply->readAll();
|
||||
QJsonDocument jsonResponse = QJsonDocument::fromJson(strReply.toUtf8());
|
||||
QJsonObject jsonObj = jsonResponse.object();
|
||||
QJsonArray actorsArray = jsonObj["data"].toArray();
|
||||
|
||||
for(int z = 0;z < actorsArray.count();z++)
|
||||
{
|
||||
QJsonObject actor = actorsArray.at(z).toObject();
|
||||
actorsList.append(QString("%1,%2").arg(actor["name"].toString()).arg(actor["role"].toString()));
|
||||
}
|
||||
delete reply;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << reply->errorString();
|
||||
delete reply;
|
||||
}
|
||||
return(actorsList);
|
||||
}
|
||||
|
||||
void cTheTVDBV2::getEpisodes(cSerie* lpSerie, const QString& szLanguage)
|
||||
{
|
||||
QNetworkAccessManager networkManager;
|
||||
QNetworkRequest request(QUrl(QString("https://api.thetvdb.com/series/%1/episodes").arg(lpSerie->id())));
|
||||
|
||||
request.setRawHeader("Content-Type", "application/json");
|
||||
request.setRawHeader("Authorization", QString("Bearer %1").arg(m_szToken).toUtf8());
|
||||
if(!szLanguage.contains("all"))
|
||||
request.setRawHeader("Accept-Language", szLanguage.toUtf8());
|
||||
else
|
||||
request.setRawHeader("Accept-Language", "en");
|
||||
|
||||
QNetworkReply* reply = networkManager.get(request);
|
||||
QEventLoop loop;
|
||||
|
||||
QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
|
||||
loop.exec();
|
||||
|
||||
if (reply->error() == QNetworkReply::NoError)
|
||||
{
|
||||
QString strReply = (QString)reply->readAll();
|
||||
QJsonDocument jsonResponse = QJsonDocument::fromJson(strReply.toUtf8());
|
||||
QJsonObject jsonObj = jsonResponse.object();
|
||||
QJsonArray episodesArray = jsonObj["data"].toArray();
|
||||
|
||||
for(int z = 0;z < episodesArray.count();z++)
|
||||
{
|
||||
QJsonObject episode = episodesArray.at(z).toObject();
|
||||
cEpisode* lpEpisode = getEpisode(episode["id"].toInt(), szLanguage);
|
||||
cSeason* lpSeason = 0;
|
||||
|
||||
if(lpEpisode)
|
||||
{
|
||||
lpSeason = lpSerie->findSeason(lpEpisode->seasonNumber());
|
||||
if(!lpSeason)
|
||||
lpSeason = lpSerie->addSeason(lpEpisode->seasonNumber());
|
||||
if(!lpSeason)
|
||||
delete lpEpisode;
|
||||
else
|
||||
lpSeason->addEpisode(lpEpisode);
|
||||
}
|
||||
}
|
||||
delete reply;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << reply->errorString();
|
||||
delete reply;
|
||||
}
|
||||
}
|
||||
|
||||
cEpisode* cTheTVDBV2::getEpisode(const qint32& iID, const QString& szLanguage)
|
||||
{
|
||||
cEpisode* lpEpisode = 0;
|
||||
|
||||
QNetworkAccessManager networkManager;
|
||||
QNetworkRequest request(QUrl(QString("https://api.thetvdb.com/episodes/%1").arg(iID)));
|
||||
|
||||
request.setRawHeader("Content-Type", "application/json");
|
||||
request.setRawHeader("Authorization", QString("Bearer %1").arg(m_szToken).toUtf8());
|
||||
if(!szLanguage.contains("all"))
|
||||
request.setRawHeader("Accept-Language", szLanguage.toUtf8());
|
||||
else
|
||||
request.setRawHeader("Accept-Language", "en");
|
||||
|
||||
QNetworkReply* reply = networkManager.get(request);
|
||||
QEventLoop loop;
|
||||
|
||||
QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
|
||||
loop.exec();
|
||||
|
||||
if (reply->error() == QNetworkReply::NoError)
|
||||
{
|
||||
lpEpisode = new cEpisode;
|
||||
|
||||
QString strReply = (QString)reply->readAll();
|
||||
QJsonDocument jsonResponse = QJsonDocument::fromJson(strReply.toUtf8());
|
||||
QJsonObject jsonObj = jsonResponse.object();
|
||||
QJsonObject episodeObj = jsonObj["data"].toObject();
|
||||
|
||||
QJsonArray writerArray = episodeObj["writers"].toArray();
|
||||
QStringList writerList;
|
||||
QJsonArray guestArray = episodeObj["guestStars"].toArray();
|
||||
QStringList guestList;
|
||||
|
||||
lpEpisode->setID(episodeObj["id"].toInt());
|
||||
lpEpisode->setDirector(episodeObj["director"].toString());
|
||||
lpEpisode->setEpisodeName(episodeObj["episodeName"].toString());
|
||||
lpEpisode->setEpisodeNumber(episodeObj["airedEpisodeNumber"].toInt());
|
||||
lpEpisode->setFirstAired(episodeObj["firstAired"].toString());
|
||||
for(int z = 0;z < guestArray.count();z++)
|
||||
guestList.append(guestArray[z].toString());
|
||||
lpEpisode->setGuestStars(guestList);
|
||||
lpEpisode->setIMDBID(episodeObj["imdbId"].toString()); // IMDBID
|
||||
lpEpisode->setLanguage(szLanguage);
|
||||
lpEpisode->setOverview(episodeObj["overview"].toString());
|
||||
lpEpisode->setProductionCode(episodeObj["productionCode"].toString()); // PRORUCTION CODE
|
||||
lpEpisode->setRating(episodeObj["siteRating"].toDouble()); // RATING
|
||||
lpEpisode->setRatingCount(episodeObj["siteRatingCount"].toInt()); // RATING COUNT
|
||||
lpEpisode->setSeasonNumber(episodeObj["airedSeason"].toInt());
|
||||
for(int z = 0;z < writerArray.count();z++)
|
||||
writerList.append(writerArray[z].toString());
|
||||
lpEpisode->setWriter(writerList);
|
||||
lpEpisode->setSeasonID(episodeObj["airedSeasonID"].toInt()); // SEASON ID
|
||||
lpEpisode->setSeriesID(episodeObj["seriesId"].toInt()); // SERIES ID
|
||||
lpEpisode->setFileName(episodeObj["filename"].toString()); // FILENAME
|
||||
lpEpisode->setThumbHeight(episodeObj["thumbHeight"].toString().toInt());
|
||||
lpEpisode->setThumbWidth(episodeObj["thumbWidth"].toString().toInt());
|
||||
|
||||
if(!lpEpisode->isValid())
|
||||
{
|
||||
delete lpEpisode;
|
||||
return(0);
|
||||
}
|
||||
return(lpEpisode);
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << reply->errorString();
|
||||
delete reply;
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
#ifndef CTHETVDBV2_H
|
||||
#define CTHETVDBV2_H
|
||||
|
||||
|
||||
#include "cserie.h"
|
||||
|
||||
#include <QList>
|
||||
#include <QStringList>
|
||||
|
||||
|
||||
class cTheTVDBV2
|
||||
{
|
||||
public:
|
||||
cTheTVDBV2();
|
||||
|
||||
QList<cSerie*> search(const QString& szSerie, const QString& szLanguage = "all");
|
||||
cSerie* load(const qint32 &iID, const QString& szLanguage);
|
||||
private:
|
||||
QString m_szToken;
|
||||
QStringList getActors(const qint32& iID);
|
||||
void getEpisodes(cSerie* lpSerie, const QString& szLanguage);
|
||||
cEpisode* getEpisode(const qint32& iID, const QString& szLanguage);
|
||||
};
|
||||
|
||||
#endif // CTHETVDBV2_H
|
||||
+1
-3
@@ -1,7 +1,6 @@
|
||||
#include "cupdatethread.h"
|
||||
#include "cseason.h"
|
||||
#include "cepisode.h"
|
||||
#include "cthetvdbv2.h"
|
||||
#include "cmessagedialog.h"
|
||||
#include <QMessageBox>
|
||||
|
||||
@@ -26,7 +25,7 @@ void cUpdateThread::run()
|
||||
QTime timer;
|
||||
timer.restart();
|
||||
QString szFailed;
|
||||
|
||||
/*
|
||||
for(int x = 0;x < m_serieList.count();x++)
|
||||
{
|
||||
cSerie* lpSerie = m_serieList.at(x);
|
||||
@@ -71,7 +70,6 @@ void cUpdateThread::run()
|
||||
break;
|
||||
msleep(10);
|
||||
}
|
||||
/*
|
||||
if(szFailed.length())
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
|
||||
@@ -28,7 +28,6 @@ SOURCES += main.cpp\
|
||||
cmessagedialog.cpp \
|
||||
cupdatethread.cpp \
|
||||
cpicturesthread.cpp \
|
||||
cthetvdbv2.cpp \
|
||||
cthemoviedbv3.cpp \
|
||||
cmovie.cpp \
|
||||
cmoviesearch.cpp \
|
||||
@@ -52,7 +51,6 @@ HEADERS += cmainwindow.h \
|
||||
cmessagedialog.h \
|
||||
cupdatethread.h \
|
||||
cpicturesthread.h \
|
||||
cthetvdbv2.h \
|
||||
cthemoviedbv3.h \
|
||||
cmovie.h \
|
||||
cmoviesearch.h \
|
||||
|
||||
Reference in New Issue
Block a user