Go to the documentation of this file.
54 QString message = tr(
"Downloading Video...");
69 QString cache = QString(
"%1/cache/netvision-thumbcache")
72 QStringList thumbs = cacheDir.entryList(QDir::Files);
74 for (
auto i = thumbs.crbegin(); i != thumbs.crend(); ++i)
76 QString
filename = QString(
"%1/%2").arg(cache, *i);
77 LOG(VB_GENERAL, LOG_DEBUG, QString(
"Deleting file %1").arg(
filename));
79 QDateTime lastmod = fi.lastModified();
98 auto seconds = std::chrono::seconds(item->
GetTime().toInt());
102 duration_cast<std::chrono::minutes>(seconds), item->
GetDate().toString(
"yyyy"));
126 args.replaceInStrings(
"%URL%", item->
GetURL());
130 QString playerCommand = cmd +
" " +
args.join(
" ");
135 QString url = item->
GetURL();
137 LOG(VB_GENERAL, LOG_DEBUG, QString(
"Web URL = %1").arg(url));
145 if (browser.isEmpty())
147 ShowOkPopup(tr(
"No browser command set! MythNetTree needs "
148 "MythBrowser installed to display the video."));
152 if (browser.toLower() ==
"internal")
158 url.replace(
"mythflash://",
"http://");
159 QString cmd = browser;
160 cmd.replace(
"%ZOOM%", zoom);
161 cmd.replace(
"%URL%", url);
162 cmd.replace(
'\'',
"%27");
163 cmd.replace(
"&",
"\\&");
164 cmd.replace(
";",
"\\;");
184 QString message = tr(
"Are you sure you want to delete this file?");
188 if (confirmdialog->Create())
195 delete confirmdialog;
224 auto *me =
dynamic_cast<MythEvent *
>(event);
227 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
228 QStringList tokens = me->
Message().split(
" ", QString::SkipEmptyParts);
230 QStringList tokens = me->Message().split(
" ", Qt::SkipEmptyParts);
233 if (tokens.isEmpty())
236 if (tokens[0] ==
"DOWNLOAD_FILE")
238 QStringList
args = me->ExtraDataList();
239 if ((tokens.size() != 2) ||
243 if (tokens[1] ==
"UPDATE")
245 QString message = tr(
"Downloading Video...\n"
247 .arg(QString::number(
args[2].toInt() / 1024.0 / 1024.0,
249 QString::number(
args[3].toInt() / 1024.0 / 1024.0,
255 else if (tokens[1] ==
"FINISHED")
257 int fileSize =
args[2].toInt();
258 int errorCode =
args[4].toInt();
268 if ((errorCode == 0) &&
275 ShowOkPopup(tr(
"Error downloading video to backend."));
296 LOG(VB_GENERAL, LOG_INFO, QString(
"Downloading %1 to %2")
bool Create(void) override
QString generate_file_url(const QString &storage_group, const QString &host, const QString &path)
QString GetMasterHostName(void)
static const Type kMythEventMessage
QString GetDownloadFilename(const QString &title, const QString &url)
const QString & GetPlayer() const
static bool Exists(const QString &url, struct stat *fileinfo)
void SlotDeleteVideo(void)
This class is used as a container for messages.
const QString & GetTitle() const
static void RestoreScreensaver()
void InitProgressDialog()
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Screen in which all other widgets are contained and rendered.
void customEvent(QEvent *event) override
void SetMessage(const QString &message)
uint myth_system(const QString &command, uint flags, std::chrono::seconds timeout)
void Init() override
Used after calling Load() to assign data to widgets and other UI initilisation which is prohibited in...
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
const QString & Message() const
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 DownloadVideo(const QString &url, const QString &dest)
void addListener(QObject *listener)
Add a listener to the observable.
static void DisableScreensaver()
MythScreenStack * m_popupStack
const QDateTime & GetDate() const
virtual ResultItem * GetStreamItem()=0
static void CleanCacheDir()
GrabberScript::scriptList m_grabberList
void SetProgress(uint count)
MetadataImageDownload * m_imageDownload
const QString & GetTime() const
const uint & GetSeason() const
void StreamWebVideo(void)
static bool DeleteFile(const QString &url)
const QString & GetSubtitle() const
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
const QString & GetDescription() const
void DoDeleteVideo(bool remove)
const QStringList & GetPlayerArguments() const
virtual void LoadData(void)=0
const uint & GetEpisode() const
NetBase(MythScreenStack *parent, const char *name=nullptr)
const QString & GetURL() const
Dialog asking for user confirmation. Ok and optional Cancel button.
void SetTotal(uint total)
MythMainWindow * GetMythMainWindow(void)
QString RemoteDownloadFile(const QString &url, const QString &storageGroup, const QString &filename)
MythUIProgressDialog * m_progressDialog
@ kMSDontDisableDrawing
avoid disabling UI drawing
void AllowInput(bool Allow)
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
const bool & GetDownloadable() const
MythConfirmationDialog * ShowOkPopup(const QString &message, bool showCancel)
Non-blocking version of MythPopupBox::showOkPopup()
void removeListener(QObject *listener)
Remove a listener to the observable.
void DoDownloadAndPlay(void)
const QString & GetMediaURL() const
static void RunCmdWithoutScreensaver(const QString &cmd)
void PauseIdleTimer(bool Pause)
Pause the idle timeout timer.
QString GetSetting(const QString &key, const QString &defaultval="")