10#include <QApplication>
60#define LOC_MML QString("Manual Metadata Lookup: ")
69 if (num == i)
return true;
84 connect(&m_levelCheck,
86 this, &ParentalLevelNotifyContainer::OnResultReady);
93 m_levelCheck.Check(m_level.GetLevel(), level.
GetLevel());
110 if (lastLevel != m_level)
112 emit SigLevelChanged();
138 const QStringList &in_dirs, QString &image,
139 QString title,
int season,
140 const QString &host,
const QString& sgroup,
141 int episode = 0,
bool isScreenshot =
false)
143 QStringList search_dirs(in_dirs);
145 search_dirs += qfi.absolutePath();
146 if (title.contains(
"/"))
147 title.replace(
"/",
"-");
149 const QString base_name = qfi.completeBaseName();
150 QList<QByteArray> image_types = QImageReader::supportedImageFormats();
152 using image_type_list = std::set<QString>;
153 image_type_list image_exts;
157 if (sgroup ==
"Coverart")
159 if (sgroup ==
"Fanart")
161 if (sgroup ==
"Screenshots")
162 suffix =
"screenshot";
163 if (sgroup ==
"Banners")
166 for (
const auto & itype : std::as_const(image_types))
167 image_exts.insert(QString(itype).toLower());
171 QStringList hostFiles;
174 const QString hntm(
"%2.%3");
176 for (
const auto & ext : image_exts)
179 if (episode > 0 || season > 0)
183 sfn += hntm.arg(QString(
"%1 Season %2x%3_%4")
184 .arg(title, QString::number(season),
185 QString::number(episode), suffix),
190 sfn += hntm.arg(QString(
"%1 Season %2_%3")
191 .arg(title, QString::number(season),
199 sfn += hntm.arg(base_name + QString(
"_%1").arg(suffix),
201 sfn += hntm.arg(video_uid + QString(
"_%1").arg(suffix),
205 for (
const auto & str : std::as_const(sfn))
207 if (hostFiles.contains(str))
216 const QString fntm(
"%1/%2.%3");
218 for (
const auto & dir : std::as_const(search_dirs))
220 if (dir.isEmpty())
continue;
222 for (
const auto & ext : image_exts)
225 if (season > 0 || episode > 0)
230 QString(
"%1 Season %2x%3_%4")
231 .arg(title, QString::number(season),
232 QString::number(episode),
239 QString(
"%1 Season %2_%3")
240 .arg(title, QString::number(season),
248 base_name + QString(
"_%1").arg(suffix),
251 video_uid + QString(
"_%1").arg(suffix),
255 for (
const auto &
file : std::as_const(sfn))
272 const int WATCHED_WATERMARK = 10000;
280 QElapsedTimer playing_time;
284 playing_time.start();
291 if (!playing_time.hasExpired(WATCHED_WATERMARK))
294 item = (item->GetChildID() > 0)
295 ? video_list.
byID(item->GetChildID())
308 m_fanartTimer.stop();
309 m_fanartTimer.disconnect(
this);
316 connect(&m_fanartTimer, &
QTimer::timeout,
this, &FanartLoader::fanartLoad);
320 bool wasActive = m_fanartTimer.isActive();
324 m_fanartTimer.stop();
331 QMutexLocker locker(&m_fanartLock);
333 if (
filename != m_fanart->GetFilename())
336 m_fanartTimer.stop();
342 m_fanartTimer.setSingleShot(
true);
343 m_fanartTimer.start(300ms);
360 QMutexLocker locker(&m_fanartLock);
369 bool m_bConnected {
false};
376 virtual void handleText(
const QString &name,
const QString &value) = 0;
377 virtual void handleState(
const QString &name,
const QString &value) = 0;
387 void handleText(
const QString &name,
const QString &value)
override
392 void handleState(
const QString &name,
const QString &value)
override
394 handleText(name, value);
403 if (name !=
"fanart")
434 void handleText(
const QString &name,
const QString &value)
override
436 m_item->SetText(value, name);
439 void handleState(
const QString &name,
const QString &value)
override
441 m_item->DisplayState(value, name);
445 [[maybe_unused]]
const QString &
filename)
override
456 using valuelist = std::map<QString, QString>;
476 tmp[
"coverart"] = coverfile;
478 tmp[
"coverfile"] = coverfile;
480 QString screenshotfile;
493 tmp[
"screenshot"] = screenshotfile;
495 tmp[
"screenshotfile"] = screenshotfile;
510 tmp[
"banner"] = bannerfile;
512 tmp[
"bannerfile"] = bannerfile;
527 tmp[
"fanart"] = fanartfile;
529 tmp[
"fanartfile"] = fanartfile;
532 tmp[
"studiostate"] = metadata->
GetStudio();
533 tmp[
"userratingstate"] =
543 m_vallist(values), m_dest(
d) {}
545 void handleImage(
const QString &name)
547 m_dest.handleImage(name, m_vallist[name]);
550 void handleState(
const QString &name)
552 m_dest.handleState(name, m_vallist[name]);
555 valuelist &m_vallist;
561 h.handleImage(
"coverart");
562 h.handleImage(
"screenshot");
563 h.handleImage(
"banner");
564 h.handleImage(
"fanart");
566 h.handleState(
"trailerstate");
567 h.handleState(
"userratingstate");
568 h.handleState(
"watchedstate");
569 h.handleState(
"videolevel");
577 if (!metadata || (!item && !screen))
587 item->DisplayState(bookmarkState,
"bookmarkstate");
588 item->SetProgress1(0, showProgress ? 100 : 0, watchedPercent);
592 CheckedSet(screen,
"bookmarkstate", bookmarkState);
593 auto *watchedProgress =
dynamic_cast<MythUIProgressBar *
>(screen->GetChild(
"watchedprogressbar"));
596 watchedProgress->
Set(0, showProgress ? 100 : 0, watchedPercent);
645 ScreenCopyDest
dest(
this);
668 bool handled =
false;
669 for (
const auto &
action : std::as_const(actions))
717 const parental_level_map::value_type &rhs)
719 return lhs.first.length() >= rhs.first.length();
734 QString ratingstring =
736 .arg(sl.GetLevel()));
737 QStringList ratings =
738 ratingstring.split(
':', Qt::SkipEmptyParts);
739 auto to_pl = [sl](
const auto &
rating)
740 {
return parental_level_map::value_type(
rating, sl.GetLevel()); };
741 std::ranges::transform(std::as_const(ratings),
783 if (
rating.indexOf(
p->first) != -1)
858 QObject(QCoreApplication::instance()),
896 GetNumSetting(
"VideoDefaultParentalLevel",
911 if (metadata && metadata->GetFilename() ==
filename)
979 QString windowName =
"videogallery";
980 bool flatlistDefault =
false;
985 windowName =
"browser";
986 flatlistDefault =
true;
989 windowName =
"gallery";
997 windowName =
"manager";
998 flatlistDefault =
true;
1071 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen '" + windowName +
"'");
1162 QString message = tr(
"The video scan found no files, have you "
1163 "configured a video storage group?");
1222 QStringList lastTreeNodePath =
gCoreContext->
GetSetting(
"mythvideo.VideoTreeLastActive",
"").split(
"\n");
1226 if (!lastTreeNodePath.isEmpty())
1229 for (
int i = 0; i < lastTreeNodePath.size(); i++)
1233 if (node !=
nullptr)
1238 if (node->
GetText().compare(lastTreeNodePath.at(i)) == 0)
1244 i < lastTreeNodePath.size()-1)
1250 if (lastTreeNodePath.at(i) == lastTreeNodePath.last())
1251 selectedNode = node;
1261 using MGTreeChildList = QList<MythGenericTree *>;
1264 for (
auto * child : std::as_const(*lchildren))
1266 if (child !=
nullptr)
1272 item->SetData(QVariant::fromValue(child));
1276 if (child == selectedNode)
1301 metadata->
toMap(metadataMap);
1305 MythUIButtonListItemCopyDest
dest(item);
1311 if (parent && metadata && ((QString::compare(parent->
GetText(),
1312 metadata->
GetTitle(), Qt::CaseInsensitive) == 0) ||
1313 parent->
GetText().startsWith(tr(
"Season"), Qt::CaseInsensitive)))
1315 else if (metadata && !metadata->
GetSubtitle().isEmpty())
1325 if (!screenshot.isEmpty() && parent && metadata &&
1326 ((QString::compare(parent->
GetText(),
1327 metadata->
GetTitle(), Qt::CaseInsensitive) == 0) ||
1328 parent->
GetText().startsWith(tr(
"Season"), Qt::CaseInsensitive)))
1334 if (coverimage.isEmpty())
1339 int nodeInt = node->
getInt();
1341 if (coverimage.isEmpty() && nodeInt ==
kSubFolder)
1344 item->
SetImage(coverimage,
"coverart");
1346 if (screenshot.isEmpty() && nodeInt ==
kSubFolder)
1349 item->
SetImage(screenshot,
"screenshot");
1351 if (banner.isEmpty() && nodeInt ==
kSubFolder)
1356 if (fanart.isEmpty() && nodeInt ==
kSubFolder)
1431 QString result =
"";
1433 LOG(VB_GENERAL, LOG_DEBUG, QString(
"RemoteImageCheck(%1)").arg(
filename));
1438 if (!dirs.isEmpty())
1440 for (
const auto & dir : std::as_const(dirs))
1444 QString path = sgurl.path();
1446 QString fname = QString(
"%1/%2").arg(path,
filename);
1448 QStringList list( QString(
"QUERY_SG_FILEQUERY") );
1455 if (!ok || list.at(0).startsWith(
"SLAVE UNREACHABLE"))
1457 LOG(VB_GENERAL, LOG_WARNING,
1458 QString(
"Backend : %1 currently Unreachable. Skipping "
1459 "this one.") .arg(host));
1463 if ((!list.isEmpty()) && (list.at(0) == fname))
1466 if (!result.isEmpty())
1469 LOG(VB_GENERAL, LOG_DEBUG,
1470 QString(
"RemoteImageCheck(%1) res :%2: :%3:")
1471 .arg(fname).arg(result).arg(dir));
1491 int nodeInt = node->
getInt();
1506 if (folder_path.startsWith(
"myth://"))
1507 folder_path = folder_path.right(folder_path.length()
1508 - folder_path.lastIndexOf(
"//") - 1);
1510 QString
filename = QString(
"%1/folder").arg(folder_path);
1513 LOG(VB_GENERAL, LOG_DEBUG,
1514 QString(
"GetCoverImage host : %1 prefix : %2 file : %3")
1518 QStringList test_files;
1519 test_files.append(
filename +
".png");
1520 test_files.append(
filename +
".jpg");
1521 test_files.append(
filename +
".jpeg");
1522 test_files.append(
filename +
".gif");
1525 for (
auto imagePath : std::as_const(test_files))
1528 LOG(VB_GENERAL, LOG_DEBUG, QString(
"Cover check :%1 : ").arg(imagePath));
1531 bool foundCover =
false;
1532 if (!host.isEmpty())
1535 imagePath.replace(
"//",
"/");
1536 prefix.replace(
"//",
"/");
1537 imagePath = imagePath.right(imagePath.length() - (
prefix.length() + 1));
1540 if (!tmpCover.isEmpty())
1543 imagePath = tmpCover;
1553 icon_file = imagePath;
1559 if (icon_file.isEmpty())
1561 QStringList imageTypes {
"*.png",
"*.jpg",
"*.jpeg",
"*.gif" };
1564 if (!host.isEmpty())
1570 if (!dirs.isEmpty())
1572 for (
const auto & dir : std::as_const(dirs))
1576 QString path = sgurl.path();
1578 QString subdir = folder_path.right(folder_path.length() - (
prefix.length() + 1));
1580 path = path +
"/" + subdir;
1582 QStringList tmpList;
1587 for (
const auto & pattern : std::as_const(imageTypes))
1589 auto rePattern = QRegularExpression::wildcardToRegularExpression(pattern);
1590 QRegularExpression rx {
1591 rePattern.mid(2,rePattern.size()-4),
1592 QRegularExpression::CaseInsensitiveOption };
1593 QStringList matches = tmpList.filter(rx);
1594 if (!matches.isEmpty())
1597 fList.append(subdir +
"/" + matches.at(0).split(
"::").at(1));
1610 QDir vidDir(folder_path);
1611 vidDir.setNameFilters(imageTypes);
1612 fList = vidDir.entryList();
1616 if (icon_file.isEmpty())
1621 for (
int i = 0; i < list_count; i++)
1629 if (!metadata->
GetHost().isEmpty() &&
1634 if (!test_file.endsWith(
"/") && !test_file.isEmpty() &&
1637 icon_file = test_file;
1644 if (!test_file.isEmpty() &&
1647 icon_file = test_file;
1657 if (!fList.isEmpty())
1661 icon_file = QString(
"%1/%2").arg(folder_path, fList.at(0));
1670 if (!icon_file.isEmpty())
1672 LOG(VB_GENERAL, LOG_DEBUG, QString(
"Found Image : %1 :")
1677 LOG(VB_GENERAL, LOG_DEBUG,
1678 QString(
"Could not find folder cover Image : %1 ")
1720 const QString& gpnode,
int levels)
1722 if (!node ||
type.isEmpty())
1730 QList<MythGenericTree *> subDirs;
1731 subDirs.reserve(list_count);
1732 static constexpr int maxRecurse { 1 };
1734 for (
int i = 0; i < list_count; i++)
1746 const QString& host = metadata->
GetHost();
1747 const QString& title = metadata->
GetTitle();
1749 if (
type ==
"Coverart" && !host.isEmpty() &&
1755 else if (
type ==
"Coverart")
1760 if (!test_file.endsWith(
"/") && !test_file.isEmpty() &&
1762 (QString::compare(gpnode, title, Qt::CaseInsensitive) == 0)))
1764 icon_file = test_file;
1768 if (
type ==
"Fanart" && !host.isEmpty() &&
1774 else if (
type ==
"Fanart")
1779 if (!test_file.endsWith(
"/") && !test_file.isEmpty() &&
1781 (QString::compare(gpnode, title, Qt::CaseInsensitive) == 0)))
1783 icon_file = test_file;
1787 if (
type ==
"Banners" && !host.isEmpty() &&
1793 else if (
type ==
"Banners")
1798 if (!test_file.endsWith(
"/") && !test_file.isEmpty() &&
1800 (QString::compare(gpnode, title, Qt::CaseInsensitive) == 0)))
1802 icon_file = test_file;
1806 if (
type ==
"Screenshots" && !host.isEmpty() &&
1812 else if (
type ==
"Screenshots")
1817 if (!test_file.endsWith(
"/") && !test_file.isEmpty() &&
1819 (QString::compare(gpnode, title, Qt::CaseInsensitive) == 0)))
1821 icon_file = test_file;
1827 if (icon_file.isEmpty() && !subDirs.isEmpty())
1830 int subDirCount = subDirs.count();
1831 for (
int i = 0; i < subDirCount; i ++)
1833 if (levels < maxRecurse)
1837 if (!test_file.isEmpty())
1839 icon_file = test_file;
1855 const int nodeInt = node->
getInt();
1895 const int nodeInt = node->
getInt();
1906 !metadata->
GetBanner().startsWith(
"/") &&
1930 const int nodeInt = node->
getInt();
1941 !metadata->
GetFanart().startsWith(
"/") &&
1968 QStringList actions;
1971 for (
int i = 0; i < actions.size() && !handled; i++)
1973 const QString&
action = actions[i];
1983 else if (
action ==
"INCPARENT")
1987 else if (
action ==
"DECPARENT")
1996 else if (
action ==
"FILTER")
2000 else if (
action ==
"MENU")
2005 else if (
action ==
"PLAYALT")
2011 else if (
action ==
"DOWNLOADDATA")
2016 else if (
action ==
"INCSEARCH")
2020 else if (
action ==
"ITEMDETAIL")
2024 else if (
action ==
"DELETE")
2033 else if (
action ==
"ESCAPE")
2053 for (
int i = 0; i < actions.size() && !handled; i++)
2055 const QString&
action = actions[i];
2056 if (
action ==
"PLAYBACK")
2079 const QString& message = title;
2082 "mythvideobusydialog");
2100 QString msg = tr(
"Fetching details for %1")
2105 desc = tr(
"Season %1, Episode %2")
2125 msg = tr(
"Retrieved details for %1").arg(metadata->
GetTitle());
2129 msg = tr(
"Failed to retrieve details for %1").arg(metadata->
GetTitle());
2134 desc = tr(
"Season %1, Episode %2")
2160 const QString& message = title;
2164 if (okPopup->Create())
2174 LOG(VB_GENERAL, LOG_DEBUG, QString(
"Jumping to: %1").arg(
string));
2177 QList<MythGenericTree*> *children =
nullptr;
2178 QMap<int, QString> idTitle;
2185 for (
auto * child : std::as_const(*children))
2187 QString title = child->GetText();
2188 int id = child->getPosition();
2189 idTitle.insert(
id, title);
2216 QStringList childList;
2217 QList<MythGenericTree*> *children =
nullptr;
2223 childList.reserve(children->size());
2224 for (
auto * child : std::as_const(*children))
2226 childList << child->GetText();
2232 tr(
"Video Search"), childList,
false,
"");
2234 if (searchDialog->Create())
2243 delete searchDialog;
2253 bool handled =
false;
2340 metadata->
toMap(metadataMap);
2350 ScreenCopyDest
dest(
this);
2405 if (metadata->
GetWatched() != metadataNew->GetWatched())
2407 metadata->
SetWatched(metadataNew->GetWatched());
2425 label = tr(
"Video Options\n%1\n%2").arg(metadata->
GetTitle(),
2430 label = tr(
"Video Options\n%1").arg(metadata->
GetTitle());
2435 label = tr(
"Video Options");
2491 label = tr(
"Playback Options\n%1").arg(metadata->
GetTitle());
2509 QString trailerFile = metadata->
GetTrailer();
2511 (!metadata->
GetHost().isEmpty() && !trailerFile.isEmpty()))
2525 QString label = tr(
"Video Display Menu");
2558 if (which ==
"display")
2569 QString label = tr(
"Change View");
2605 QString label = tr(
"Video Settings");
2664 QString label = tr(
"Browse By");
2707 QString label = tr(
"Video Info");
2719 if (!metadata->
GetCast().empty())
2734 QString label = tr(
"Manage Video Details");
2825 int nodeInt = node->
getInt();
2993 if (mythvideo->Create())
2999 screenStack->
PopScreen(
this,
false,
false);
3004 ShowOkPopup(tr(
"An error occurred when switching views."));
3018 if (plotdialog->Create())
3056 if (castdialog->Create())
3075 if (browser.isEmpty())
3077 ShowOkPopup(tr(
"No browser command set! MythVideo needs MythBrowser "
3078 "installed to display the homepage."));
3082 if (browser.toLower() ==
"internal")
3088 QString cmd = browser;
3089 cmd.replace(
"%ZOOM%", zoom);
3090 cmd.replace(
"%URL%", url);
3091 cmd.replace(
'\'',
"%27");
3092 cmd.replace(
"&",
"\\&");
3093 cmd.replace(
";",
"\\;");
3128 const int WATCHED_WATERMARK = 10000;
3133 if (!node || (node->
getInt() >= 0))
3136 if (list_count <= 0)
3139 for (
int i = 0; i < list_count; i++)
3147 QElapsedTimer playing_time;
3148 playing_time.start();
3150 if (!playing_time.hasExpired(WATCHED_WATERMARK))
3162 [[maybe_unused]]
const QString &fqDirName)
override
3168 const QString &fqFileName,
3169 [[maybe_unused]]
const QString &extension,
3170 [[maybe_unused]]
const QString &host)
override
3172 m_fileList.push_back(fqFileName);
3199 if (!metadata)
return;
3202 GetSetting(
"mythvideo.TrailersDir"));
3207 const int trailersToPlay =
3211 while (!
trailers.isEmpty() && i < trailersToPlay)
3216 LOG(VB_GENERAL, LOG_DEBUG,
3217 QString(
"Random trailer to play will be: %1").arg(trailer));
3232 if (!metadata)
return;
3278 if (filterdialog->Create())
3297 int nodeInt = node->
getInt();
3318 if (list.count() > 1)
3320 auto *metadata = list[0]->GetData().value<
VideoMetadata *>();
3326 Qt::QueuedConnection);
3328 if (resultsdialog->Create())
3362 metadata->SetProcessed(
true);
3363 metadata->UpdateDatabase();
3365 LOG(VB_GENERAL, LOG_INFO,
3366 QString(
"No results found for %1 %2 %3").arg(lookup->
GetTitle())
3374 QString
id = dce->
GetId();
3376 if (
id ==
"scanprompt")
3378 int result = dce->GetResult();
3410 if (item !=
nullptr)
3431 QMap<int, int> idPosition;
3435 for (
auto * child : std::as_const(*children))
3437 int nodeInt = child->getInt();
3444 int position = child->getPosition();
3445 int id = listmeta->
GetID();
3446 idPosition.insert(
id, position);
3480 using MGTreeChildList = QList<MythGenericTree *>;
3483 LOG(VB_GENERAL, LOG_DEBUG,
3484 QString(
"Fetching details in %1").arg(node->
GetText()));
3486 for (
auto * child : std::as_const(*lchildren))
3527 if(!lookup->GetInetref().isEmpty() && lookup->GetInetref() !=
"00000000")
3530 QString(
"Selected Item: Type: %1%2 : Subtype: %3%4%5 : InetRef: %6")
3536 lookup->GetInetref()));
3545 QString(
"Selected Item has no InetRef Number!"));
3558 curshowlevel += amount;
3578 "mythvideoeditmetadata", metadata,
3583 if (md_editor->Create())
3594 QString message = tr(
"Are you sure you want to permanently delete:\n%1")
3599 if (confirmdialog->Create())
3631 QString message = tr(
"Failed to delete file");
3636 if (confirmdialog->Create())
3659 QStringList cover_dirs;
3665 QString title = metadata->
GetTitle();
3667 QString host = metadata->
GetHost();
3674 cover_dirs, cover_file, title,
3675 season, host,
"Coverart", episode))
3682 QStringList fanart_dirs;
3685 QString fanart_file;
3690 fanart_dirs, fanart_file, title,
3691 season, host,
"Fanart", episode))
3698 QStringList banner_dirs;
3701 QString banner_file;
3706 banner_dirs, banner_file, title,
3707 season, host,
"Banners", episode))
3714 QStringList screenshot_dirs;
3717 QString screenshot_file;
3722 screenshot_dirs, screenshot_file, title,
3723 season, host,
"Screenshots", episode,
3743 metadata->SetTitle(lookup->
GetTitle());
3746 if (metadata->GetTagline().isEmpty())
3748 if (metadata->GetYear() == 1895 || metadata->GetYear() == 0)
3749 metadata->SetYear(lookup->
GetYear());
3750 if (metadata->GetReleaseDate() == QDate())
3753 metadata->GetDirector().isEmpty())
3756 if (director.count() > 0)
3757 metadata->SetDirector(director.takeFirst().name);
3759 if (metadata->GetStudio().isEmpty())
3762 if (studios.count() > 0)
3763 metadata->SetStudio(studios.takeFirst());
3766 metadata->GetPlot().isEmpty())
3768 if (metadata->GetUserRating() == 0)
3772 if (metadata->GetLength() == 0min)
3774 if (metadata->GetSeason() == 0)
3775 metadata->SetSeason(lookup->
GetSeason());
3776 if (metadata->GetEpisode() == 0)
3778 if (metadata->GetHomepage().isEmpty())
3789 actors.reserve(gueststars.size());
3790 for (
const auto & name : std::as_const(gueststars))
3791 actors.append(name);
3795 cl.reserve(actors.size());
3796 for (
const auto & person : std::as_const(actors))
3797 cl.append(person.name);
3799 cast.reserve(cl.size());
3800 for (
const auto & name : std::as_const(cl))
3802 QString cn = name.trimmed();
3805 cast.emplace_back(-1, cn);
3809 metadata->SetCast(cast);
3815 for (
const auto & name : std::as_const(genres))
3817 QString genre_name = name.trimmed();
3818 if (!genre_name.isEmpty())
3820 video_genres.emplace_back(-1, genre_name);
3824 metadata->SetGenres(video_genres);
3830 for (
const auto & name : std::as_const(countries))
3832 QString country_name = name.trimmed();
3833 if (!country_name.isEmpty())
3835 video_countries.emplace_back(-1, country_name);
3839 metadata->SetCountries(video_countries);
3840 metadata->SetProcessed(
true);
3842 metadata->UpdateDatabase();
3845 if (item !=
nullptr)
3861 QString message = tr(
"There are no videos in the database, would you like "
3862 "to scan your video directories now?");
3864 dialog->SetReturnEvent(
this,
"scanprompt");
3865 if (dialog->Create())
3871#include "videodlg.moc"
3872#include "moc_videodlg.cpp"
Event dispatched from MythUI modal dialogs to a listening class containing a result of some form.
static const Type kEventType
void getExtensionIgnoreList(ext_ignore_list &ext_ignore) const
std::vector< std::pair< QString, bool > > ext_ignore_list
static FileAssociations & getFileAssociation()
static const Type kEventType
Dialog asking for user confirmation.
void SaveSetting(const QString &key, int newValue)
void TVPlaybackAborted(void)
QString GetSetting(const QString &key, const QString &defaultval="")
void TVPlaybackStopped(void)
bool SendReceiveStringList(QStringList &strlist, bool quickTimeout=false, bool block=true)
Send a message to the backend and wait for a response.
int GetNumSetting(const QString &key, int defaultval=0)
static void ClearBackendServerPortCache()
bool GetBoolSetting(const QString &key, bool defaultval=false)
Basic menu dialog, message and a list of options.
void Closed(QString, int)
bool Create(void) override
MythGenericTree * getVisibleChildAt(uint reference) const
QVariant GetData(void) const
QString GetText(const QString &name="") const
MythGenericTree * getParent(void) const
QStringList getRouteByString(void)
MythGenericTree * getChildAt(uint reference) const
void deleteNode(MythGenericTree *child)
int childCount(void) const
MythGenericTree * getSelectedChild(bool onlyVisible=false) const
uint visibleChildCount() const
void becomeSelectedChild(void)
MythGenericTree * getChildByName(const QString &a_name) const
QList< MythGenericTree * > * getAllChildren() const
MythScreenStack * GetMainStack()
bool TranslateKeyPress(const QString &Context, QKeyEvent *Event, QStringList &Actions, bool AllowJumps=true)
Get a list of actions for a keypress in the given context.
MythScreenStack * GetStack(const QString &Stackname)
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 AllowInput(bool Allow)
void UnRegister(void *from, int id, bool closeimemdiately=false)
Unregister the client.
int Register(void *from)
An application can register in which case it will be assigned a reusable screen, which can be modifie...
bool Queue(const MythNotification ¬ification)
Queue a notification Queue() is thread-safe and can be called from anywhere.
void SetId(int Id)
Contains the application registration id.
void SetParent(void *Parent)
Contains the parent address. Required if id is set Id provided must match the parent address as provi...
virtual void PopScreen(MythScreenType *screen=nullptr, bool allowFade=true, bool deleteScreen=true)
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
Screen in which all other widgets are contained and rendered.
void BuildFocusList(void)
MythUIType * GetFocusWidget(void) const
MythScreenStack * GetScreenStack() const
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
bool SetFocusWidget(MythUIType *widget=nullptr)
bool Create(void) override
virtual void SetTextFromMap(const InfoMap &infoMap)
Image widget, displays a single image or multiple images in sequence.
bool Load(bool allowLoadInBackground=true, bool forceStat=false)
Load the image(s), wraps ImageLoader::LoadImage()
void SetFilename(const QString &filename)
Must be followed by a call to Load() to load the image.
void Reset(void) override
Reset the image back to the default defined in the theme.
void Set(int start, int total, int used)
Provide a dialog to quickly find an entry in a list.
virtual void SetVisible(bool visible)
void SigResultReady(bool passwordValid, ParentalLevel::Level newLevel)
Utility class to query playback state from database.
void Initialize()
Initializes playback state from database.
void Update(const QString &filename)
Updates playback state of video with specified filename.
bool AlwaysShowWatchedProgress() const
Returns cached setting "AlwaysShowWatchedProgress".
bool HasBookmark(const QString &filename) const
Query bookmark of video with the specified filename.
uint GetWatchedPercent(const QString &filename) const
Query watched percent of video with the specified filename.
static bool remoteGetFileList(const QString &host, const QString &path, QStringList *list, QString sgroup, bool fileNamesOnly=false)
static void ClearGroupToUseCache(void)
static QString generate_file_url(const QString &storage_group, const QString &host, const QString &path)
static bool rating_to_pl_greater(const parental_level_map::value_type &lhs, const parental_level_map::value_type &rhs)
VideoDialogPrivate(const VideoListPtr &videoList, VideoDialog::DialogType type, VideoDialog::BrowseType browse)
PlaybackState m_playbackState
parental_level_map m_ratingToPl
static VideoDialog::VideoListDeathDelayPtr m_savedPtr
void AutomaticParentalAdjustment(VideoMetadata *metadata)
std::list< std::pair< QString, ParentalLevel::Level > > parental_level_map
static void DelayVideoListDestruction(const VideoListPtr &videoList)
VideoDialog::DialogType m_type
QString m_lastTreeNodePath
ParentalLevelNotifyContainer m_parentalLevel
VideoDialog::BrowseType m_browse
QMap< QString, int > m_notifications
MythGenericTree * m_currentNode
MythGenericTree * m_rootNode
void SwitchManager()
Switch to Video Manager View.
void OnParentalChange(int amount)
void VideoMenu()
Pop up a MythUI "Playback Menu" for MythVideo.
void playFolder()
Play all the items in the selected folder.
void ShowMetadataSettings()
Pop up a MythUI Menu for MythVideo Metadata Settings.
void popupClosed(const QString &which, int result)
void SwitchVideoUserRatingGroup()
Switch to User Rating browse mode.
void ShowPlayerSettings()
Pop up a MythUI Menu for MythVideo Player Settings.
MythUIStateType * m_trailerState
static VideoMetadata * GetMetadata(MythUIButtonListItem *item)
Retrieve the Database Metadata for a given MythUIButtonListItem.
void OnVideoImageSetDone(VideoMetadata *metadata)
bool goBack()
Move one level up in the tree.
MythUIImage * m_screenshot
void setParentalLevel(ParentalLevel::Level level)
Set the parental level for the library.
void createBusyDialog(const QString &title)
Create a busy dialog, used during metadata search, etc.
void SwitchVideoYearGroup()
Switch to Year browse mode.
void SwitchVideoTVMovieGroup()
Switch to Television/Movie browse mode.
void handleDynamicDirSelect(MythGenericTree *node)
Request the latest metadata for a folder.
void fetchVideos()
Build the buttonlist/tree.
void StartVideoImageSet(VideoMetadata *metadata)
void SetCurrentNode(MythGenericTree *node)
Switch to a given MythGenericTree node.
MythMenu * CreateViewMenu()
Create a MythMenu for MythVideo Views.
void SwitchLayout(DialogType type, BrowseType browse)
Handle a layout or browse mode switch.
void createFetchDialog(VideoMetadata *metadata)
Create a fetch notification, used during metadata search.
QString GetFirstImage(MythGenericTree *node, const QString &type, const QString &gpnode=QString(), int levels=0)
Find the first image of "type" within a folder structure.
void shiftParental(int amount)
Shift the parental level for the library by an integer amount.
static QString GetCoverImage(MythGenericTree *node)
A "hunt" for cover art to apply for a folder item.
void createOkDialog(const QString &title)
Create a MythUI "OK" Dialog.
bool DoItemDetailShow()
Display the Item Detail Popup.
MythUIButtonList * m_videoButtonList
MythUIStateType * m_studioState
MythUIImage * m_coverImage
void SwitchVideoGenreGroup()
Switch to Genre browse mode.
void refreshData()
Reloads the tree without invalidating the data.
void ToggleFlatView()
Toggle Flat View.
virtual void loadData()
load the data used to build the ButtonTree/List for MythVideo.
static QString GetBanner(MythGenericTree *node)
Find the Banner for a given node.
void SwitchVideoCategoryGroup()
Switch to Category browse mode.
MythDialogBox * m_menuPopup
void handleDirSelect(MythGenericTree *node)
Descend into a selected folder.
void DisplayMenu()
Pop up a MythUI Menu for MythVideo Global Functions.
void searchComplete(const QString &string)
After using incremental search, move to the selected item.
void ShowCastDialog()
Display the Cast if the selected item.
void customEvent(QEvent *levent) override
void SwitchVideoStudioGroup()
Switch to Studio browse mode.
MythUIText * m_positionText
MythMenu * CreateMetadataBrowseMenu()
Create a MythMenu for MythVideo Metadata Browse modes.
void SwitchTree()
Switch to Tree (List) View.
static QString GetScreenshot(MythGenericTree *node)
Find the Screenshot for a given node.
MythMenu * CreateSettingsMenu()
Create a MythMenu for MythVideo Settings.
static VideoListDeathDelayPtr & GetSavedVideoList()
QPointer< class VideoListDeathDelay > VideoListDeathDelayPtr
static void UpdateWatchedState(MythUIButtonListItem *item)
Update the watched state for a given ButtonListItem from the database.
void reloadData()
Reloads the tree after having invalidated the data.
void SwitchVideoFolderGroup()
Switch to Folder (filesystem) browse mode.
virtual MythUIButtonListItem * GetItemCurrent()
MythMenu * CreateManageMenu()
Create a MythMenu for metadata management.
static QString GetFanart(MythGenericTree *node)
Find the Fanart for a given node.
void UpdateItem(MythUIButtonListItem *item)
Update the visible representation of a MythUIButtonListItem.
void UpdateVisible(MythUIButtonListItem *item)
Update playback state for for a given visible ButtonListItem.
void playTrailer()
Play the trailer associated with the selected item.
MythUIStateType * m_parentalLevelState
void SwitchVideoCastGroup()
Switch to Cast browse mode.
void playVideoWithTrailers()
Play the selected item w/ a User selectable # of trailers.
void ViewPlot()
Display a MythUI Popup with the selected item's plot.
void OnVideoSearchDone(MetadataLookup *lookup)
void UpdatePosition()
Called after the screen is created by MythScreenStack.
class VideoDialogPrivate * m_d
void OnVideoSearchListSelection(RefCountHandler< MetadataLookup > lookup)
void SwitchGallery()
Switch to Gallery View.
void UpdateText(MythUIButtonListItem *item)
Update the visible text values for a given ButtonListItem.
void ChangeFilter()
Change the filtering of the library.
void handleSelect(MythUIButtonListItem *item)
Handle SELECT action for a given MythUIButtonListItem.
void playbackStateChanged(const QString &filename)
static QString RemoteImageCheck(const QString &host, const QString &filename)
Search for a given (image) filename in the Video SG.
void SwitchBrowse()
Switch to Browser View.
void playVideoAlt()
Play the selected item in an alternate player.
void dismissFetchDialog(VideoMetadata *metadata, bool ok)
simple_ref_ptr< class VideoList > VideoListPtr
void playVideo()
Play the selected item.
void searchStart()
Create an incremental search dialog for the current tree level.
MythMenu * CreatePlayMenu()
Create a "Play Menu" for MythVideo.
void SwitchVideoInsertDateGroup()
Switch to Insert Date browse mode.
MetadataFactory * m_metadataFactory
bool keyPressEvent(QKeyEvent *levent) override
Handle keypresses and keybindings.
void ToggleBrowseMode()
Toggle the browseable status for the selected item.
MythMenu * CreateInfoMenu()
Create a MythMenu for Info pertaining to the selected item.
VideoDialog(MythScreenStack *lparent, const QString &lname, const VideoListPtr &video_list, DialogType type, BrowseType browse)
void OnRemoveVideo(bool dodelete)
MythScreenStack * m_mainStack
MythUIStateType * m_watchedState
MythUIStateType * m_bookmarkState
void Load() override
Called after the screen is created by MythScreenStack.
MythUIBusyDialog * m_busyPopup
virtual MythUIButtonListItem * GetItemByMetadata(VideoMetadata *metadata)
void scanFinished(bool dbChanged)
MythScreenStack * m_popupStack
MythUIButtonTree * m_videoButtonTree
void ShowExtensionSettings()
Pop up a MythUI Menu for MythVideo filte Type Settings.
void SwitchVideoDirectorGroup()
Switch to Director browse mode.
MythUIText * m_novideoText
VideoListDeathDelayPrivate(const VideoDialog::VideoListPtr &toSave)
VideoDialog::VideoListPtr GetSaved()
VideoDialog::VideoListPtr m_savedList
~VideoListDeathDelay() override
VideoDialog::VideoListPtr GetSaved()
static constexpr std::chrono::milliseconds kDelayTimeMS
VideoListDeathDelay(const VideoDialog::VideoListPtr &toSave)
class VideoListDeathDelayPrivate * m_d
bool Delete(int video_id)
bool refreshNode(MythGenericTree *node)
const VideoMetadataListManager & getListCache() const
void setCurrentVideoFilter(const VideoFilterSettings &filter)
void refreshList(bool filebrowser, const ParentalLevel &parental_level, bool flat_list, int group_type)
MythGenericTree * GetTreeRoot()
MythGenericTree * buildVideoList(bool filebrowser, bool flatlist, int group_type, const ParentalLevel &parental_level, bool include_updirs)
static VideoPlayerCommand AltPlayerFor(const VideoMetadata *item)
static VideoPlayerCommand PlayerFor(const VideoMetadata *item)
void doScan(const QStringList &dirs)
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
void LoadImage(const QString &filename, MythUIImage *image)
ParentalLevelChangeChecker m_levelCheck
ParentalLevelNotifyContainer(QObject *lparent=nullptr)
const ParentalLevel & GetLevel() const
void SetLevel(const ParentalLevel &level)
void OnResultReady(bool passwordValid, ParentalLevel::Level newLevel)
void handleImage(const QString &name, const QString &filename) override
ScreenCopyDest(MythScreenType *screen)
void handleState(const QString &name, const QString &value) override
void handleText(const QString &name, const QString &value) override
bool ScanVideoDirectory(const QString &start_path, DirectoryHandler *handler, const FileAssociations::ext_ignore_list &ext_disposition, bool list_unknown_extensions)
const QString VIDEO_PLOT_DEFAULT
const QString VIDEO_BANNER_DEFAULT
const QString VIDEO_SCREENSHOT_DEFAULT
const QString VIDEO_FANART_DEFAULT
const QString VIDEO_RATING_DEFAULT
const QString VIDEO_DIRECTOR_UNKNOWN
static const iso6937table * d
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
MythConfirmationDialog * ShowOkPopup(const QString &message, bool showCancel)
Non-blocking version of MythPopupBox::showOkPopup()
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
MythNotificationCenter * GetNotificationCenter(void)
MythMainWindow * GetMythMainWindow(void)
Convenience inline random number generator functions.
@ kMSDontDisableDrawing
avoid disabling UI drawing
uint myth_system(const QString &command, uint flags, std::chrono::seconds timeout)
static MythThemedMenu * menu
QHash< QString, QString > InfoMap
uint32_t MythRandom()
generate 32 random bits
bool IsValidDialogType(int num)
QStringList GetTrailersInDirectory(const QString &startDir)
VideoMetadata * GetMetadataPtrFromNode(MythGenericTree *node)
void CopyMetadataToUI(const VideoMetadata *metadata, CopyMetadataDestination &dest)
void PlayVideo(const QString &filename, const VideoMetadataListManager &video_list, bool useAltPlayer=false)
void CopyPlaybackStateToUI(const PlaybackState &playbackState, const VideoMetadata *metadata, MythUIButtonListItem *item=nullptr, MythScreenType *screen=nullptr)
MythGenericTree * GetNodePtrFromButton(MythUIButtonListItem *item)
bool GetLocalVideoImage(const QString &video_uid, const QString &filename, const QStringList &in_dirs, QString &image, QString title, int season, const QString &host, const QString &sgroup, int episode=0, bool isScreenshot=false)
std::unique_ptr< FanartLoader > fanartLoader
def rating(profile, smoonURL, gate)
static bool Assign(ContainerType *container, UIType *&item, const QString &name, bool *err=nullptr)
SimpleCollect(QStringList &fileList)
void handleFile(const QString &fileName, const QString &fqFileName, const QString &extension, const QString &host) override
DirectoryHandler * newDir(const QString &dirName, const QString &fqDirName) override
static const QString sLocation
bool IsDefaultScreenshot(const QString &screenshot)
QString ParentalLevelToState(const ParentalLevel &level)
bool IsDefaultFanart(const QString &fanart)
QString WatchedToState(bool watched)
QStringList GetVideoDirsByHost(const QString &host)
QString TrailerToState(const QString &trailerFile)
void CheckedSet(MythUIStateType *uiItem, const QString &value)
bool IsDefaultCoverFile(const QString &coverfile)
bool IsDefaultBanner(const QString &banner)
QStringList GetVideoDirs()