Fixed EXT protocol execution (Thanks to Peter Holik).

Changed scripts to use bash instead of sh.
This commit is contained in:
Rolf Ahrenberg 2010-10-25 14:43:38 +03:00
parent fd06641449
commit a6d4e850fc
9 changed files with 17 additions and 11 deletions

View File

@ -142,7 +142,7 @@ VDR Plugin 'iptv' Revision History
- Updated for vdr-1.7.15. - Updated for vdr-1.7.15.
2010-09-19: Version 0.4.3 2010-xx-xx: Version 0.4.3
- Updated for vdr-1.7.16. - Updated for vdr-1.7.16.
- Renamed Sid scanner to section id scanner and added - Renamed Sid scanner to section id scanner and added
@ -152,3 +152,5 @@ VDR Plugin 'iptv' Revision History
- Changed ProvidesChannel() to set the need of detaching - Changed ProvidesChannel() to set the need of detaching
receivers due to VDR's channel selection mechanism. receivers due to VDR's channel selection mechanism.
- Enabled partial content responses for HTTP protocol. - Enabled partial content responses for HTTP protocol.
- Fixed EXT protocol execution (Thanks to Peter Holik).
- Changed scripts to use bash instead of sh.

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
set -e set -e

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# internetradio.sh is used by the VDR iptv plugin to transcode an internet # internetradio.sh is used by the VDR iptv plugin to transcode an internet
# radio stream. # radio stream.

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# #
# iptvstream.sh can be used by the VDR iptv plugin to transcode external # iptvstream.sh can be used by the VDR iptv plugin to transcode external
# sources # sources

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# #
# iptvstream.sh can be used by the VDR iptv plugin to transcode external # iptvstream.sh can be used by the VDR iptv plugin to transcode external
# sources # sources

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# linein.sh is used by the VDR iptv plugin to transcode line-in of # linein.sh is used by the VDR iptv plugin to transcode line-in of
# a soundcard. # a soundcard.

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# #
# vlc2iptv is used by the VDR iptv plugin to transcode external sources # vlc2iptv is used by the VDR iptv plugin to transcode external sources
# #

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# webcam.sh is used by the VDR iptv plugin to transcode an internet radio # webcam.sh is used by the VDR iptv plugin to transcode an internet radio
# stream remuxed with images (e.g. webcam) to provide a video stream. # stream remuxed with images (e.g. webcam) to provide a video stream.

View File

@ -38,6 +38,8 @@ void cIptvProtocolExt::ExecuteScript(void)
{ {
debug("cIptvProtocolExt::ExecuteScript()\n"); debug("cIptvProtocolExt::ExecuteScript()\n");
// Check if already executing // Check if already executing
if (isActive || isempty(scriptFile))
return;
if (pid > 0) { if (pid > 0) {
error("Cannot execute script!"); error("Cannot execute script!");
return; return;
@ -53,7 +55,7 @@ void cIptvProtocolExt::ExecuteScript(void)
// Execute the external script // Execute the external script
cString cmd = cString::sprintf("%s %d %d", *scriptFile, scriptParameter, socketPort); cString cmd = cString::sprintf("%s %d %d", *scriptFile, scriptParameter, socketPort);
debug("cIptvProtocolExt::ExecuteScript(child): %s\n", *cmd); debug("cIptvProtocolExt::ExecuteScript(child): %s\n", *cmd);
if (execl("/bin/sh", "sh", "-c", *cmd, (char *)NULL) == -1) { if (execl("/bin/bash", "sh", "-c", *cmd, (char *)NULL) == -1) {
error("Script execution failed: %s", *cmd); error("Script execution failed: %s", *cmd);
_exit(-1); _exit(-1);
} }
@ -67,6 +69,8 @@ void cIptvProtocolExt::ExecuteScript(void)
void cIptvProtocolExt::TerminateScript(void) void cIptvProtocolExt::TerminateScript(void)
{ {
debug("cIptvProtocolExt::TerminateScript(): pid=%d\n", pid); debug("cIptvProtocolExt::TerminateScript(): pid=%d\n", pid);
if (!isActive || isempty(scriptFile))
return;
if (pid > 0) { if (pid > 0) {
const unsigned int timeoutms = 100; const unsigned int timeoutms = 100;
unsigned int waitms = 0; unsigned int waitms = 0;
@ -119,11 +123,11 @@ bool cIptvProtocolExt::Open(void)
bool cIptvProtocolExt::Close(void) bool cIptvProtocolExt::Close(void)
{ {
debug("cIptvProtocolExt::Close()\n"); debug("cIptvProtocolExt::Close()\n");
// Close the socket
CloseSocket();
// Terminate the external script // Terminate the external script
TerminateScript(); TerminateScript();
isActive = false; isActive = false;
// Close the socket
CloseSocket();
return true; return true;
} }