Go to the documentation of this file.
9 #include <QApplication>
57 #define LOC_MML QString("Manual Metadata Lookup: ")
63 bool IsValidDialogType(
int num)
66 if (num == i)
return true;
70 class ParentalLevelNotifyContainer :
public QObject
75 void SigLevelChanged();
78 explicit ParentalLevelNotifyContainer(QObject *lparent =
nullptr) :
81 connect(&m_levelCheck,
83 this, &ParentalLevelNotifyContainer::OnResultReady);
90 m_levelCheck.Check(m_level.GetLevel(), level.
GetLevel());
107 if (lastLevel != m_level)
109 emit SigLevelChanged();
134 bool GetLocalVideoImage(
const QString &video_uid,
const QString &
filename,
135 const QStringList &in_dirs, QString &image,
136 QString title,
int season,
137 const QString &host,
const QString& sgroup,
138 int episode = 0,
bool isScreenshot =
false)
140 QStringList search_dirs(in_dirs);
142 search_dirs += qfi.absolutePath();
143 if (title.contains(
"/"))
144 title.replace(
"/",
"-");
146 const QString base_name = qfi.completeBaseName();
147 QList<QByteArray> image_types = QImageReader::supportedImageFormats();
149 using image_type_list = std::set<QString>;
150 image_type_list image_exts;
154 if (sgroup ==
"Coverart")
156 if (sgroup ==
"Fanart")
158 if (sgroup ==
"Screenshots")
159 suffix =
"screenshot";
160 if (sgroup ==
"Banners")
163 for (
const auto & itype : qAsConst(image_types))
164 image_exts.insert(QString(itype).toLower());
168 QStringList hostFiles;
171 const QString hntm(
"%2.%3");
173 for (
const auto & ext : image_exts)
176 if (episode > 0 || season > 0)
180 sfn += hntm.arg(QString(
"%1 Season %2x%3_%4")
181 .arg(title, QString::number(season),
182 QString::number(episode), suffix),
187 sfn += hntm.arg(QString(
"%1 Season %2_%3")
188 .arg(title, QString::number(season),
196 sfn += hntm.arg(base_name + QString(
"_%1").arg(suffix),
198 sfn += hntm.arg(video_uid + QString(
"_%1").arg(suffix),
202 for (
const auto & str : qAsConst(sfn))
204 if (hostFiles.contains(str))
213 const QString fntm(
"%1/%2.%3");
215 for (
const auto & dir : qAsConst(search_dirs))
217 if (dir.isEmpty())
continue;
219 for (
const auto & ext : image_exts)
222 if (season > 0 || episode > 0)
227 QString(
"%1 Season %2x%3_%4")
228 .arg(title, QString::number(season),
229 QString::number(episode),
236 QString(
"%1 Season %2_%3")
237 .arg(title, QString::number(season),
245 base_name + QString(
"_%1").arg(suffix),
248 video_uid + QString(
"_%1").arg(suffix),
252 for (
const auto &
file : qAsConst(sfn))
254 if (QFile::exists(
file))
266 void PlayVideo(
const QString &
filename,
269 const int WATCHED_WATERMARK = 10000;
277 QElapsedTimer playing_time;
281 playing_time.start();
288 if (item->GetChildID() > 0 && video_list.
byID(item->GetChildID()))
289 item = video_list.
byID(item->GetChildID());
293 while (item && playing_time.hasExpired(WATCHED_WATERMARK));
296 class FanartLoader:
public QObject
301 FanartLoader() =
default;
302 ~FanartLoader()
override
304 m_fanartTimer.stop();
305 m_fanartTimer.disconnect(
this);
312 connect(&m_fanartTimer, &
QTimer::timeout,
this, &FanartLoader::fanartLoad);
316 bool wasActive = m_fanartTimer.isActive();
320 m_fanartTimer.stop();
327 QMutexLocker locker(&m_fanartLock);
329 if (
filename != m_fanart->GetFilename())
332 m_fanartTimer.stop();
338 m_fanartTimer.setSingleShot(
true);
339 m_fanartTimer.start(300ms);
352 void fanartLoad(
void)
354 QMutexLocker locker(&m_fanartLock);
362 QTimer m_fanartTimer;
363 bool m_bConnected {
false};
366 std::unique_ptr<FanartLoader> fanartLoader;
368 struct CopyMetadataDestination
370 virtual void handleText(
const QString &name,
const QString &value) = 0;
371 virtual void handleState(
const QString &name,
const QString &value) = 0;
372 virtual void handleImage(
const QString &name,
376 class ScreenCopyDest :
public CopyMetadataDestination
379 explicit ScreenCopyDest(
MythScreenType *screen) : m_screen(screen) {}
381 void handleText(
const QString &name,
const QString &value)
override
386 void handleState(
const QString &name,
const QString &value)
override
388 handleText(name, value);
391 void handleImage(
const QString &name,
const QString &
filename)
override
397 if (name !=
"fanart")
409 if (fanartLoader ==
nullptr)
410 fanartLoader = std::make_unique<FanartLoader>();
411 fanartLoader->LoadImage(
filename, image);
420 class MythUIButtonListItemCopyDest :
public CopyMetadataDestination
426 void handleText(
const QString &name,
const QString &value)
override
428 m_item->SetText(value, name);
431 void handleState(
const QString &name,
const QString &value)
override
433 m_item->DisplayState(value, name);
436 void handleImage(
const QString &name,
const QString &
filename)
override
447 CopyMetadataDestination &
dest)
449 using valuelist = std::map<QString, QString>;
469 tmp[
"coverart"] = coverfile;
471 tmp[
"coverfile"] = coverfile;
473 QString screenshotfile;
486 tmp[
"screenshot"] = screenshotfile;
488 tmp[
"screenshotfile"] = screenshotfile;
503 tmp[
"banner"] = bannerfile;
505 tmp[
"bannerfile"] = bannerfile;
520 tmp[
"fanart"] = fanartfile;
522 tmp[
"fanartfile"] = fanartfile;
526 tmp[
"userratingstate"] =
535 helper(valuelist &values, CopyMetadataDestination &
d) :
536 m_vallist(values), m_dest(
d) {}
538 void handleImage(
const QString &name)
540 m_dest.handleImage(name, m_vallist[name]);
543 void handleState(
const QString &name)
545 m_dest.handleState(name, m_vallist[name]);
548 valuelist &m_vallist;
549 CopyMetadataDestination &m_dest;
554 h.handleImage(
"coverart");
555 h.handleImage(
"screenshot");
556 h.handleImage(
"banner");
557 h.handleImage(
"fanart");
559 h.handleState(
"trailerstate");
560 h.handleState(
"userratingstate");
561 h.handleState(
"watchedstate");
562 h.handleState(
"videolevel");
608 ScreenCopyDest
dest(
this);
630 bool handled =
false;
631 for (
const auto &
action : qAsConst(actions))
678 const parental_level_map::value_type &rhs)
680 return lhs.first.length() >= rhs.first.length();
695 QString ratingstring =
697 .arg(sl.GetLevel()));
698 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
699 QStringList ratings =
700 ratingstring.split(
':', QString::SkipEmptyParts);
702 QStringList ratings =
703 ratingstring.split(
':', Qt::SkipEmptyParts);
705 auto to_pl = [sl](
const auto &
rating)
706 {
return parental_level_map::value_type(
rating, sl.GetLevel()); };
707 std::transform(ratings.cbegin(), ratings.cend(),
749 if (
rating.indexOf(
p->first) != -1)
822 QObject(QCoreApplication::instance())
860 GetNumSetting(
"VideoDefaultParentalLevel",
916 QString windowName =
"videogallery";
917 bool flatlistDefault =
false;
922 windowName =
"browser";
923 flatlistDefault =
true;
926 windowName =
"gallery";
934 windowName =
"manager";
935 flatlistDefault =
true;
1007 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen '" + windowName +
"'");
1093 QString message = tr(
"The video scan found no files, have you "
1094 "configured a video storage group?");
1153 QStringList lastTreeNodePath =
gCoreContext->
GetSetting(
"mythvideo.VideoTreeLastActive",
"").split(
"\n");
1157 if (!lastTreeNodePath.isEmpty())
1160 for (
int i = 0; i < lastTreeNodePath.size(); i++)
1164 if (node !=
nullptr)
1169 if (node->
GetText().compare(lastTreeNodePath.at(i)) == 0)
1175 i < lastTreeNodePath.size()-1)
1181 if (lastTreeNodePath.at(i) == lastTreeNodePath.last())
1182 selectedNode = node;
1192 using MGTreeChildList = QList<MythGenericTree *>;
1195 for (
auto * child : qAsConst(*lchildren))
1197 if (child !=
nullptr)
1203 item->SetData(QVariant::fromValue(child));
1207 if (child == selectedNode)
1232 metadata->
toMap(metadataMap);
1236 MythUIButtonListItemCopyDest
dest(item);
1237 CopyMetadataToUI(metadata,
dest);
1241 if (parent && metadata && ((QString::compare(parent->
GetText(),
1242 metadata->
GetTitle(), Qt::CaseInsensitive) == 0) ||
1243 parent->
GetText().startsWith(tr(
"Season"), Qt::CaseInsensitive)))
1245 else if (metadata && !metadata->
GetSubtitle().isEmpty())
1255 if (!screenshot.isEmpty() && parent && metadata &&
1256 ((QString::compare(parent->
GetText(),
1257 metadata->
GetTitle(), Qt::CaseInsensitive) == 0) ||
1258 parent->
GetText().startsWith(tr(
"Season"), Qt::CaseInsensitive)))
1264 if (coverimage.isEmpty())
1269 int nodeInt = node->
getInt();
1271 if (coverimage.isEmpty() && nodeInt ==
kSubFolder)
1274 item->
SetImage(coverimage,
"coverart");
1276 if (screenshot.isEmpty() && nodeInt ==
kSubFolder)
1279 item->
SetImage(screenshot,
"screenshot");
1281 if (banner.isEmpty() && nodeInt ==
kSubFolder)
1286 if (fanart.isEmpty() && nodeInt ==
kSubFolder)
1354 QString result =
"";
1356 LOG(VB_GENERAL, LOG_DEBUG, QString(
"RemoteImageCheck(%1)").arg(
filename));
1361 if (!dirs.isEmpty())
1363 for (
const auto & dir : qAsConst(dirs))
1366 QString path = sgurl.path();
1368 QString fname = QString(
"%1/%2").arg(path,
filename);
1370 QStringList list( QString(
"QUERY_SG_FILEQUERY") );
1377 if (!ok || list.at(0).startsWith(
"SLAVE UNREACHABLE"))
1379 LOG(VB_GENERAL, LOG_WARNING,
1380 QString(
"Backend : %1 currently Unreachable. Skipping "
1381 "this one.") .arg(host));
1385 if ((!list.isEmpty()) && (list.at(0) == fname))
1388 if (!result.isEmpty())
1391 LOG(VB_GENERAL, LOG_DEBUG,
1392 QString(
"RemoteImageCheck(%1) res :%2: :%3:")
1393 .arg(fname).arg(result).arg(dir));
1413 int nodeInt = node->
getInt();
1428 if (folder_path.startsWith(
"myth://"))
1429 folder_path = folder_path.right(folder_path.length()
1430 - folder_path.lastIndexOf(
"//") - 1);
1432 QString
filename = QString(
"%1/folder").arg(folder_path);
1435 LOG(VB_GENERAL, LOG_DEBUG,
1436 QString(
"GetCoverImage host : %1 prefix : %2 file : %3")
1440 QStringList test_files;
1441 test_files.append(
filename +
".png");
1442 test_files.append(
filename +
".jpg");
1443 test_files.append(
filename +
".jpeg");
1444 test_files.append(
filename +
".gif");
1447 for (
auto imagePath : qAsConst(test_files))
1450 LOG(VB_GENERAL, LOG_DEBUG, QString(
"Cover check :%1 : ").arg(imagePath));
1453 bool foundCover =
false;
1454 if (!host.isEmpty())
1457 imagePath.replace(
"//",
"/");
1458 prefix.replace(
"//",
"/");
1459 imagePath = imagePath.right(imagePath.length() - (
prefix.length() + 1));
1462 if (!tmpCover.isEmpty())
1465 imagePath = tmpCover;
1469 foundCover = QFile::exists(imagePath);
1473 icon_file = imagePath;
1479 if (icon_file.isEmpty())
1481 QStringList imageTypes {
"*.png",
"*.jpg",
"*.jpeg",
"*.gif" };
1484 if (!host.isEmpty())
1490 if (!dirs.isEmpty())
1492 for (
const auto & dir : qAsConst(dirs))
1495 QString path = sgurl.path();
1497 QString subdir = folder_path.right(folder_path.length() - (
prefix.length() + 1));
1499 path = path +
"/" + subdir;
1501 QStringList tmpList;
1506 for (
const auto & pattern : qAsConst(imageTypes))
1508 auto rePattern = QRegularExpression::wildcardToRegularExpression(pattern);
1509 QRegularExpression rx {
1510 rePattern.mid(2,rePattern.size()-4),
1511 QRegularExpression::CaseInsensitiveOption };
1512 QStringList matches = tmpList.filter(rx);
1513 if (!matches.isEmpty())
1516 fList.append(subdir +
"/" + matches.at(0).split(
"::").at(1));
1529 QDir vidDir(folder_path);
1530 vidDir.setNameFilters(imageTypes);
1531 fList = vidDir.entryList();
1535 if (icon_file.isEmpty())
1540 for (
int i = 0; i < list_count; i++)
1548 if (!metadata->
GetHost().isEmpty() &&
1553 if (!test_file.endsWith(
"/") && !test_file.isEmpty() &&
1556 icon_file = test_file;
1563 if (!test_file.isEmpty() &&
1566 icon_file = test_file;
1576 if (!fList.isEmpty())
1580 icon_file = QString(
"%1/%2").arg(folder_path, fList.at(0));
1589 if (!icon_file.isEmpty())
1591 LOG(VB_GENERAL, LOG_DEBUG, QString(
"Found Image : %1 :")
1596 LOG(VB_GENERAL, LOG_DEBUG,
1597 QString(
"Could not find folder cover Image : %1 ")
1603 const VideoMetadata *metadata = GetMetadataPtrFromNode(node);
1639 const QString& gpnode,
int levels)
1641 if (!node ||
type.isEmpty())
1649 QList<MythGenericTree *> subDirs;
1650 static constexpr
int maxRecurse { 1 };
1652 for (
int i = 0; i < list_count; i++)
1664 const QString& host = metadata->
GetHost();
1665 const QString& title = metadata->
GetTitle();
1667 if (
type ==
"Coverart" && !host.isEmpty() &&
1673 else if (
type ==
"Coverart")
1676 if (!test_file.endsWith(
"/") && !test_file.isEmpty() &&
1678 (QString::compare(gpnode, title, Qt::CaseInsensitive) == 0)))
1680 icon_file = test_file;
1684 if (
type ==
"Fanart" && !host.isEmpty() &&
1690 else if (
type ==
"Fanart")
1693 if (!test_file.endsWith(
"/") && !test_file.isEmpty() &&
1695 (QString::compare(gpnode, title, Qt::CaseInsensitive) == 0)))
1697 icon_file = test_file;
1701 if (
type ==
"Banners" && !host.isEmpty() &&
1707 else if (
type ==
"Banners")
1710 if (!test_file.endsWith(
"/") && !test_file.isEmpty() &&
1712 (QString::compare(gpnode, title, Qt::CaseInsensitive) == 0)))
1714 icon_file = test_file;
1718 if (
type ==
"Screenshots" && !host.isEmpty() &&
1724 else if (
type ==
"Screenshots")
1727 if (!test_file.endsWith(
"/") && !test_file.isEmpty() &&
1729 (QString::compare(gpnode, title, Qt::CaseInsensitive) == 0)))
1731 icon_file = test_file;
1737 if (icon_file.isEmpty() && !subDirs.isEmpty())
1740 int subDirCount = subDirs.count();
1741 for (
int i = 0; i < subDirCount; i ++)
1743 if (levels < maxRecurse)
1747 if (!test_file.isEmpty())
1749 icon_file = test_file;
1765 const int nodeInt = node->
getInt();
1775 const VideoMetadata *metadata = GetMetadataPtrFromNode(node);
1805 const int nodeInt = node->
getInt();
1811 const VideoMetadata *metadata = GetMetadataPtrFromNode(node);
1816 !metadata->
GetBanner().startsWith(
"/") &&
1840 const int nodeInt = node->
getInt();
1846 const VideoMetadata *metadata = GetMetadataPtrFromNode(node);
1851 !metadata->
GetFanart().startsWith(
"/") &&
1878 QStringList actions;
1881 for (
int i = 0; i < actions.size() && !handled; i++)
1883 QString
action = actions[i];
1893 else if (
action ==
"INCPARENT")
1895 else if (
action ==
"DECPARENT")
1900 else if (
action ==
"FILTER")
1902 else if (
action ==
"MENU")
1907 else if (
action ==
"PLAYALT")
1913 else if (
action ==
"DOWNLOADDATA")
1918 else if (
action ==
"INCSEARCH")
1920 else if (
action ==
"ITEMDETAIL")
1922 else if (
action ==
"DELETE")
1929 else if (
action ==
"ESCAPE")
1947 for (
int i = 0; i < actions.size() && !handled; i++)
1949 QString
action = actions[i];
1950 if (
action ==
"PLAYBACK")
1973 const QString& message = title;
1976 "mythvideobusydialog");
1994 QString msg = tr(
"Fetching details for %1")
1999 desc = tr(
"Season %1, Episode %2")
2019 msg = tr(
"Retrieved details for %1").arg(metadata->
GetTitle());
2023 msg = tr(
"Failed to retrieve details for %1").arg(metadata->
GetTitle());
2028 desc = tr(
"Season %1, Episode %2")
2054 const QString& message = title;
2058 if (okPopup->Create())
2068 LOG(VB_GENERAL, LOG_DEBUG, QString(
"Jumping to: %1").arg(
string));
2071 QList<MythGenericTree*> *children =
nullptr;
2072 QMap<int, QString> idTitle;
2079 for (
auto * child : qAsConst(*children))
2081 QString title = child->GetText();
2082 int id = child->getPosition();
2083 idTitle.insert(
id, title);
2108 QStringList childList;
2109 QList<MythGenericTree*> *children =
nullptr;
2115 for (
auto * child : qAsConst(*children))
2117 childList << child->GetText();
2123 tr(
"Video Search"), childList,
false,
"");
2125 if (searchDialog->Create())
2133 delete searchDialog;
2142 bool handled =
false;
2213 metadata->
toMap(metadataMap);
2223 ScreenCopyDest
dest(
this);
2224 CopyMetadataToUI(metadata,
dest);
2269 label = tr(
"Video Options\n%1\n%2").arg(metadata->
GetTitle(),
2274 label = tr(
"Video Options\n%1").arg(metadata->
GetTitle());
2278 label = tr(
"Video Options");
2331 label = tr(
"Playback Options\n%1").arg(metadata->
GetTitle());
2349 QString trailerFile = metadata->
GetTrailer();
2350 if (QFile::exists(trailerFile) ||
2351 (!metadata->
GetHost().isEmpty() && !trailerFile.isEmpty()))
2365 QString label = tr(
"Video Display Menu");
2396 if (which ==
"display")
2407 QString label = tr(
"Change View");
2443 QString label = tr(
"Video Settings");
2502 QString label = tr(
"Browse By");
2545 QString label = tr(
"Video Info");
2557 if (!metadata->
GetCast().empty())
2572 QString label = tr(
"Manage Video Details");
2657 int nodeInt = node->
getInt();
2825 if (mythvideo->Create())
2831 screenStack->
PopScreen(
this,
false,
false);
2836 ShowOkPopup(tr(
"An error occurred when switching views."));
2850 if (plotdialog->Create())
2888 if (castdialog->Create())
2907 if (browser.isEmpty())
2909 ShowOkPopup(tr(
"No browser command set! MythVideo needs MythBrowser "
2910 "installed to display the homepage."));
2914 if (browser.toLower() ==
"internal")
2920 QString cmd = browser;
2921 cmd.replace(
"%ZOOM%", zoom);
2922 cmd.replace(
"%URL%", url);
2923 cmd.replace(
'\'',
"%27");
2924 cmd.replace(
"&",
"\\&");
2925 cmd.replace(
";",
"\\;");
2961 const int WATCHED_WATERMARK = 10000;
2964 QElapsedTimer playing_time;
2970 if (node && !(node->
getInt() >= 0))
2977 bool video_started =
false;
2979 while (i < list_count &&
2980 (!video_started || playing_time.hasExpired(WATCHED_WATERMARK)))
2988 playing_time.start();
2989 video_started =
true;
3003 explicit SimpleCollect(QStringList &fileList) : m_fileList(fileList) {}
3006 const QString &fqDirName)
override
3013 void handleFile(
const QString &fileName,
const QString &fqFileName,
3014 const QString &extension,
const QString &host)
override
3019 m_fileList.push_back(fqFileName);
3023 QStringList &m_fileList;
3026 QStringList GetTrailersInDirectory(
const QString &startDir)
3032 SimpleCollect sc(ret);
3046 if (!metadata)
return;
3049 GetSetting(
"mythvideo.TrailersDir"));
3054 const int trailersToPlay =
3058 while (!
trailers.isEmpty() && i < trailersToPlay)
3063 LOG(VB_GENERAL, LOG_DEBUG,
3064 QString(
"Random trailer to play will be: %1").arg(trailer));
3079 if (!metadata)
return;
3125 if (filterdialog->Create())
3144 int nodeInt = node->
getInt();
3147 metadata = GetMetadataPtrFromNode(node);
3165 if (list.count() > 1)
3167 auto *metadata = list[0]->GetData().value<
VideoMetadata *>();
3173 Qt::QueuedConnection);
3175 if (resultsdialog->Create())
3209 metadata->SetProcessed(
true);
3210 metadata->UpdateDatabase();
3212 LOG(VB_GENERAL, LOG_INFO,
3213 QString(
"No results found for %1 %2 %3").arg(lookup->
GetTitle())
3221 QString
id = dce->
GetId();
3223 if (
id ==
"scanprompt")
3225 int result = dce->GetResult();
3257 if (item !=
nullptr)
3278 QMap<int, int> idPosition;
3282 for (
auto * child : qAsConst(*children))
3284 int nodeInt = child->getInt();
3288 GetMetadataPtrFromNode(child);
3291 int position = child->getPosition();
3292 int id = listmeta->
GetID();
3293 idPosition.insert(
id, position);
3327 using MGTreeChildList = QList<MythGenericTree *>;
3330 LOG(VB_GENERAL, LOG_DEBUG,
3331 QString(
"Fetching details in %1").arg(node->
GetText()));
3333 for (
auto * child : qAsConst(*lchildren))
3375 QString(
"Selected Item: Type: %1%2 : Subtype: %3%4%5 : InetRef: %6")
3390 QString(
"Selected Item has no InetRef Number!"));
3403 curshowlevel += amount;
3423 "mythvideoeditmetadata", metadata,
3428 if (md_editor->Create())
3439 QString message = tr(
"Are you sure you want to permanently delete:\n%1")
3444 if (confirmdialog->Create())
3476 QString message = tr(
"Failed to delete file");
3481 if (confirmdialog->Create())
3504 QStringList cover_dirs;
3510 QString title = metadata->
GetTitle();
3512 QString host = metadata->
GetHost();
3518 if (GetLocalVideoImage(inetref,
filename,
3519 cover_dirs, cover_file, title,
3520 season, host,
"Coverart", episode))
3527 QStringList fanart_dirs;
3530 QString fanart_file;
3534 if (GetLocalVideoImage(inetref,
filename,
3535 fanart_dirs, fanart_file, title,
3536 season, host,
"Fanart", episode))
3543 QStringList banner_dirs;
3546 QString banner_file;
3550 if (GetLocalVideoImage(inetref,
filename,
3551 banner_dirs, banner_file, title,
3552 season, host,
"Banners", episode))
3559 QStringList screenshot_dirs;
3562 QString screenshot_file;
3566 if (GetLocalVideoImage(inetref,
filename,
3567 screenshot_dirs, screenshot_file, title,
3568 season, host,
"Screenshots", episode,
3588 metadata->SetTitle(lookup->
GetTitle());
3591 if (metadata->GetTagline().isEmpty())
3593 if (metadata->GetYear() == 1895 || metadata->GetYear() == 0)
3594 metadata->SetYear(lookup->
GetYear());
3595 if (metadata->GetReleaseDate() == QDate())
3598 metadata->GetDirector().isEmpty())
3601 if (director.count() > 0)
3602 metadata->SetDirector(director.takeFirst().name);
3604 if (metadata->GetStudio().isEmpty())
3607 if (studios.count() > 0)
3608 metadata->SetStudio(studios.takeFirst());
3611 metadata->GetPlot().isEmpty())
3613 if (metadata->GetUserRating() == 0)
3617 if (metadata->GetLength() == 0min)
3619 if (metadata->GetSeason() == 0)
3620 metadata->SetSeason(lookup->
GetSeason());
3621 if (metadata->GetEpisode() == 0)
3623 if (metadata->GetHomepage().isEmpty())
3634 for (
const auto & name : qAsConst(gueststars))
3635 actors.append(name);
3640 for (
const auto & person : qAsConst(actors))
3641 cl.append(person.name);
3643 for (
const auto & name : qAsConst(cl))
3645 QString cn = name.trimmed();
3649 value_type(-1, cn));
3653 metadata->SetCast(cast);
3659 for (
const auto & name : qAsConst(genres))
3661 QString genre_name = name.trimmed();
3662 if (!genre_name.isEmpty())
3664 video_genres.push_back(
3665 VideoMetadata::genre_list::value_type(-1, genre_name));
3669 metadata->SetGenres(video_genres);
3675 for (
const auto & name : qAsConst(countries))
3677 QString country_name = name.trimmed();
3678 if (!country_name.isEmpty())
3680 video_countries.push_back(
3681 VideoMetadata::country_list::value_type(-1,
3686 metadata->SetCountries(video_countries);
3687 metadata->SetProcessed(
true);
3689 metadata->UpdateDatabase();
3692 if (item !=
nullptr)
3708 QString message = tr(
"There are no videos in the database, would you like "
3709 "to scan your video directories now?");
3711 dialog->SetReturnEvent(
this,
"scanprompt");
3712 if (dialog->Create())
3718 #include "videodlg.moc"
simple_ref_ptr< class VideoList > VideoListPtr
static QString GetBanner(MythGenericTree *node)
Find the Banner for a given node.
MythScreenStack * GetMainStack()
QString generate_file_url(const QString &storage_group, const QString &host, const QString &path)
Provide a dialog to quickly find an entry in a list.
class VideoDialogPrivate * m_d
MythMenu * CreateMetadataBrowseMenu()
Create a MythMenu for MythVideo Metadata Browse modes.
void OnVideoImageSetDone(VideoMetadata *metadata)
std::list< std::pair< QString, ParentalLevel::Level > > parental_level_map
void playVideoAlt()
Play the selected item in an alternate player.
QString WatchedToState(bool watched)
void AutomaticParentalAdjustment(VideoMetadata *metadata)
Image widget, displays a single image or multiple images in sequence.
MythMenu * CreateSettingsMenu()
Create a MythMenu for MythVideo Settings.
void StartVideoImageSet(VideoMetadata *metadata)
void getExtensionIgnoreList(ext_ignore_list &ext_ignore) const
void playTrailer()
Play the trailer associated with the selected item.
QString GetText(const QString &name="") const
void ShowMetadataSettings()
Pop up a MythUI Menu for MythVideo Metadata Settings.
VideoDialog::DialogType m_type
bool SendReceiveStringList(QStringList &strlist, bool quickTimeout=false, bool block=true)
Send a message to the backend and wait for a response.
MythDialogBox * m_menuPopup
void doScan(const QStringList &dirs)
void SwitchManager()
Switch to Video Manager View.
int Register(void *from)
An application can register in which case it will be assigned a reusable screen, which can be modifie...
uint visibleChildCount() const
bool Load(bool allowLoadInBackground=true, bool forceStat=false)
Load the image(s), wraps ImageLoader::LoadImage()
void refreshData()
Reloads the tree without invalidating the data.
bool Create(void) override
static void DelayVideoListDestruction(const VideoListPtr &videoList)
void SwitchVideoGenreGroup()
Switch to Genre browse mode.
~VideoListDeathDelay() override
QVariant GetData(void) const
void dismissFetchDialog(VideoMetadata *metadata, bool ok)
void SwitchVideoInsertDateGroup()
Switch to Insert Date browse mode.
void handleSelect(MythUIButtonListItem *item)
Handle SELECT action for a given MythUIButtonListItem.
MythGenericTree * getChildByName(const QString &a_name) const
void CheckedSet(MythUIStateType *uiItem, const QString &value)
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
void Closed(QString, int)
MythMenu * CreateManageMenu()
Create a MythMenu for metadata management.
Screen in which all other widgets are contained and rendered.
void Load() override
Called after the screen is created by MythScreenStack.
static VideoListDeathDelayPtr & GetSavedVideoList()
void Reset(void) override
Reset the image back to the default defined in the theme.
VideoListDeathDelay(const VideoDialog::VideoListPtr &toSave)
uint myth_system(const QString &command, uint flags, std::chrono::seconds timeout)
MythMenu * CreateViewMenu()
Create a MythMenu for MythVideo Views.
void SwitchVideoUserRatingGroup()
Switch to User Rating browse mode.
static void ClearGroupToUseCache(void)
MythUIStateType * m_studioState
VideoDialog::BrowseType m_browse
bool HandleMedia(const QString &Handler, const QString &Mrl, const QString &Plot="", const QString &Title="", const QString &Subtitle="", const QString &Director="", int Season=0, int Episode=0, const QString &Inetref="", std::chrono::minutes LenMins=2h, const QString &Year="1895", const QString &Id="", bool UseBookmarks=false)
void shiftParental(int amount)
Shift the parental level for the library by an integer amount.
MythUIText * m_positionText
MythUIBusyDialog * m_busyPopup
MythUIButtonTree * m_videoButtonTree
static VideoDialog::VideoListDeathDelayPtr m_savedPtr
MythUIType * GetFocusWidget(void) const
MythUIStateType * m_trailerState
QHash< QString, QString > InfoMap
MythGenericTree * getChildAt(uint reference) const
QString GetFirstImage(MythGenericTree *node, const QString &type, const QString &gpnode=QString(), int levels=0)
Find the first image of "type" within a folder structure.
virtual MythUIButtonListItem * GetItemByMetadata(VideoMetadata *metadata)
void searchComplete(const QString &string)
After using incremental search, move to the selected item.
MythGenericTree * getSelectedChild(bool onlyVisible=false) const
VideoDialog::VideoListPtr GetSaved()
void SwitchVideoTVMovieGroup()
Switch to Television/Movie browse mode.
static QString GetScreenshot(MythGenericTree *node)
Find the Screenshot for a given node.
void playVideoWithTrailers()
Play the selected item w/ a User selectable # of trailers.
static QString GetFanart(MythGenericTree *node)
Find the Fanart for a given node.
void scanFinished(bool dbChanged)
void SwitchBrowse()
Switch to Browser View.
void OnVideoSearchListSelection(RefCountHandler< MetadataLookup > lookup)
bool TranslateKeyPress(const QString &Context, QKeyEvent *Event, QStringList &Actions, bool AllowJumps=true)
Get a list of actions for a keypress in the given context.
MetadataFactory * m_metadataFactory
QStringList GetVideoDirs()
bool goBack()
Move one level up in the tree.
MythScreenStack * m_popupStack
static QString RemoteImageCheck(const QString &host, const QString &filename)
Search for a given (image) filename in the Video SG.
ParentalLevelNotifyContainer m_parentalLevel
QPointer< class VideoListDeathDelay > VideoListDeathDelayPtr
bool SetFocusWidget(MythUIType *widget=nullptr)
QStringList getRouteByString(void)
std::vector< std::pair< QString, bool > > ext_ignore_list
Basic menu dialog, message and a list of options.
void SwitchVideoYearGroup()
Switch to Year browse mode.
static MythThemedMenu * menu
void SwitchTree()
Switch to Tree (List) View.
void ShowCastDialog()
Display the Cast if the selected item.
bool Create(void) override
void SetParent(void *Parent)
Contains the parent address. Required if id is set Id provided must match the parent address as provi...
class VideoListDeathDelayPrivate * m_d
virtual MythUIButtonListItem * GetItemCurrent()
void BuildFocusList(void)
def rating(profile, smoonURL, gate)
MythScreenStack * m_mainStack
VideoDialog::VideoListPtr m_savedList
void searchStart()
Create an incremental search dialog for the current tree level.
int childCount(void) const
const QString VIDEO_PLOT_DEFAULT
virtual void SetTextFromMap(const InfoMap &infoMap)
void SwitchVideoDirectorGroup()
Switch to Director browse mode.
void SetCurrentNode(MythGenericTree *node)
Switch to a given MythGenericTree node.
bool IsDefaultBanner(const QString &banner)
MythGenericTree * getVisibleChildAt(uint reference) const
void SwitchVideoFolderGroup()
Switch to Folder (filesystem) browse mode.
void SwitchLayout(DialogType type, BrowseType browse)
Handle a layout or browse mode switch.
void SwitchVideoCastGroup()
Switch to Cast browse mode.
void setParentalLevel(ParentalLevel::Level level)
Set the parental level for the library.
void handleDynamicDirSelect(MythGenericTree *node)
Request the latest metadata for a folder.
MythMenu * CreateInfoMenu()
Create a MythMenu for Info pertaining to the selected item.
MythUIStateType * m_parentalLevelState
void createOkDialog(const QString &title)
Create a MythUI "OK" Dialog.
void ShowExtensionSettings()
Pop up a MythUI Menu for MythVideo filte Type Settings.
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
void SigResultReady(bool passwordValid, ParentalLevel::Level newLevel)
bool IsDefaultFanart(const QString &fanart)
int GetNumSetting(const QString &key, int defaultval=0)
MythScreenStack * GetScreenStack() const
MythMenu * CreatePlayMenu()
Create a "Play Menu" for MythVideo. Appears if multiple play options exist.
QList< MythGenericTree * > * getAllChildren() const
const QString VIDEO_FANART_DEFAULT
MythUIStateType * m_watchedState
static bool Assign(ContainerType *container, UIType *&item, const QString &name, bool *err=nullptr)
virtual void loadData()
load the data used to build the ButtonTree/List for MythVideo.
VideoListDeathDelayPrivate(const VideoDialog::VideoListPtr &toSave)
void SwitchVideoCategoryGroup()
Switch to Category browse mode.
QString ParentalLevelToState(const ParentalLevel &level)
bool IsDefaultCoverFile(const QString &coverfile)
bool IsDefaultScreenshot(const QString &screenshot)
void customEvent(QEvent *levent) override
bool GetBoolSetting(const QString &key, bool defaultval=false)
void popupClosed(const QString &which, int result)
static FileAssociations & getFileAssociation()
void UpdatePosition()
Called after the screen is created by MythScreenStack.
void createBusyDialog(const QString &title)
Create a busy dialog, used during metadata search, etc.
static VideoPlayerCommand AltPlayerFor(const VideoMetadata *item)
VideoDialog(MythScreenStack *lparent, const QString &lname, const VideoListPtr &video_list, DialogType type, BrowseType browse)
void handleDirSelect(MythGenericTree *node)
Descend into a selected folder.
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
void deleteNode(MythGenericTree *child)
static bool rating_to_pl_greater(const parental_level_map::value_type &lhs, const parental_level_map::value_type &rhs)
MythGenericTree * m_currentNode
void reloadData()
Reloads the tree after having invalidated the data.
Dialog asking for user confirmation. Ok and optional Cancel button.
bool ScanVideoDirectory(const QString &start_path, DirectoryHandler *handler, const FileAssociations::ext_ignore_list &ext_disposition, bool list_unknown_extensions)
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
void ShowPlayerSettings()
Pop up a MythUI Menu for MythVideo Player Settings.
MythGenericTree * getParent(void) const
QStringList GetVideoDirsByHost(const QString &host)
const QString VIDEO_RATING_DEFAULT
void ChangeFilter()
Change the filtering of the library.
void OnVideoSearchDone(MetadataLookup *lookup)
Event dispatched from MythUI modal dialogs to a listening class containing a result of some form.
static void ClearBackendServerPortCache()
void UpdateText(MythUIButtonListItem *item)
Update the visible text values for a given ButtonListItem.
static VideoMetadata * GetMetadata(MythUIButtonListItem *item)
Retrieve the Database Metadata for a given MythUIButtonListItem.
void OnParentalChange(int amount)
virtual void SetVisible(bool visible)
VideoDialog::VideoListPtr GetSaved()
MythNotificationCenter * GetNotificationCenter(void)
void UnRegister(void *from, int id, bool closeimemdiately=false)
Unregister the client.
void createFetchDialog(VideoMetadata *metadata)
Create a fetch notification, used during metadata search.
virtual void PopScreen(MythScreenType *screen=nullptr, bool allowFade=true, bool deleteScreen=true)
MythUIImage * m_coverImage
parental_level_map m_ratingToPl
MythMainWindow * GetMythMainWindow(void)
void SetId(int Id)
Contains the application registration id.
void fetchVideos()
Build the buttonlist/tree.
MythGenericTree * m_rootNode
void SwitchGallery()
Switch to Gallery View.
MythScreenStack * GetStack(const QString &Stackname)
static constexpr std::chrono::milliseconds kDelayTimeMS
void playVideo()
Play the selected item.
void playFolder()
Play all the items in the selected folder.
static VideoPlayerCommand PlayerFor(const VideoMetadata *item)
MythUIImage * m_screenshot
virtual DirectoryHandler * newDir(const QString &dir_name, const QString &fq_dir_name)=0
QString TrailerToState(const QString &trailerFile)
const QString VIDEO_BANNER_DEFAULT
static const iso6937table * d
void SwitchVideoStudioGroup()
Switch to Studio browse mode.
void OnRemoveVideo(bool dodelete)
@ kMSDontDisableDrawing
avoid disabling UI drawing
void SaveSetting(const QString &key, int newValue)
void ToggleFlatView()
Toggle Flat View.
void AllowInput(bool Allow)
void SetFilename(const QString &filename)
Must be followed by a call to Load() to load the image.
void UpdateItem(MythUIButtonListItem *item)
Update the visible representation of a MythUIButtonListItem.
VideoDialogPrivate(const VideoListPtr &videoList, VideoDialog::DialogType type, VideoDialog::BrowseType browse)
MythUIText * m_novideoText
QMap< QString, int > m_notifications
void DisplayMenu()
Pop up a MythUI Menu for MythVideo Global Functions. Bound to MENU.
virtual int IncrRef(void)
Increments reference count.
void VideoMenu()
Pop up a MythUI "Playback Menu" for MythVideo. Bound to INFO.
void ToggleBrowseMode()
Toggle the browseable status for the selected item.
MythUIButtonList * m_videoButtonList
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
void becomeSelectedChild(void)
MythConfirmationDialog * ShowOkPopup(const QString &message, bool showCancel)
Non-blocking version of MythPopupBox::showOkPopup()
void ViewPlot()
Display a MythUI Popup with the selected item's plot.
static QString GetCoverImage(MythGenericTree *node)
A "hunt" for cover art to apply for a folder item.
uint32_t MythRandom()
generate 32 random bits
QString m_lastTreeNodePath
virtual void handleFile(const QString &file_name, const QString &fq_file_name, const QString &extension, const QString &host)=0
bool keyPressEvent(QKeyEvent *levent) override
Handle keypresses and keybindings.
bool DoItemDetailShow()
Display the Item Detail Popup.
const QString VIDEO_SCREENSHOT_DEFAULT
QString GetSetting(const QString &key, const QString &defaultval="")
static const QString sLocation
bool Queue(const MythNotification ¬ification)
Queue a notification Queue() is thread-safe and can be called from anywhere.
bool RemoteGetFileList(const QString &host, const QString &path, QStringList *list, QString sgroup, bool fileNamesOnly)
const QString VIDEO_DIRECTOR_UNKNOWN