summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xfrikanalen/bin/scheduler9
1 files changed, 7 insertions, 2 deletions
diff --git a/frikanalen/bin/scheduler b/frikanalen/bin/scheduler
index 7420822..c54ca9a 100755
--- a/frikanalen/bin/scheduler
+++ b/frikanalen/bin/scheduler
@@ -307,7 +307,7 @@ sub get_epglist {
# it is not very good for initial testing.
# http://wiki.videolan.org/Documentation:Streaming_HowTo/VLM
sub vlc_start {
- my $vlc = {};
+ my $vlc = shift || {};
my $pid = fork();
if (not defined $pid) {
return undef;
@@ -361,7 +361,12 @@ sub vlc_play {
my ($url, $postfunc) = @{$cmdref};
unless (lwp_get($url)) {
- print "Failed to contact VLC\n";
+ print "Failed to contact VLC, restarting\n";
+ kill $vlc->{pid};
+ sleep 1; # Give it some time to die if it was running
+ vlc_start($vlc);
+ sleep 2; # Give the new one some time to start
+ return vlc_play($vlc, $file, $loop);
} elsif (defined $postfunc) {
$postfunc->($vlc, $url);
}