diff options
author | Petter Reinholdtsen <pere@hungry.com> | 2010-01-22 10:45:47 +0000 |
---|---|---|
committer | Petter Reinholdtsen <pere@hungry.com> | 2010-01-22 10:45:47 +0000 |
commit | f88353f2765e303d8ac3e6ee4bfd15d941035100 (patch) | |
tree | 8c74de96c75689490e027d29b22004d8b91c1b04 | |
parent | 37f5d307c7d2f2aacbefd0910f0549b38a9449a1 (diff) |
Give VLC a second to start playing before asking for full screen and
looping.
-rwxr-xr-x | frikanalen/bin/scheduler | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/frikanalen/bin/scheduler b/frikanalen/bin/scheduler index 9c83c19..ac01962 100755 --- a/frikanalen/bin/scheduler +++ b/frikanalen/bin/scheduler @@ -365,18 +365,19 @@ sub vlc_play { push(@cmds, [$vlc->{url} ."requests/status.xml?command=pl_empty", undef]); push(@cmds, [$vlc->{url} ."requests/status.xml?command=in_play&input=$file", undef]); - if ($loop != $vlc->{loop}) { - push(@cmds, [$vlc->{url} . "requests/status.xml?command=pl_repeat", - sub { my $vlc = shift; $vlc->{loop} = ! $vlc->{loop}; }]); - } - if ($fullscreen != $vlc->{fullscreen}) { push(@cmds, [$vlc->{url} . "requests/status.xml?command=fullscreen", - sub { my $vlc = shift; $vlc->{fullscreen} = ! $vlc->{fullscreen}; }]); + sub { my $vlc = shift; $vlc->{fullscreen} = ! $vlc->{fullscreen}; }, + 1]); + } + if ($loop != $vlc->{loop}) { + push(@cmds, [$vlc->{url} . "requests/status.xml?command=pl_repeat", + sub { my $vlc = shift; $vlc->{loop} = ! $vlc->{loop}; }, + 1]); } for my $cmdref (@cmds) { - my ($url, $postfunc) = @{$cmdref}; + my ($url, $postfunc, $presleep, $postsleep) = @{$cmdref}; unless (lwp_get($url)) { print "Failed to contact VLC, restarting\n"; @@ -386,7 +387,9 @@ sub vlc_play { sleep 2; # Give the new one some time to start return vlc_play($vlc, $file, $loop); } elsif (defined $postfunc) { + sleep $presleep if $presleep; $postfunc->($vlc, $url); + sleep $postsleep if $postsleep; } } sleep(1); |