29 if ((pProgram ==
nullptr) || (pInfo ==
nullptr))
34 pProgram->setTitle ( pInfo->
GetTitle() );
38 pProgram->setRepeat ( pInfo->
IsRepeat() );
50 pProgram->setStars ( pInfo->
GetStars() );
68 pProgram->setAirdate( year );
73 pProgram->setSeason ( pInfo->
GetSeason() );
81 pProgram->enableCast(
false);
95 pProgram->enableChannel(
false);
113 pRecording->setFileName ( pRecInfo.
GetPathname() );
114 pRecording->setFileSize ( pRecInfo.
GetFilesize() );
115 pRecording->setHostName ( pRecInfo.
GetHostname() );
125 pRecording->setEncoderId ( pRecInfo.
GetInputID() );
131 pProgram->enableRecording(
false);
133 if ( bIncArtwork && !pInfo->
GetInetRef().isEmpty() )
136 pProgram->enableArtwork(
false);
148 if (channel.
Load(nChanID))
167 pChannel->setChanId(channelInfo.
m_chanId);
168 pChannel->setChanNum(channelInfo.
m_chanNum);
169 pChannel->setCallSign(channelInfo.
m_callSign);
170 if (!channelInfo.
m_icon.isEmpty())
172 QString sIconURL = QString(
"/Guide/GetChannelIcon?ChanId=%3")
174 pChannel->setIconURL( sIconURL );
176 pChannel->setChannelName(channelInfo.
m_name);
182 pChannel->setMplexId(channelInfo.
m_mplexId);
187 pChannel->setFineTune(channelInfo.
m_fineTune);
188 pChannel->setFrequencyId(channelInfo.
m_freqId);
190 pChannel->setSourceId(channelInfo.
m_sourceId);
193 pChannel->setXMLTVID(channelInfo.
m_xmltvId);
199 for (
int x = 0; x < groupIds.size(); x++)
204 sGroupIds += QString::number(groupIds.at(x));
206 pChannel->setChannelGroups(sGroupIds);
210 for (
int x = 0; x < inputIds.size(); x++)
215 sInputIds += QString::number(inputIds.at(x));
217 pChannel->setInputs(sInputIds);
228 pGroup->setGroupId(pGroupItem.
m_grpId);
229 pGroup->setName(pGroupItem.
m_name);
230 pGroup->setPassword(
"");
240 if ((pRecRule ==
nullptr) || (pRule ==
nullptr))
246 pRecRule->setTitle ( pRule->
m_title );
249 pRecRule->setSeason ( pRule->
m_season );
250 pRecRule->setEpisode ( pRule->
m_episode );
252 pRecRule->setStartTime ( QDateTime(pRule->
m_startdate,
254 pRecRule->setEndTime ( QDateTime(pRule->
m_enddate,
258 pRecRule->setInetref ( pRule->
m_inetref );
260 pRecRule->setCallSign ( pRule->
m_station );
261 pRecRule->setFindDay ( pRule->
m_findday );
266 pRecRule->setPreferredInput ( pRule->
m_prefInput );
272 pRecRule->setFilter ( pRule->
m_filter );
295 const QString &sInetref,
299 for (
auto i = map.cbegin(); i != map.cend(); ++i)
302 pArtInfo->setFileName(i.value().url);
306 pArtInfo->setStorageGroup(
"Fanart");
307 pArtInfo->setType(
"fanart");
308 pArtInfo->setURL(QString(
"/Content/GetImageFile?StorageGroup=%1"
311 QString(QUrl::toPercentEncoding(
312 QUrl(i.value().url).path()))));
315 pArtInfo->setStorageGroup(
"Banners");
316 pArtInfo->setType(
"banner");
317 pArtInfo->setURL(QString(
"/Content/GetImageFile?StorageGroup=%1"
320 QString(QUrl::toPercentEncoding(
321 QUrl(i.value().url).path()))));
325 pArtInfo->setStorageGroup(
"Coverart");
326 pArtInfo->setType(
"coverart");
327 pArtInfo->setURL(QString(
"/Content/GetImageFile?StorageGroup=%1"
330 QString(QUrl::toPercentEncoding(
331 QUrl(i.value().url).path()))));
343 query.
prepare(
"SELECT genre from videogenre "
344 "LEFT JOIN videometadatagenre ON videometadatagenre.idgenre = videogenre.intid "
345 "WHERE idvideo = :ID "
349 if (query.
exec() && query.
size() > 0)
354 QString genre = query.
value(0).toString();
355 pGenre->setName(genre);
366 pVideoMetadataInfo->setId(pMetadata->GetID());
367 pVideoMetadataInfo->setTitle(pMetadata->GetTitle());
368 pVideoMetadataInfo->setSubTitle(pMetadata->GetSubtitle());
369 pVideoMetadataInfo->setTagline(pMetadata->GetTagline());
370 pVideoMetadataInfo->setDirector(pMetadata->GetDirector());
371 pVideoMetadataInfo->setStudio(pMetadata->GetStudio());
372 pVideoMetadataInfo->setDescription(pMetadata->GetPlot());
373 pVideoMetadataInfo->setCertification(pMetadata->GetRating());
374 pVideoMetadataInfo->setInetref(pMetadata->GetInetRef());
375 pVideoMetadataInfo->setCollectionref(pMetadata->GetCollectionRef());
376 pVideoMetadataInfo->setHomePage(pMetadata->GetHomepage());
377 pVideoMetadataInfo->setReleaseDate(
378 QDateTime(pMetadata->GetReleaseDate(),
379 QTime(0,0),Qt::LocalTime).toUTC());
380 pVideoMetadataInfo->setAddDate(
381 QDateTime(pMetadata->GetInsertdate(),
382 QTime(0,0),Qt::LocalTime).toUTC());
383 pVideoMetadataInfo->setUserRating(pMetadata->GetUserRating());
384 pVideoMetadataInfo->setChildID(pMetadata->GetChildID());
385 pVideoMetadataInfo->setLength(pMetadata->GetLength().count());
386 pVideoMetadataInfo->setPlayCount(pMetadata->GetPlayCount());
387 pVideoMetadataInfo->setSeason(pMetadata->GetSeason());
388 pVideoMetadataInfo->setEpisode(pMetadata->GetEpisode());
389 pVideoMetadataInfo->setParentalLevel(pMetadata->GetShowLevel());
390 pVideoMetadataInfo->setVisible(pMetadata->GetBrowse());
391 pVideoMetadataInfo->setWatched(pMetadata->GetWatched());
392 pVideoMetadataInfo->setProcessed(pMetadata->GetProcessed());
394 pMetadata->GetContentType()));
395 pVideoMetadataInfo->setFileName(pMetadata->GetFilename());
396 pVideoMetadataInfo->setHash(pMetadata->GetHash());
397 pVideoMetadataInfo->setHostName(pMetadata->GetHost());
398 pVideoMetadataInfo->setCoverart(pMetadata->GetCoverFile());
399 pVideoMetadataInfo->setFanart(pMetadata->GetFanart());
400 pVideoMetadataInfo->setBanner(pMetadata->GetBanner());
401 pVideoMetadataInfo->setScreenshot(pMetadata->GetScreenshot());
402 pVideoMetadataInfo->setTrailer(pMetadata->GetTrailer());
406 if (!pMetadata->GetFanart().isEmpty())
409 pVideoMetadataInfo->
Artwork()->AddNewArtworkInfo();
410 pArtInfo->setStorageGroup(
"Fanart");
411 pArtInfo->setType(
"fanart");
412 pArtInfo->setURL(QString(
"/Content/GetImageFile?StorageGroup=%1"
416 QUrl::toPercentEncoding(pMetadata->GetFanart()))));
418 if (!pMetadata->GetCoverFile().isEmpty())
421 pVideoMetadataInfo->
Artwork()->AddNewArtworkInfo();
422 pArtInfo->setStorageGroup(
"Coverart");
423 pArtInfo->setType(
"coverart");
424 pArtInfo->setURL(QString(
"/Content/GetImageFile?StorageGroup=%1"
428 QUrl::toPercentEncoding(pMetadata->GetCoverFile()))));
430 if (!pMetadata->GetBanner().isEmpty())
433 pVideoMetadataInfo->
Artwork()->AddNewArtworkInfo();
434 pArtInfo->setStorageGroup(
"Banners");
435 pArtInfo->setType(
"banner");
436 pArtInfo->setURL(QString(
"/Content/GetImageFile?StorageGroup=%1"
440 QUrl::toPercentEncoding(pMetadata->GetBanner()))));
442 if (!pMetadata->GetScreenshot().isEmpty())
445 pVideoMetadataInfo->
Artwork()->AddNewArtworkInfo();
446 pArtInfo->setStorageGroup(
"Screenshots");
447 pArtInfo->setType(
"screenshot");
448 pArtInfo->setURL(QString(
"/Content/GetImageFile?StorageGroup=%1"
452 QUrl::toPercentEncoding(pMetadata->GetScreenshot()))));
466 pVideoMetadataInfo->setId(pMetadata->
ID());
467 pVideoMetadataInfo->setArtist(pMetadata->
Artist());
469 pVideoMetadataInfo->setAlbum(pMetadata->
Album());
470 pVideoMetadataInfo->setTitle(pMetadata->
Title());
471 pVideoMetadataInfo->setTrackNo(pMetadata->
Track());
472 pVideoMetadataInfo->setGenre(pMetadata->
Genre());
473 pVideoMetadataInfo->setYear(pMetadata->
Year());
474 pVideoMetadataInfo->setPlayCount(pMetadata->
PlayCount());
475 pVideoMetadataInfo->setLength(pMetadata->
Length().count());
476 pVideoMetadataInfo->setRating(pMetadata->
Rating());
477 pVideoMetadataInfo->setFileName(pMetadata->
Filename());
478 pVideoMetadataInfo->setHostName(pMetadata->
Hostname());
479 pVideoMetadataInfo->setLastPlayed(pMetadata->
LastPlay());
480 pVideoMetadataInfo->setCompilation(pMetadata->
Compilation());
491 input->setInputName(inputInfo.
m_name);
506 if (!pCastMemberList || !pInfo)
513 table =
"recordedcredits";
517 query.
prepare(QString(
"SELECT role, people.name, roles.name FROM %1"
519 " LEFT JOIN people ON"
520 " credits.person = people.person"
521 " LEFT JOIN roles ON"
522 " credits.roleid = roles.roleid"
523 " WHERE credits.chanid = :CHANID"
524 " AND credits.starttime = :STARTTIME"
525 " ORDER BY role, priority;").arg(table));
530 if (query.
exec() && query.
size() > 0)
532 QMap<QString, QString> translations;
533 translations[
"ACTOR"] = QObject::tr(
"Actors");
534 translations[
"DIRECTOR"] = QObject::tr(
"Director");
535 translations[
"PRODUCER"] = QObject::tr(
"Producer");
536 translations[
"EXECUTIVE_PRODUCER"] = QObject::tr(
"Executive Producer");
537 translations[
"WRITER"] = QObject::tr(
"Writer");
538 translations[
"GUEST_STAR"] = QObject::tr(
"Guest Star");
539 translations[
"HOST"] = QObject::tr(
"Host");
540 translations[
"ADAPTER"] = QObject::tr(
"Adapter");
541 translations[
"PRESENTER"] = QObject::tr(
"Presenter");
542 translations[
"COMMENTATOR"] = QObject::tr(
"Commentator");
543 translations[
"GUEST"] = QObject::tr(
"Guest");
549 QString role = query.
value(0).toString();
550 pCastMember->setTranslatedRole(translations.value(role.toUpper()));
551 pCastMember->setRole(role);
567 pCastMember->setName(QString::fromUtf8(query.
value(1)
568 .toByteArray().constData()));
569 pCastMember->setCharacterName(QString::fromUtf8(query.
value(2)
570 .toByteArray().constData()));
580 frm_dir_map_t::const_iterator it;
586 for (it = markMap.cbegin(); it != markMap.cend(); ++it)
592 pCutting->setMark(*it);
593 pCutting->setOffset(it.key());
595 else if (marktype == 1)
601 pCutting->setMark(*it);
602 pCutting->setOffset(offset);
605 else if (marktype == 2)
611 pCutting->setMark(*it);
612 pCutting->setOffset(offset);
622 frm_dir_map_t::const_iterator it;
628 for (it = markMap.cbegin(); it != markMap.cend(); ++it)
634 pCutting->setMark(*it);
635 pCutting->setOffset(it.key());
637 else if (marktype == 1)
643 pCutting->setMark(*it);
644 pCutting->setOffset(offset);
647 else if (marktype == 2)
653 pCutting->setMark(*it);
654 pCutting->setOffset(offset);
668 frm_pos_map_t::const_iterator it;
674 for (it = markMap.cbegin(); it != markMap.cend(); ++it)
677 pCutting->setMark(it.key());
678 pCutting->setOffset(it.value());
687 for (
auto * elink : qAsConst(
gTVList))
689 if (elink !=
nullptr)
692 auto *pEncoder =
new V2Encoder( parent );
693 list.append( QVariant::fromValue<QObject *>( pEncoder ));
695 pEncoder->setId ( elink->GetInputID() );
696 pEncoder->setState ( elink->GetState() );
697 pEncoder->setLocal ( elink->IsLocal() );
698 pEncoder->setConnected ( elink->IsConnected() );
699 pEncoder->setSleepStatus ( elink->GetSleepStatus() );
701 if (pEncoder->GetLocal())
704 pEncoder->setHostName( elink->GetHostName() );
706 for (
const auto & inputInfo : qAsConst(inputInfoList))
708 if (inputInfo.m_inputId ==
static_cast<uint>(elink->GetInputID()))
710 V2Input *input = pEncoder->AddNewInput();
715 bool progFound =
false;
717 switch ( pEncoder->GetState() )
739 pProgram->setProperty(
"isNull",QVariant(
true));
767 for (
auto it = tmpList.begin(); it < tmpList.end(); ++it)
769 if ((nRecStatus == -999
770 && (*it)->GetRecordingStatus() >= 0)
771 || (nRecStatus != 0 && nRecStatus != -999
772 && (*it)->GetRecordingStatus() != nRecStatus))
801 nStartIndex = (nStartIndex > 0) ? std::min( nStartIndex, (
int)recordingList.
size() ) : 0;
802 nCount = (nCount > 0) ? std::min( nCount, (
int)recordingList.
size() ) : recordingList.
size();
803 int nEndIndex = std::min((nStartIndex + nCount), (
int)recordingList.
size() );
805 for(
int n = nStartIndex; n < nEndIndex; n++)
808 auto *pProgram =
new V2Program( parent );
809 list.append( QVariant::fromValue<QObject *>( pProgram ));
813 return recordingList.
size();
818 QMap<QString, Frontend*> frontends;
824 for (
auto * fe : qAsConst(frontends))
827 list.append( QVariant::fromValue<QObject *>( pFrontend ));
828 pFrontend->setName(fe->m_name);
829 pFrontend->setIP(fe->m_ip.toString());
832 pFrontend->setPort(port);
833 pFrontend->setOnLine(fe->m_connectionCount > 0);
843 query.
prepare(
"INSERT INTO recgroups SET recgroup = :NAME, "
844 "displayname = :DISPLAYNAME");
846 query.
bindValue(
":DISPLAYNAME", groupName);
852 LOG(VB_GENERAL, LOG_ERR, QString(
"Could not create recording group (%1). "
853 "Does it already exist?").arg(groupName));
863 QJsonArray members = cast[
"CastMembers"].toArray();
864 for (
const auto & m : members)
866 QJsonObject actor = m.toObject();
867 QString name = actor.value(
"Name").toString(
"");
868 QString character = actor.value(
"CharacterName").toString(
"");
869 QString role = actor.value(
"Role").toString(
"");
871 credits->push_back(
DBPerson(role, name, priority++, character));