added resolution field for series

This commit is contained in:
2019-02-19 17:24:12 +01:00
parent 445ec6e3ba
commit 8915a0a216
9 changed files with 57 additions and 208 deletions
+6
View File
@@ -109,6 +109,7 @@ void cEdit::setSerie(cSerie* lpSerie)
ui->m_lpCliffhanger->setChecked(lpSerie->cliffhanger());
ui->m_lpDownloadLink->setText(lpSerie->download());
ui->m_lpLocalPath->setText(lpSerie->localPath());
ui->m_lpResolution->setText(lpSerie->resolution());
QString szBanner = lpSerie->fanartBanner();
{
@@ -270,6 +271,11 @@ QString cEdit::localPath()
return(ui->m_lpLocalPath->text());
}
QString cEdit::resolution()
{
return(ui->m_lpResolution->text());
}
void cEdit::on_m_lpTabWidget_tabBarClicked(int index)
{
if(index == 1)
+7
View File
@@ -57,6 +57,13 @@ public:
\return QString
*/
QString localPath();
/*!
\brief
\fn resolution
\return QString
*/
QString resolution();
private slots:
/*!
\brief
+12 -2
View File
@@ -66,7 +66,7 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,4,0,2,0,1">
<item>
<widget class="QLabel" name="m_lpDownloadLinkLabel">
<property name="text">
@@ -87,6 +87,16 @@
<item>
<widget class="QLineEdit" name="m_lpLocalPath"/>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Resolution:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="m_lpResolution"/>
</item>
</layout>
</item>
<item>
@@ -206,7 +216,7 @@
<bool>false</bool>
</attribute>
<attribute name="headerDefaultSectionSize">
<number>0</number>
<number>35</number>
</attribute>
</widget>
</item>
+5 -13
View File
@@ -274,6 +274,7 @@ void cMainWindow::initDB()
" status STRING,"
" download STRING,"
" localPath STRING,"
" resolution STRING,"
" cliffhanger BOOL);");
}
@@ -357,6 +358,7 @@ void cMainWindow::initDB()
" video BOOL,"
" cast TEXT,"
" crew TEXT,"
" localPath STRING,"
" state INTEGER);");
}
}
@@ -469,6 +471,7 @@ void cMainWindow::loadSeriesDB()
" serie.status status,"
" serie.download download,"
" serie.localPath localPath,"
" serie.resolution resolution,"
" serie.cliffhanger cliffhanger,"
" season._id s__id,"
" season.airDate s_airDate,"
@@ -545,6 +548,7 @@ void cMainWindow::loadSeriesDB()
lpSerie->setStatus(query.value("status").toString());
lpSerie->setDownload(query.value("download").toString());
lpSerie->setLocalPath(query.value("localPath").toString());
lpSerie->setResolution(query.value("resolution").toString());
lpSerie->setCliffhanger(query.value("cliffhanger").toBool());
}
@@ -1189,6 +1193,7 @@ bool cMainWindow::runEdit(cSerie* lpSerie, QString& szDownload)
lpSerie->setDownload(szDownload);
lpSerie->setLocalPath(lpEdit->localPath());
lpSerie->setResolution(lpEdit->resolution());
lpSerie->updateState();
@@ -1695,15 +1700,6 @@ void cMainWindow::doUpdate(cSerieList& serieList)
updateDone();
// m_lpUpdateThread = new cUpdateThread;
// m_lpUpdateThread->setData(m_lpMessageDialog, serieList, m_db);
// connect(m_lpUpdateThread, SIGNAL(finished()), this, SLOT(updateDone()));
// connect(m_lpUpdateThread, SIGNAL(updateMessage(QString,qint32)), this, SLOT(updateMessage(QString,qint32)));
// connect(m_lpUpdateThread, SIGNAL(updateAppendMessage(QString)), this, SLOT(updateAppendMessage(QString)));
// m_lpUpdateThread->start();
}
}
@@ -1722,10 +1718,6 @@ void cMainWindow::updateAppendMessage(const QString& szMessage)
void cMainWindow::updateDone()
{
// if(m_lpUpdateThread)
// delete m_lpUpdateThread;
// m_lpUpdateThread = 0;
loadDB();
displaySeries();
applySeriesFilter();
+3 -2
View File
@@ -540,8 +540,8 @@ bool cSerie::save(QSqlDatabase &db)
QSqlQuery queryEpisode;
QSqlQuery queryFanart;
querySerie.prepare("INSERT INTO serie (seriesID,seriesName,originalName,backdropPath,createdBy,homepage,lastAired,languages,networks,nrEpisodes,nrSeasons,originCountries,originalLanguage,popularity,posterPath,productionCompanies,type,voteAverage,voteCount,overview,firstAired,cast,crew,genre,imdbid,freebasemid,freebaseid,tvdbid,tvrageid,status,download,localPath,cliffhanger)"
" VALUES (:seriesID,:seriesName,:originalName,:backdropPath,:createdBy,:homepage,:lastAired,:languages,:networks,:nrEpisodes,:nrSeasons,:originCountries,:originalLanguage,:popularity,:posterPath,:productionCompanies,:type,:voteAverage,:voteCount,:overview,:firstAired,:cast,:crew,:genre,:imdbid,:freebasemid,:freebaseid,:tvdbid,:tvrageid,:status,:download,:localPath,:cliffhanger);");
querySerie.prepare("INSERT INTO serie (seriesID,seriesName,originalName,backdropPath,createdBy,homepage,lastAired,languages,networks,nrEpisodes,nrSeasons,originCountries,originalLanguage,popularity,posterPath,productionCompanies,type,voteAverage,voteCount,overview,firstAired,cast,crew,genre,imdbid,freebasemid,freebaseid,tvdbid,tvrageid,status,download,localPath,resolution,cliffhanger)"
" VALUES (:seriesID,:seriesName,:originalName,:backdropPath,:createdBy,:homepage,:lastAired,:languages,:networks,:nrEpisodes,:nrSeasons,:originCountries,:originalLanguage,:popularity,:posterPath,:productionCompanies,:type,:voteAverage,:voteCount,:overview,:firstAired,:cast,:crew,:genre,:imdbid,:freebasemid,:freebaseid,:tvdbid,:tvrageid,:status,:download,:localPath,:resolution,:cliffhanger);");
querySeason.prepare("INSERT INTO season (_id,airDate,name,overview,id,posterPath,seasonNumber,seriesID) VALUES (:_id,:airDate,:name,:overview,:id,:posterPath,:seasonNumber,:seriesID);");
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);");
@@ -585,6 +585,7 @@ bool cSerie::save(QSqlDatabase &db)
querySerie.bindValue(":status", status());
querySerie.bindValue(":download", download());
querySerie.bindValue(":localPath", localPath());
querySerie.bindValue(":resolution", resolution());
querySerie.bindValue(":cliffhanger", cliffhanger());
if(querySerie.exec())
{
+24
View File
@@ -562,6 +562,29 @@ public:
\fn setCliffhanger
\param bCliffhanger
*/
/*!
\brief
\fn setResolution
\param szResolution
*/
void setResolution(const QString& szResolution);
/*!
\brief
\fn resolution
\return QString
*/
QString resolution();
/*!
\brief
\fn setCliffhanger
\param bCliffhanger
*/
void setCliffhanger(const bool& bCliffhanger);
/*!
\brief
@@ -790,6 +813,7 @@ private:
QString m_szStatus; /*!< TODO: describe */
QString m_szDownload; /*!< TODO: describe */
QString m_szLocalPath; /*!< TODO: describe */
QString m_szResolution; /*!< TODO: describe */
bool m_bCliffhanger; /*!< TODO: describe */
cFanartList m_fanartList; /*!< TODO: describe */
QList<cSeason*> m_seasonList; /*!< TODO: describe */
-107
View File
@@ -1,107 +0,0 @@
#include "cupdatethread.h"
#include "cseason.h"
#include "cepisode.h"
#include "cmessagedialog.h"
#include "cthemoviedbv3.h"
#include <QMessageBox>
#include <QDebug>
#include <QTime>
cUpdateThread::cUpdateThread() :
m_bStop(false)
{
}
void cUpdateThread::stop()
{
QMutexLocker locker(&m_mutex);
m_bStop = true;
emit updateAppendMessage(" - cancel pending ...");
}
void cUpdateThread::run()
{
QTime timer;
timer.restart();
QString szFailed;
for(int x = 0;x < m_serieList.count();x++)
{
cSerie* lpSerie = m_serieList.at(x);
if(lpSerie)
{
emit updateMessage(lpSerie->seriesName(), x);
cTheMovieDBV3 theMovieDB;
cSerie* lpSerieNew;
if(lpSerie->seriesID() != -1 && lpSerie->seriesID() < 1000000)
{
lpSerieNew = theMovieDB.loadSerie(lpSerie->seriesID(), "de-DE");
if(!lpSerieNew)
lpSerieNew = theMovieDB.loadSerie(lpSerie->seriesID(), "en");
if(!lpSerieNew)
{
if(szFailed.length())
szFailed += ", ";
szFailed += lpSerie->seriesName();
continue;
}
lpSerieNew->loadFanart();
cFanartList fanartList = lpSerie->fanartList();
cFanartList fanartListNew = lpSerieNew->fanartList();
for(int x = 0;x < fanartListNew.count();x++)
{
cFanart* lpFanartNew = fanartListNew.at(x);
for(int y = 0;y < fanartList.count();y++)
{
cFanart* lpFanart = fanartList.at(y);
if(lpFanartNew->id() == lpFanart->id())
{
lpFanartNew->setActive(lpFanart->active());
break;
}
}
}
lpSerieNew->setDownload(lpSerie->download());
for(int x = 0;x < lpSerieNew->seasonList().count();x++)
{
cSeason* lpSeasonNew = lpSerieNew->seasonList().at(x);
for(int y = 0;y < lpSeasonNew->episodeList().count();y++)
{
cEpisode* lpEpisodeNew = lpSeasonNew->episodeList().at(y);
cEpisode* lpEpisode = lpSerie->findEpisode(lpEpisodeNew->id());
if(lpEpisode)
lpEpisodeNew->setState(lpEpisode->state());
}
}
lpSerieNew->setCliffhanger(lpSerie->cliffhanger());
if(!m_db.isOpen())
m_db.open();
lpSerie->del(m_db);
lpSerieNew->save(m_db);
}
}
QMutexLocker locker(&m_mutex);
if(m_bStop)
break;
msleep(10);
}
if(szFailed.length())
{
QMessageBox msgBox;
msgBox.setText(szFailed + QString(" has failed to update."));
msgBox.exec();
}
}
void cUpdateThread::setData(cMessageDialog* lpMessageDialog, const cSerieList &serieList, const QSqlDatabase& db)
{
connect(lpMessageDialog->cancelButton(), SIGNAL(clicked()), this, SLOT(stop()));
m_serieList = serieList;
m_db = db;
}
-82
View File
@@ -1,82 +0,0 @@
#ifndef CUPDATETHREAD_H
#define CUPDATETHREAD_H
#include "cmessagedialog.h"
#include "cserie.h"
#include <QThread>
#include <QMutexLocker>
#include <QList>
#include <QStandardItem>
#include <QSqlDatabase>
/*!
\brief
\class cUpdateThread cupdatethread.h "cupdatethread.h"
*/
class cUpdateThread : public QThread
{
Q_OBJECT
public:
/*!
\brief
\fn cUpdateThread
*/
explicit cUpdateThread();
/*!
\brief
\fn setData
\param lpMessageDialog
\param serieList
\param db
*/
void setData(cMessageDialog *lpMessageDialog, const cSerieList& serieList, const QSqlDatabase& db);
public slots:
/*!
\brief
\fn stop
*/
void stop();
signals:
/*!
\brief
\fn updateMessage
\param szMessage
\param iProgress
*/
void updateMessage(const QString& szMessage, const qint32 &iProgress);
/*!
\brief
\fn updateAppendMessage
\param szMessage
*/
void updateAppendMessage(const QString& szMessage);
private:
QMutex m_mutex; /*!< TODO: describe */
bool m_bStop; /*!< TODO: describe */
cSerieList m_serieList; /*!< TODO: describe */
QSqlDatabase m_db; /*!< TODO: describe */
QWidget* m_lpParent; /*!< TODO: describe */
/*!
\brief
\fn run
*/
void run();
};
#endif // CUPDATETHREAD_H
-2
View File
@@ -25,7 +25,6 @@ SOURCES += main.cpp\
cverticallabel.cpp \
cepisodedetails.cpp \
cmessagedialog.cpp \
cupdatethread.cpp \
cpicturesthread.cpp \
cthemoviedbv3.cpp \
cmovie.cpp \
@@ -63,7 +62,6 @@ HEADERS += cmainwindow.h \
cverticallabel.h \
cepisodedetails.h \
cmessagedialog.h \
cupdatethread.h \
cpicturesthread.h \
cthemoviedbv3.h \
cmovie.h \