diff options
author | Antti Ajanki <antti.ajanki@iki.fi> | 2010-08-25 20:13:45 +0300 |
---|---|---|
committer | Antti Ajanki <antti.ajanki@iki.fi> | 2010-08-25 20:13:45 +0300 |
commit | f817cb0f4c07788a2c114590fd317c94c9a3958c (patch) | |
tree | 7acfc743cb19218e48f25a158c842b457ba7bfd9 | |
parent | 8ceffe4de296a21ad841a865315ca1d1370777c9 (diff) | |
download | vdr-plugin-webvideo-f817cb0f4c07788a2c114590fd317c94c9a3958c.tar.gz vdr-plugin-webvideo-f817cb0f4c07788a2c114590fd317c94c9a3958c.tar.bz2 |
call a script after downloading finishes
-rw-r--r-- | README.vdrplugin | 15 | ||||
-rw-r--r-- | TODO | 2 | ||||
-rw-r--r-- | debian/plugin.webvideo.conf | 1 | ||||
-rwxr-xr-x | examples/transcode2ogg.sh | 29 | ||||
-rw-r--r-- | src/vdr-plugin/common.c | 23 | ||||
-rw-r--r-- | src/vdr-plugin/common.h | 2 | ||||
-rw-r--r-- | src/vdr-plugin/config.c | 13 | ||||
-rw-r--r-- | src/vdr-plugin/config.h | 4 | ||||
-rw-r--r-- | src/vdr-plugin/download.c | 42 | ||||
-rw-r--r-- | src/vdr-plugin/menu.c | 1 | ||||
-rw-r--r-- | src/vdr-plugin/po/de_DE.po | 4 | ||||
-rw-r--r-- | src/vdr-plugin/po/fi_FI.po | 4 | ||||
-rw-r--r-- | src/vdr-plugin/po/fr_FR.po | 4 | ||||
-rw-r--r-- | src/vdr-plugin/po/it_IT.po | 10 | ||||
-rw-r--r-- | src/vdr-plugin/request.c | 136 | ||||
-rw-r--r-- | src/vdr-plugin/request.h | 17 | ||||
-rw-r--r-- | src/vdr-plugin/timer.c | 1 | ||||
-rw-r--r-- | src/vdr-plugin/webvideo.c | 9 |
18 files changed, 276 insertions, 41 deletions
diff --git a/README.vdrplugin b/README.vdrplugin index 838a936..19c8b04 100644 --- a/README.vdrplugin +++ b/README.vdrplugin @@ -95,7 +95,8 @@ VDR plugin command line parameters path is the VDR video directory. -t dir, --templatedir=DIR Read video site templates from DIR (default /usr/local/share/webvi/templates) --c FILE, --conf=FILE Load settings from FILE +-c FILE, --conf=FILE Load settings from FILE +-p CMD, --postprocess=CMD Execute CMD after downloading Config file ----------- @@ -178,3 +179,15 @@ related videos that appear in Youtube navigate to the Youtube search, enter "VDR Linux" as search term and "Date added" as sorting criterion, execute the search, and create a timer on the search results page. + +Executing a script after downloading +------------------------------------ + +The option -p sets a script that is called for each downloaded file. +For example: vdr -P "webvideo -p /path/to/script.sh" + +The script will be called with a single argument: the name (including +the path) of the downloaded file. + +An example script for transcoding the downloaded files to Ogg format +is included in the source distribution in examples/transcode2ogg.sh. @@ -16,3 +16,5 @@ Download percentage on the VDR plugin status page does is not updated when using external downloader process (YLE Areena) Streaming does not work with external downloader process (YLE Areena) + +Fix support for mplayer plugin diff --git a/debian/plugin.webvideo.conf b/debian/plugin.webvideo.conf index 8941e9b..74842bf 100644 --- a/debian/plugin.webvideo.conf +++ b/debian/plugin.webvideo.conf @@ -5,6 +5,7 @@ # -d DIR, --downloaddir=DIR Save downloaded files to DIR # -t DIR, --templatedir=DIR Read video site templates from DIR # -c FILE, --conf=FILE Read settings from FILE +# -p CMD, --postprocess=CMD Execute CMD on downloaded files # --downloaddir=/var/lib/webvideo --templatedir=/usr/share/webvi/templates diff --git a/examples/transcode2ogg.sh b/examples/transcode2ogg.sh new file mode 100755 index 0000000..3f25ffc --- /dev/null +++ b/examples/transcode2ogg.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +# An example post-processing script for VDR plugin webvideo. +# +# Copyright: Antti Ajanki <antti.ajanki@iki.fi> +# License: GPL3, see the file COPYING for the full license +# +# This script transcodes a video file using Ogg Theora and Vorbis +# codecs. The first parameter is the name of the video file. +# +# To setup this script to be called for every downloaded file, start +# the webvideo plugin with option -p. For example: +# +# vdr -P "webvideo -p /path/to/this/file/transcode2ogg.sh" + +fullsrcname=$1 +videodir=`dirname "$fullsrcname"` +srcfile=`basename "$fullsrcname"` +srcbasename=`echo "$srcfile" | sed 's/\.[^.]*$//'` +destname="$videodir/$srcbasename.ogg" + +ffmpeg -i "$fullsrcname" -qscale 8 -vcodec libtheora -acodec libvorbis -ac 2 -y "$destname" + +if [ $? -eq 0 ]; then + rm -f "$fullsrcname" + exit 0 +else + exit 1 +fi diff --git a/src/vdr-plugin/common.c b/src/vdr-plugin/common.c index 0731da9..12a5204 100644 --- a/src/vdr-plugin/common.c +++ b/src/vdr-plugin/common.c @@ -180,3 +180,26 @@ char *safeFilename(char *filename) { return filename; } + +cString shellEscape(const char *s) { + char *buffer = (char *)malloc((4*strlen(s)+3)*sizeof(char)); + const char *src = s; + char *dst = buffer; + + *dst++ = '\''; + while (*src) { + if (*src == '\'') { + *dst++ = '\''; + *dst++ = '\\'; + *dst++ = '\''; + *dst++ = '\''; + src++; + } else { + *dst++ = *src++; + } + } + *dst++ = '\''; + *dst = '\0'; + + return cString(buffer, true); +} diff --git a/src/vdr-plugin/common.h b/src/vdr-plugin/common.h index 5b4385f..bbdb8c2 100644 --- a/src/vdr-plugin/common.h +++ b/src/vdr-plugin/common.h @@ -38,5 +38,7 @@ char *URLdecode(const char *s); // '!') and dots from the beginning. The string is modified in-place, // i.e. returns the pointer filename that was passed as argument. char *safeFilename(char *filename); +// Escape s so that it can be passed as parameter to a shell command. +cString shellEscape(const char *s); #endif // __WEBVIDEO_COMMON_H diff --git a/src/vdr-plugin/config.c b/src/vdr-plugin/config.c index f294e60..23a6feb 100644 --- a/src/vdr-plugin/config.c +++ b/src/vdr-plugin/config.c @@ -63,6 +63,7 @@ cWebvideoConfig::cWebvideoConfig() { downloadPath = NULL; templatePath = NULL; preferXine = true; + postProcessCmd = NULL; } cWebvideoConfig::~cWebvideoConfig() { @@ -70,6 +71,8 @@ cWebvideoConfig::~cWebvideoConfig() { free(downloadPath); if (templatePath) free(templatePath); + if (postProcessCmd) + free(postProcessCmd); } void cWebvideoConfig::SetDownloadPath(const char *path) { @@ -197,3 +200,13 @@ const char *cWebvideoConfig::GetMinQuality(const char *site, eRequestType type) const char *cWebvideoConfig::GetMaxQuality(const char *site, eRequestType type) { return GetQuality(site, type, 1); } + +void cWebvideoConfig::SetPostProcessCmd(const char *cmd) { + if (postProcessCmd) + free(postProcessCmd); + postProcessCmd = cmd ? strdup(cmd) : NULL; +} + +const char *cWebvideoConfig::GetPostProcessCmd() { + return postProcessCmd; +} diff --git a/src/vdr-plugin/config.h b/src/vdr-plugin/config.h index 29304b4..fd541b3 100644 --- a/src/vdr-plugin/config.h +++ b/src/vdr-plugin/config.h @@ -34,6 +34,7 @@ class cWebvideoConfig { private: char *downloadPath; char *templatePath; + char *postProcessCmd; bool preferXine; cList<cDownloadQuality> downloadLimits; cList<cDownloadQuality> streamLimits; @@ -57,6 +58,9 @@ public: const char *GetMinQuality(const char *site, eRequestType type); const char *GetMaxQuality(const char *site, eRequestType type); + + void SetPostProcessCmd(const char *cmd); + const char *GetPostProcessCmd(); }; extern cWebvideoConfig *webvideoConfig; diff --git a/src/vdr-plugin/download.c b/src/vdr-plugin/download.c index f9d956f..553e2ec 100644 --- a/src/vdr-plugin/download.c +++ b/src/vdr-plugin/download.c @@ -83,8 +83,6 @@ void cWebviThread::ActivateNewRequest() { // start it. MoveToFinishedList(req); } else { - debug("starting request %d", req->GetID()); - if (!req->Start(webvi)) { error("Request failed to start"); req->RequestDone(-1, "Request failed to start"); @@ -113,9 +111,9 @@ void cWebviThread::StopFinishedRequests() { requestMutex.Lock(); req = activeRequestList.FindByHandle(donemsg->handle); if (req) { - debug("Finished request %d", req->GetID()); req->RequestDone(donemsg->status_code, donemsg->data); - MoveToFinishedList(req); + if (req->IsFinished()) + MoveToFinishedList(req); } requestMutex.Unlock(); } @@ -134,6 +132,7 @@ void cWebviThread::Action(void) { struct timeval timeout; long running_handles; bool check_done = false; + bool has_request_files = false; if (webvi == 0) { error("Failed to get libwebvi context"); @@ -149,6 +148,19 @@ void cWebviThread::Action(void) { if (newreqread > maxfd) maxfd = newreqread; + has_request_files = false; + requestMutex.Lock(); + for (int i=0; i<activeRequestList.Size(); i++) { + int fd = activeRequestList[i]->File(); + if (fd != -1) { + FD_SET(fd, &readfds); + if (fd > maxfd) + maxfd = fd; + has_request_files = true; + } + } + requestMutex.Unlock(); + timeout.tv_sec = 5; timeout.tv_usec = 0; @@ -174,8 +186,26 @@ void cWebviThread::Action(void) { Cancel(-1); ActivateNewRequest(); } else { - webvi_perform(webvi, fd, WEBVI_SELECT_READ, &running_handles); - check_done = true; + bool handled = false; + + if (has_request_files) { + requestMutex.Lock(); + for (int i=0; i<activeRequestList.Size(); i++) { + if (fd == activeRequestList[i]->File()) { + activeRequestList[i]->Read(); + if (activeRequestList[i]->IsFinished()) + MoveToFinishedList(activeRequestList[i]); + handled = true; + break; + } + } + requestMutex.Unlock(); + } + + if (!handled) { + webvi_perform(webvi, fd, WEBVI_SELECT_READ, &running_handles); + check_done = true; + } } } if (FD_ISSET(fd, &writefds)) diff --git a/src/vdr-plugin/menu.c b/src/vdr-plugin/menu.c index 3add4d4..111339f 100644 --- a/src/vdr-plugin/menu.c +++ b/src/vdr-plugin/menu.c @@ -455,7 +455,6 @@ eOSState cNavigationMenu::Select(cLinkBase *link, eLinkType type) cDownloadProgress *progress = summaries.NewDownload(); cFileDownloadRequest *req = \ new cFileDownloadRequest(history->Current()->GetID(), ref, - webvideoConfig->GetDownloadPath(), progress); cWebviThread::Instance().AddRequest(req); diff --git a/src/vdr-plugin/po/de_DE.po b/src/vdr-plugin/po/de_DE.po index f096ba9..a7c5b35 100644 --- a/src/vdr-plugin/po/de_DE.po +++ b/src/vdr-plugin/po/de_DE.po @@ -7,14 +7,14 @@ msgid "" msgstr "" "Project-Id-Version: webvideo 0.1.1\n" "Report-Msgid-Bugs-To: <see README>\n" -"POT-Creation-Date: 2010-07-09 15:12+0300\n" +"POT-Creation-Date: 2010-08-22 19:28+0300\n" "PO-Revision-Date: 2009-02-18 20:04+0200\n" "Last-Translator: <cnc@gmx.de>\n" "Language-Team: German\n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Language: \n" msgid "No streams on this page, create timer anyway?" msgstr "" diff --git a/src/vdr-plugin/po/fi_FI.po b/src/vdr-plugin/po/fi_FI.po index 6e6df2f..989da6b 100644 --- a/src/vdr-plugin/po/fi_FI.po +++ b/src/vdr-plugin/po/fi_FI.po @@ -7,14 +7,14 @@ msgid "" msgstr "" "Project-Id-Version: webvideo 0.1.1\n" "Report-Msgid-Bugs-To: <see README>\n" -"POT-Creation-Date: 2010-07-09 15:12+0300\n" +"POT-Creation-Date: 2010-08-22 19:28+0300\n" "PO-Revision-Date: 2008-06-07 18:03+0300\n" "Last-Translator: Antti Ajanki <antti.ajanki@iki.fi>\n" "Language-Team: Finnish\n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Language: \n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" msgid "No streams on this page, create timer anyway?" diff --git a/src/vdr-plugin/po/fr_FR.po b/src/vdr-plugin/po/fr_FR.po index 79f31b5..1bd1898 100644 --- a/src/vdr-plugin/po/fr_FR.po +++ b/src/vdr-plugin/po/fr_FR.po @@ -7,14 +7,14 @@ msgid "" msgstr "" "Project-Id-Version: webvideo 0.0.5\n" "Report-Msgid-Bugs-To: <see README>\n" -"POT-Creation-Date: 2010-07-09 15:12+0300\n" +"POT-Creation-Date: 2010-08-22 19:28+0300\n" "PO-Revision-Date: 2008-09-08 20:34+0100\n" "Last-Translator: Bruno ROUSSEL <bruno.roussel@free.fr>\n" "Language-Team: French\n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Language: \n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" msgid "No streams on this page, create timer anyway?" diff --git a/src/vdr-plugin/po/it_IT.po b/src/vdr-plugin/po/it_IT.po index fd59818..cb1dfdb 100644 --- a/src/vdr-plugin/po/it_IT.po +++ b/src/vdr-plugin/po/it_IT.po @@ -7,14 +7,14 @@ msgid "" msgstr "" "Project-Id-Version: webvideo 0.0.1\n" "Report-Msgid-Bugs-To: <see README>\n" -"POT-Creation-Date: 2010-07-09 15:12+0300\n" +"POT-Creation-Date: 2010-08-22 19:28+0300\n" "PO-Revision-Date: 2010-07-17 00:39+0100\n" "Last-Translator: Diego Pierotto <vdr-italian@tiscali.it>\n" "Language-Team: Italian\n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -"Language: \n" "X-Poedit-Language: Italian\n" "X-Poedit-Country: ITALY\n" "X-Poedit-SourceCharset: utf-8\n" @@ -140,14 +140,18 @@ msgstr "%d scaricamenti non conclusi" #~ msgid "<No title>" #~ msgstr "<Senza titolo>" + #~ msgid "Can't download web page!" #~ msgstr "Impossibile scaricare la pagina web!" + #~ msgid "XSLT transformation produced no URL!" #~ msgstr "La conversione XSLT non ha generato alcun URL!" + #~ msgid "XSLT transformation failed." #~ msgstr "Conversione XSLT fallita." + #~ msgid "Unknown error!" #~ msgstr "Errore sconosciuto!" + #~ msgid "Select video source" #~ msgstr "Seleziona fonte video" - diff --git a/src/vdr-plugin/request.c b/src/vdr-plugin/request.c index edc5432..00297f7 100644 --- a/src/vdr-plugin/request.c +++ b/src/vdr-plugin/request.c @@ -9,6 +9,7 @@ #include <string.h> #include <stdlib.h> #include <errno.h> +#include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> @@ -185,8 +186,9 @@ WebviHandle cMenuRequest::PrepareHandle() { } bool cMenuRequest::Start(WebviCtx webvictx) { - webvi = webvictx; + debug("starting request %d", reqID); + webvi = webvictx; if ((PrepareHandle() != -1) && (webvi_start_handle(webvi, handle) == WEBVIERR_OK)) { finished = false; return true; @@ -195,13 +197,15 @@ bool cMenuRequest::Start(WebviCtx webvictx) { } void cMenuRequest::RequestDone(int errorcode, cString pharse) { + debug("RequestDone %d %s", errorcode, (const char *)pharse); + finished = true; status = errorcode; statusPharse = pharse; } void cMenuRequest::Abort() { - if (finished || handle == -1) + if (aborted || finished || handle == -1) return; aborted = true; @@ -228,12 +232,11 @@ cString cMenuRequest::GetResponse() { // --- cFileDownloadRequest ------------------------------------------------ cFileDownloadRequest::cFileDownloadRequest(int ID, const char *streamref, - const char *destdir, cDownloadProgress *progress) : cMenuRequest(ID, streamref), title(NULL), bytesDownloaded(0), - contentLength(-1), destfile(NULL), progressUpdater(progress) + contentLength(-1), destfile(NULL), destfilename(NULL), + progressUpdater(progress), state(STATE_WEBVI) { - this->destdir = strdup(destdir); if (progressUpdater) progressUpdater->AssociateWith(this); @@ -245,8 +248,8 @@ cFileDownloadRequest::~cFileDownloadRequest() { destfile->Close(); delete destfile; } - if (destdir) - free(destdir); + if (destfilename) + free(destfilename); if (title) free(title); // do not delete progressUpdater @@ -282,7 +285,7 @@ bool cFileDownloadRequest::OpenDestFile() { char *contentType; char *url; char *ext; - cString destfilename; + cString filename; int fd, i; if (handle == -1) { @@ -315,18 +318,19 @@ bool cFileDownloadRequest::OpenDestFile() { free(url); free(contentType); + const char *destdir = webvideoConfig->GetDownloadPath(); char *basename = strdup(title ? title : "???"); basename = safeFilename(basename); i = 1; - destfilename = cString::sprintf("%s/%s%s", destdir, basename, ext); + filename = cString::sprintf("%s/%s%s", destdir, basename, ext); while (true) { - debug("trying to open %s", (const char *)destfilename); + debug("trying to open %s", (const char *)filename); - fd = destfile->Open(destfilename, O_WRONLY | O_CREAT | O_EXCL, DEFFILEMODE); + fd = destfile->Open(filename, O_WRONLY | O_CREAT | O_EXCL, DEFFILEMODE); if (fd == -1 && errno == EEXIST) - destfilename = cString::sprintf("%s/%s-%d%s", destdir, basename, i++, ext); + filename = cString::sprintf("%s/%s-%d%s", destdir, basename, i++, ext); else break; }; @@ -335,13 +339,16 @@ bool cFileDownloadRequest::OpenDestFile() { free(ext); if (fd < 0) { - error("Failed to open file %s: %m", (const char *)destfilename); + error("Failed to open file %s: %m", (const char *)filename); delete destfile; destfile = NULL; return false; } - info("Saving to %s", (const char *)destfilename); + if (destfilename) + free(destfilename); + destfilename = strdup(filename); + info("Saving to %s", destfilename); if (progressUpdater) { progressUpdater->SetTitle(title); @@ -387,11 +394,102 @@ char *cFileDownloadRequest::GetExtension(const char *contentType, const char *ur } void cFileDownloadRequest::RequestDone(int errorcode, cString pharse) { - cMenuRequest::RequestDone(errorcode, pharse); - if (progressUpdater) - progressUpdater->MarkDone(errorcode, pharse); - if (destfile) - destfile->Close(); + if (state == STATE_WEBVI) { + if (destfile) + destfile->Close(); + + if (errorcode == 0) + StartPostProcessing(); + else + state = STATE_FINISHED; + + } else if (state == STATE_POSTPROCESS) { + postProcessPipe.Close(); + state = STATE_FINISHED; + } + + if (state == STATE_FINISHED) { + cMenuRequest::RequestDone(errorcode, pharse); + if (progressUpdater) + progressUpdater->MarkDone(errorcode, pharse); + } +} + +void cFileDownloadRequest::Abort() { + if (state == STATE_POSTPROCESS) + postProcessPipe.Close(); + + cMenuRequest::Abort(); +} + +void cFileDownloadRequest::StartPostProcessing() { + state = STATE_POSTPROCESS; + + const char *script = webvideoConfig->GetPostProcessCmd(); + if (!script || !destfilename) { + state = STATE_FINISHED; + return; + } + + info("post-processing %s", destfilename); + + cString cmd = cString::sprintf("%s %s", + (const char *)shellEscape(script), + (const char *)shellEscape(destfilename)); + debug("executing %s", (const char *)cmd); + + if (!postProcessPipe.Open(cmd, "r")) { + state = STATE_FINISHED; + return; + } + + int flags = fcntl(fileno(postProcessPipe), F_GETFL, 0); + flags |= O_NONBLOCK; + fcntl(fileno(postProcessPipe), F_SETFL, flags); +} + +int cFileDownloadRequest::File() { + FILE *f = postProcessPipe; + + if (f) + return fileno(f); + else + return -1; +} + +bool cFileDownloadRequest::Read() { + const size_t BUF_LEN = 512; + char buf[BUF_LEN]; + + if (!(FILE *)postProcessPipe) + return false; + + while (true) { + ssize_t nbytes = read(fileno(postProcessPipe), buf, BUF_LEN); + + if (nbytes < 0) { + if (errno != EAGAIN && errno != EINTR) { + LOG_ERROR_STR("post process pipe"); + return false; + } + } else if (nbytes == 0) { + info("post-processing of %s finished", destfilename); + + if (IsAborted()) + RequestDone(-2, "Aborted"); + else + RequestDone(0, ""); + + return true; + } else { + debug("pp: %.*s", nbytes, buf); + + if (nbytes < (ssize_t)BUF_LEN) + return true; + } + } + + return true; } // --- cStreamUrlRequest --------------------------------------------------- diff --git a/src/vdr-plugin/request.h b/src/vdr-plugin/request.h index f481fc8..8f8eadb 100644 --- a/src/vdr-plugin/request.h +++ b/src/vdr-plugin/request.h @@ -91,7 +91,7 @@ public: bool Start(WebviCtx webvictx); virtual void RequestDone(int errorcode, cString pharse); bool IsFinished() { return finished; } - void Abort(); + virtual void Abort(); bool IsAborted() { return aborted; } // Return true if the lastest status code indicates success. @@ -108,33 +108,44 @@ public: void SetTimer(cWebviTimer *t) { timer = t; } cWebviTimer *GetTimer() { return timer; } + + virtual int File() { return -1; } + virtual bool Read() { return true; } }; // --- cFileDownloadRequest ------------------------------------------------ class cFileDownloadRequest : public cMenuRequest { private: - char *destdir; + enum eDownloadState { STATE_WEBVI, STATE_POSTPROCESS, STATE_FINISHED }; + char *title; long bytesDownloaded; long contentLength; cUnbufferedFile *destfile; + char *destfilename; cDownloadProgress *progressUpdater; + cPipe postProcessPipe; + eDownloadState state; protected: virtual WebviHandle PrepareHandle(); virtual ssize_t WriteData(const char *ptr, size_t len); bool OpenDestFile(); char *GetExtension(const char *contentType, const char *url); + void StartPostProcessing(); public: cFileDownloadRequest(int ID, const char *streamref, - const char *destdir, cDownloadProgress *progress); virtual ~cFileDownloadRequest(); eRequestType GetType() { return REQT_FILE; } void RequestDone(int errorcode, cString pharse); + void Abort(); + + int File(); + bool Read(); }; // --- cStreamUrlRequest --------------------------------------------------- diff --git a/src/vdr-plugin/timer.c b/src/vdr-plugin/timer.c index eb8478a..15a398b 100644 --- a/src/vdr-plugin/timer.c +++ b/src/vdr-plugin/timer.c @@ -147,7 +147,6 @@ void cWebviTimer::DownloadStreams(const char *menuxml, cProgressVector& summarie activeStreams.Append(strdup(ref)); cFileDownloadRequest *req = \ new cFileDownloadRequest(REQ_ID_TIMER, ref, - webvideoConfig->GetDownloadPath(), summaries.NewDownload()); req->SetTimer(this); cWebviThread::Instance().AddRequest(req); diff --git a/src/vdr-plugin/webvideo.c b/src/vdr-plugin/webvideo.c index e2b65c3..afc240a 100644 --- a/src/vdr-plugin/webvideo.c +++ b/src/vdr-plugin/webvideo.c @@ -37,6 +37,7 @@ private: cString templatedir; cString destdir; cString conffile; + cString postprocesscmd; static int nextMenuID; @@ -88,7 +89,8 @@ const char *cPluginWebvideo::CommandLineHelp(void) // Return a string that describes all known command line options. return " -d DIR, --downloaddir=DIR Save downloaded files to DIR\n" \ " -t DIR, --templatedir=DIR Read video site templates from DIR\n" \ - " -c FILE, --conf=FILE Load settings from FILE\n"; + " -c FILE, --conf=FILE Load settings from FILE\n" \ + " -p CMD, --postprocess=CMD Execute CMD after downloading\n"; } bool cPluginWebvideo::ProcessArgs(int argc, char *argv[]) @@ -98,6 +100,7 @@ bool cPluginWebvideo::ProcessArgs(int argc, char *argv[]) { "downloaddir", required_argument, NULL, 'd' }, { "templatedir", required_argument, NULL, 't' }, { "conf", required_argument, NULL, 'c' }, + { "postprocess", required_argument, NULL, 'p' }, { NULL } }; @@ -113,6 +116,9 @@ bool cPluginWebvideo::ProcessArgs(int argc, char *argv[]) case 'c': conffile = cString(optarg); break; + case 'p': + postprocesscmd = cString(optarg); + break; default: return false; } @@ -135,6 +141,7 @@ bool cPluginWebvideo::Initialize(void) webvideoConfig->SetDownloadPath(destdir); webvideoConfig->SetTemplatePath(templatedir); + webvideoConfig->SetPostProcessCmd(postprocesscmd); webvideoConfig->ReadConfigFile(conffile); cString mymimetypes = AddDirectory(ConfigDirectory(Name()), "mime.types"); |