diff options
author | Petter Reinholdtsen <pere@hungry.com> | 2010-01-01 08:51:37 +0000 |
---|---|---|
committer | Petter Reinholdtsen <pere@hungry.com> | 2010-01-01 08:51:37 +0000 |
commit | f054786ed94754227bcb92a8bdc5f73c87eb6c79 (patch) | |
tree | 981b8ef1af239f06593a1cc50eba396db3c9b663 | |
parent | 696d9159d7eaa2ae81d994db16c24408283f73b0 (diff) |
Restart vlc if it is no longer working.
-rwxr-xr-x | frikanalen/bin/scheduler | 9 |
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); } |