28 #include <QJsonObject>
55 if ((pProgram ==
nullptr) || (pInfo ==
nullptr))
60 pProgram->setTitle ( pInfo->
GetTitle() );
64 pProgram->setRepeat ( pInfo->
IsRepeat() );
72 pProgram->setSerializeDetails( bDetails );
78 pProgram->setStars ( pInfo->
GetStars() );
96 pProgram->setAirdate( year );
101 pProgram->setSeason ( pInfo->
GetSeason() );
106 pProgram->setSerializeCast(bIncCast);
112 pProgram->setSerializeChannel( bIncChannel );
130 pProgram->setSerializeRecording(
true );
142 pRecording->setSerializeDetails( bDetails );
146 pRecording->setFileName ( pRecInfo.
GetPathname() );
147 pRecording->setFileSize ( pRecInfo.
GetFilesize() );
148 pRecording->setHostName ( pRecInfo.
GetHostname() );
158 pRecording->setEncoderId ( pRecInfo.
GetInputID() );
166 pProgram->setSerializeArtwork(
true );
182 if (channel.
Load(nChanID))
201 pChannel->setChanId(channelInfo.
m_chanId);
202 pChannel->setChanNum(channelInfo.
m_chanNum);
203 pChannel->setCallSign(channelInfo.
m_callSign);
204 if (!channelInfo.
m_icon.isEmpty())
206 QString sIconURL = QString(
"/Guide/GetChannelIcon?ChanId=%3")
208 pChannel->setIconURL( sIconURL );
210 pChannel->setChannelName(channelInfo.
m_name);
212 #ifndef _WIN32 // Needs fixing for Windows
216 pChannel->setSerializeDetails( bDetails );
220 pChannel->setMplexId(channelInfo.
m_mplexId);
225 pChannel->setFineTune(channelInfo.
m_fineTune);
226 pChannel->setFrequencyId(channelInfo.
m_freqId);
228 pChannel->setSourceId(channelInfo.
m_sourceId);
231 pChannel->setXMLTVID(channelInfo.
m_xmltvId);
237 for (
int x = 0; x < groupIds.size(); x++)
242 sGroupIds += QString::number(groupIds.at(x));
244 pChannel->setChannelGroups(sGroupIds);
248 for (
int x = 0; x < inputIds.size(); x++)
253 sInputIds += QString::number(inputIds.at(x));
255 pChannel->setInputs(sInputIds);
270 pGroup->setGroupId(pGroupItem.
m_grpId);
271 pGroup->setName(pGroupItem.
m_name);
272 pGroup->setPassword(
"");
282 if ((pRecRule ==
nullptr) || (pRule ==
nullptr))
288 pRecRule->setTitle ( pRule->
m_title );
291 pRecRule->setSeason ( pRule->
m_season );
292 pRecRule->setEpisode ( pRule->
m_episode );
294 pRecRule->setStartTime ( QDateTime(pRule->
m_startdate,
296 pRecRule->setEndTime ( QDateTime(pRule->
m_enddate,
300 pRecRule->setInetref ( pRule->
m_inetref );
302 pRecRule->setCallSign ( pRule->
m_station );
303 pRecRule->setFindDay ( pRule->
m_findday );
308 pRecRule->setPreferredInput ( pRule->
m_prefInput );
314 pRecRule->setFilter ( pRule->
m_filter );
341 const QString &sInetref,
345 for (
auto i = map.cbegin(); i != map.cend(); ++i)
348 pArtInfo->setFileName(i.value().url);
352 pArtInfo->setStorageGroup(
"Fanart");
353 pArtInfo->setType(
"fanart");
354 pArtInfo->setURL(QString(
"/Content/GetImageFile?StorageGroup=%1"
357 QString(QUrl::toPercentEncoding(
358 QUrl(i.value().url).path()))));
361 pArtInfo->setStorageGroup(
"Banners");
362 pArtInfo->setType(
"banner");
363 pArtInfo->setURL(QString(
"/Content/GetImageFile?StorageGroup=%1"
366 QString(QUrl::toPercentEncoding(
367 QUrl(i.value().url).path()))));
371 pArtInfo->setStorageGroup(
"Coverart");
372 pArtInfo->setType(
"coverart");
373 pArtInfo->setURL(QString(
"/Content/GetImageFile?StorageGroup=%1"
376 QString(QUrl::toPercentEncoding(
377 QUrl(i.value().url).path()))));
393 query.
prepare(
"SELECT genre from videogenre "
394 "LEFT JOIN videometadatagenre ON videometadatagenre.idgenre = videogenre.intid "
395 "WHERE idvideo = :ID "
399 if (query.
exec() && query.
size() > 0)
404 QString genre = query.
value(0).toString();
405 pGenre->setName(genre);
419 pVideoMetadataInfo->setId(pMetadata->GetID());
420 pVideoMetadataInfo->setTitle(pMetadata->GetTitle());
421 pVideoMetadataInfo->setSubTitle(pMetadata->GetSubtitle());
422 pVideoMetadataInfo->setTagline(pMetadata->GetTagline());
423 pVideoMetadataInfo->setDirector(pMetadata->GetDirector());
424 pVideoMetadataInfo->setStudio(pMetadata->GetStudio());
425 pVideoMetadataInfo->setDescription(pMetadata->GetPlot());
426 pVideoMetadataInfo->setCertification(pMetadata->GetRating());
427 pVideoMetadataInfo->setInetref(pMetadata->GetInetRef());
428 pVideoMetadataInfo->setCollectionref(pMetadata->GetCollectionRef());
429 pVideoMetadataInfo->setHomePage(pMetadata->GetHomepage());
430 pVideoMetadataInfo->setReleaseDate(
431 QDateTime(pMetadata->GetReleaseDate(),
432 QTime(0,0),Qt::LocalTime).toUTC());
433 pVideoMetadataInfo->setAddDate(
434 QDateTime(pMetadata->GetInsertdate(),
435 QTime(0,0),Qt::LocalTime).toUTC());
436 pVideoMetadataInfo->setUserRating(pMetadata->GetUserRating());
437 pVideoMetadataInfo->setChildID(pMetadata->GetChildID());
438 pVideoMetadataInfo->setLength(pMetadata->GetLength().count());
439 pVideoMetadataInfo->setPlayCount(pMetadata->GetPlayCount());
440 pVideoMetadataInfo->setSeason(pMetadata->GetSeason());
441 pVideoMetadataInfo->setEpisode(pMetadata->GetEpisode());
442 pVideoMetadataInfo->setParentalLevel(pMetadata->GetShowLevel());
443 pVideoMetadataInfo->setVisible(pMetadata->GetBrowse());
444 pVideoMetadataInfo->setWatched(pMetadata->GetWatched());
445 pVideoMetadataInfo->setProcessed(pMetadata->GetProcessed());
447 pMetadata->GetContentType()));
448 pVideoMetadataInfo->setFileName(pMetadata->GetFilename());
449 pVideoMetadataInfo->setHash(pMetadata->GetHash());
450 pVideoMetadataInfo->setHostName(pMetadata->GetHost());
451 pVideoMetadataInfo->setCoverart(pMetadata->GetCoverFile());
452 pVideoMetadataInfo->setFanart(pMetadata->GetFanart());
453 pVideoMetadataInfo->setBanner(pMetadata->GetBanner());
454 pVideoMetadataInfo->setScreenshot(pMetadata->GetScreenshot());
455 pVideoMetadataInfo->setTrailer(pMetadata->GetTrailer());
456 pVideoMetadataInfo->setSerializeArtwork(
true );
460 if (!pMetadata->GetFanart().isEmpty())
463 pVideoMetadataInfo->
Artwork()->AddNewArtworkInfo();
464 pArtInfo->setStorageGroup(
"Fanart");
465 pArtInfo->setType(
"fanart");
466 pArtInfo->setURL(QString(
"/Content/GetImageFile?StorageGroup=%1"
470 QUrl::toPercentEncoding(pMetadata->GetFanart()))));
472 if (!pMetadata->GetCoverFile().isEmpty())
475 pVideoMetadataInfo->
Artwork()->AddNewArtworkInfo();
476 pArtInfo->setStorageGroup(
"Coverart");
477 pArtInfo->setType(
"coverart");
478 pArtInfo->setURL(QString(
"/Content/GetImageFile?StorageGroup=%1"
482 QUrl::toPercentEncoding(pMetadata->GetCoverFile()))));
484 if (!pMetadata->GetBanner().isEmpty())
487 pVideoMetadataInfo->
Artwork()->AddNewArtworkInfo();
488 pArtInfo->setStorageGroup(
"Banners");
489 pArtInfo->setType(
"banner");
490 pArtInfo->setURL(QString(
"/Content/GetImageFile?StorageGroup=%1"
494 QUrl::toPercentEncoding(pMetadata->GetBanner()))));
496 if (!pMetadata->GetScreenshot().isEmpty())
499 pVideoMetadataInfo->
Artwork()->AddNewArtworkInfo();
500 pArtInfo->setStorageGroup(
"Screenshots");
501 pArtInfo->setType(
"screenshot");
502 pArtInfo->setURL(QString(
"/Content/GetImageFile?StorageGroup=%1"
506 QUrl::toPercentEncoding(pMetadata->GetScreenshot()))));
520 pVideoMetadataInfo->setId(pMetadata->
ID());
521 pVideoMetadataInfo->setArtist(pMetadata->
Artist());
523 pVideoMetadataInfo->setAlbum(pMetadata->
Album());
524 pVideoMetadataInfo->setTitle(pMetadata->
Title());
525 pVideoMetadataInfo->setTrackNo(pMetadata->
Track());
526 pVideoMetadataInfo->setGenre(pMetadata->
Genre());
527 pVideoMetadataInfo->setYear(pMetadata->
Year());
528 pVideoMetadataInfo->setPlayCount(pMetadata->
PlayCount());
529 pVideoMetadataInfo->setLength(pMetadata->
Length().count());
530 pVideoMetadataInfo->setRating(pMetadata->
Rating());
531 pVideoMetadataInfo->setFileName(pMetadata->
Filename());
532 pVideoMetadataInfo->setHostName(pMetadata->
Hostname());
533 pVideoMetadataInfo->setLastPlayed(pMetadata->
LastPlay());
534 pVideoMetadataInfo->setCompilation(pMetadata->
Compilation());
549 input->setInputName(inputInfo.
m_name);
566 if (!pCastMemberList || !pInfo)
573 table =
"recordedcredits";
577 query.
prepare(QString(
"SELECT role, people.name, roles.name FROM %1"
579 " LEFT JOIN people ON"
580 " credits.person = people.person"
581 " LEFT JOIN roles ON"
582 " credits.roleid = roles.roleid"
583 " WHERE credits.chanid = :CHANID"
584 " AND credits.starttime = :STARTTIME"
585 " ORDER BY role, priority;").arg(table));
590 if (query.
exec() && query.
size() > 0)
592 QMap<QString, QString> translations;
593 translations[
"ACTOR"] = QObject::tr(
"Actors");
594 translations[
"DIRECTOR"] = QObject::tr(
"Director");
595 translations[
"PRODUCER"] = QObject::tr(
"Producer");
596 translations[
"EXECUTIVE_PRODUCER"] = QObject::tr(
"Executive Producer");
597 translations[
"WRITER"] = QObject::tr(
"Writer");
598 translations[
"GUEST_STAR"] = QObject::tr(
"Guest Star");
599 translations[
"HOST"] = QObject::tr(
"Host");
600 translations[
"ADAPTER"] = QObject::tr(
"Adapter");
601 translations[
"PRESENTER"] = QObject::tr(
"Presenter");
602 translations[
"COMMENTATOR"] = QObject::tr(
"Commentator");
603 translations[
"GUEST"] = QObject::tr(
"Guest");
609 QString role = query.
value(0).toString();
610 pCastMember->setRole(role);
611 pCastMember->setTranslatedRole(translations.value(role.toUpper()));
627 pCastMember->setName(QString::fromUtf8(query.
value(1)
628 .toByteArray().constData()));
629 pCastMember->setCharacterName(QString::fromUtf8(query.
value(2)
630 .toByteArray().constData()));
645 frm_dir_map_t::const_iterator it;
651 for (it = markMap.cbegin(); it != markMap.cend(); ++it)
657 pCutting->setMark(*it);
658 pCutting->setOffset(it.key());
660 else if (marktype == 1)
666 pCutting->setMark(*it);
667 pCutting->setOffset(offset);
670 else if (marktype == 2)
676 pCutting->setMark(*it);
677 pCutting->setOffset(offset);
691 frm_dir_map_t::const_iterator it;
697 for (it = markMap.cbegin(); it != markMap.cend(); ++it)
703 pCutting->setMark(*it);
704 pCutting->setOffset(it.key());
706 else if (marktype == 1)
712 pCutting->setMark(*it);
713 pCutting->setOffset(offset);
716 else if (marktype == 2)
722 pCutting->setMark(*it);
723 pCutting->setOffset(offset);
737 frm_pos_map_t::const_iterator it;
743 for (it = markMap.cbegin(); it != markMap.cend(); ++it)
746 pCutting->setMark(it.key());
747 pCutting->setOffset(it.value());
757 query.
prepare(
"INSERT INTO recgroups SET recgroup = :NAME, "
758 "displayname = :DISPLAYNAME");
760 query.
bindValue(
":DISPLAYNAME", groupName);
766 LOG(VB_GENERAL, LOG_ERR, QString(
"Could not create recording group (%1). "
767 "Does it already exist?").arg(groupName));
777 QJsonArray members = cast[
"CastMembers"].toArray();
778 for (
const auto & m : std::as_const(members))
780 QJsonObject actor = m.toObject();
781 QString name = actor.value(
"Name").toString(
"");
782 QString character = actor.value(
"CharacterName").toString(
"");
783 QString role = actor.value(
"Role").toString(
"");
785 credits->emplace_back(role, name, priority, character);