MCPcopy Create free account
hub / github.com/KikoPlayProject/KikoPlay / updateEpTime

Method updateEpTime

MediaLibrary/animeworker.cpp:470–505  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

468}
469
470void AnimeWorker::updateEpTime(const QString &animeName, const QString &path, bool finished, qint64 epTime)
471{
472 ThreadTask task(GlobalObjects::workThread);
473 task.RunOnce([=](){
474 QSqlQuery query(DBManager::instance()->getDB(DBManager::Bangumi));
475 if(finished)
476 {
477 QSqlQuery checkQuery(DBManager::instance()->getDB(DBManager::Bangumi));
478 checkQuery.prepare("select LastPlayTime from episode where LocalFile=?");
479 checkQuery.bindValue(0, path);
480 checkQuery.exec();
481 if(checkQuery.first())
482 {
483 if(checkQuery.value(0).isNull())
484 {
485 updateEpTime(animeName, path);
486 }
487 }
488 query.prepare("update episode set FinishTime=? where LocalFile=?");
489 }
490 else
491 {
492 query.prepare("update episode set LastPlayTime=? where LocalFile=?");
493 }
494 qint64 time = epTime==0?QDateTime::currentDateTime().toSecsSinceEpoch():epTime;
495 query.bindValue(0,time);
496 query.bindValue(1,path);
497 query.exec();
498 Anime *anime = getAnimeInMap(animeName);
499 if(anime && anime->epLoaded)
500 {
501 anime->updateEpTime(path, time, finished);
502 emit epUpdated(animeName, path);
503 }
504 });
505}
506
507void AnimeWorker::updateEpInfo(const QString &animeName, const QString &path, const EpInfo &nEp)
508{

Callers

nothing calls this directly

Calls 4

RunOnceMethod · 0.80
getDBMethod · 0.80
isNullMethod · 0.80
valueMethod · 0.80

Tested by

no test coverage detected