From a5c8b89d8b74d65f4e086dac5a1bf4f87953b80f Mon Sep 17 00:00:00 2001 From: vanhofen Date: Tue, 12 Feb 2013 13:58:21 +0100 Subject: [PATCH] controlapi.cpp: make ScreenshotCGI() more configurable Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/133740da14553a69695fd5561967210343ca4a2b Author: vanhofen Date: 2013-02-12 (Tue, 12 Feb 2013) Origin message was: ------------------ - controlapi.cpp: make ScreenshotCGI() more configurable --- src/nhttpd/doc/nhttpd_controlapi.html | 12 +++++++++--- .../tuxboxapi/coolstream/controlapi.cpp | 19 ++++++++++++++++--- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/nhttpd/doc/nhttpd_controlapi.html b/src/nhttpd/doc/nhttpd_controlapi.html index e87fa6c56..2632352cc 100644 --- a/src/nhttpd/doc/nhttpd_controlapi.html +++ b/src/nhttpd/doc/nhttpd_controlapi.html @@ -1829,11 +1829,17 @@ Die Pluginliste wird neu geladen.
42. Screenshot erstellen
Handler: http://dbox/control/screenshot

-Parameter: keine
-Rükgabe: ok
+Parameter: name=<dateiname>&osd=1|0&video=1|0

+Rückgabe: ok

-Screenshot mit TV Bild und OSD wird erstellt und unter /tmp/screenshot.png abgelegt. +Screenshot mit TV Bild und OSD wird erstellt und unter /tmp/<dateiname>.png abgelegt.
+
+Beispiel:
+
+>>>http://dbox/control/screenshot?osd=0&video=1
+ok
  

diff --git a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp index f212fab5f..8434428db 100644 --- a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp @@ -1463,10 +1463,23 @@ void CControlAPI::ReloadPluginsCGI(CyhookHandler *hh) void CControlAPI::ScreenshotCGI(CyhookHandler *hh) { - CScreenShot * sc = new CScreenShot("/tmp/screenshot.png", (CScreenShot::screenshot_format_t)0 /*PNG*/); - sc->EnableOSD(true); + bool enableOSD = true; + bool enableVideo = true; + std::string filename = "screenshot"; + + if(hh->ParamList["osd"] == "0") + enableOSD = false; + if(hh->ParamList["video"] == "0") + enableVideo = false; + if(hh->ParamList["name"] != "") + filename = hh->ParamList["name"]; + + CScreenShot * sc = new CScreenShot("/tmp/" + filename + ".png", (CScreenShot::screenshot_format_t)0 /*PNG*/); + sc->EnableOSD(enableOSD); + sc->EnableVideo(enableVideo); sc->Start(); - hh->SendOk(); + + hh->SendOk(); // FIXME what if sc->Start() failed? } //-----------------------------------------------------------------------------