55 QString message = tr(
"Downloading Video...");
70 QString cache = QString(
"%1/cache/netvision-thumbcache")
73 QStringList thumbs = cacheDir.entryList(QDir::Files);
75 for (
auto i = thumbs.crbegin(); i != thumbs.crend(); ++i)
77 QString
filename = QString(
"%1/%2").arg(cache, *i);
78 LOG(VB_GENERAL, LOG_DEBUG, QString(
"Deleting file %1").arg(
filename));
80 QDateTime lastmod = fi.lastModified();
99 auto seconds = std::chrono::seconds(item->
GetTime().toInt());
103 duration_cast<std::chrono::minutes>(seconds), item->
GetDate().toString(
"yyyy"));
127 args.replaceInStrings(
"%URL%", item->
GetURL());
131 QString playerCommand = cmd +
" " +
args.join(
" ");
136 QString url = item->
GetURL();
138 LOG(VB_GENERAL, LOG_DEBUG, QString(
"Web URL = %1").arg(url));
146 if (browser.isEmpty())
148 ShowOkPopup(tr(
"No browser command set! MythNetTree needs "
149 "MythBrowser installed to display the video."));
153 if (browser.toLower() ==
"internal")
159 url.replace(
"mythflash://",
"http://");
160 QString cmd = browser;
161 cmd.replace(
"%ZOOM%", zoom);
162 cmd.replace(
"%URL%", url);
163 cmd.replace(
'\'',
"%27");
164 cmd.replace(
"&",
"\\&");
165 cmd.replace(
";",
"\\;");
185 QString message = tr(
"Are you sure you want to delete this file?");
189 if (confirmdialog->Create())
197 delete confirmdialog;
227 auto *me =
dynamic_cast<MythEvent *
>(event);
230 QStringList tokens = me->
Message().split(
" ", Qt::SkipEmptyParts);
232 if (tokens.isEmpty())
235 if (tokens[0] ==
"DOWNLOAD_FILE")
237 QStringList
args = me->ExtraDataList();
238 if ((tokens.size() != 2) ||
242 if (tokens[1] ==
"UPDATE")
244 QString message = tr(
"Downloading Video...\n"
246 .arg(QString::number(
args[2].toInt() / 1024.0 / 1024.0,
248 QString::number(
args[3].toInt() / 1024.0 / 1024.0,
254 else if (tokens[1] ==
"FINISHED")
256 int fileSize =
args[2].toInt();
257 int errorCode =
args[4].toInt();
267 if ((errorCode == 0) &&
274 ShowOkPopup(tr(
"Error downloading video to backend."));
295 LOG(VB_GENERAL, LOG_INFO, QString(
"Downloading %1 to %2")
Dialog asking for user confirmation.
QString GetSetting(const QString &key, const QString &defaultval="")
QString GetMasterHostName(void)
This class is used as a container for messages.
const QString & Message() const
static const Type kMythEventMessage
static void DisableScreensaver()
void PauseIdleTimer(bool Pause)
Pause the idle timeout timer.
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)
static void RestoreScreensaver()
void AllowInput(bool Allow)
void addListener(QObject *listener)
Add a listener to the observable.
void removeListener(QObject *listener)
Remove a listener to the observable.
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
Screen in which all other widgets are contained and rendered.
bool Create(void) override
void SetProgress(uint count)
void SetMessage(const QString &message)
void SetTotal(uint total)
GrabberScript::scriptList m_grabberList
void DownloadVideo(const QString &url, const QString &dest)
NetBase(MythScreenStack *parent, const char *name=nullptr)
static void CleanCacheDir()
MythUIProgressDialog * m_progressDialog
static void RunCmdWithoutScreensaver(const QString &cmd)
void DoDeleteVideo(bool remove)
void customEvent(QEvent *event) override
void SlotDeleteVideo(void)
MetadataImageDownload * m_imageDownload
void StreamWebVideo(void)
MythScreenStack * m_popupStack
virtual ResultItem * GetStreamItem()=0
void InitProgressDialog()
void Init() override
Used after calling Load() to assign data to widgets and other UI initilisation which is prohibited in...
virtual void LoadData(void)=0
void DoDownloadAndPlay(void)
static bool DeleteFile(const QString &url)
static bool Exists(const QString &url, struct stat *fileinfo)
const QString & GetPlayer() const
const QString & GetURL() const
const QString & GetDescription() const
const QString & GetMediaURL() const
const QDateTime & GetDate() const
const QStringList & GetPlayerArguments() const
const QString & GetTime() const
const uint & GetEpisode() const
const QString & GetTitle() const
const bool & GetDownloadable() const
const QString & GetSubtitle() const
const uint & GetSeason() const
static QString generate_file_url(const QString &storage_group, const QString &host, const QString &path)
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_)
MythMainWindow * GetMythMainWindow(void)
@ kMSDontDisableDrawing
avoid disabling UI drawing
uint myth_system(const QString &command, uint flags, std::chrono::seconds timeout)
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
QString GetDownloadFilename(const QString &title, const QString &url)
QString RemoteDownloadFile(const QString &url, const QString &storageGroup, const QString &filename)