summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVille Skyttä <ville.skytta@iki.fi>2011-05-15 11:14:29 +0300
committerVille Skyttä <ville.skytta@iki.fi>2011-05-15 11:16:48 +0300
commit1a39a06e542ce1691d1815d1dcf2847c99a0c7f0 (patch)
tree94173ce7cb34d69a9139f2a348fa05ac2285c40a
parentf8f0ed2521db01b7180ab7be328884035edcc5f3 (diff)
downloadvdradmin-am-1a39a06e542ce1691d1815d1dcf2847c99a0c7f0.tar.gz
vdradmin-am-1a39a06e542ce1691d1815d1dcf2847c99a0c7f0.tar.bz2
Use default streamdev host from browser URL when VDR host is localhost.
http://projects.vdr-developer.org/issues/642
-rw-r--r--HISTORY3
-rw-r--r--README1
-rwxr-xr-xinstall.sh1
-rwxr-xr-xvdradmind.pl43
4 files changed, 24 insertions, 24 deletions
diff --git a/HISTORY b/HISTORY
index a30ac92..22e4447 100644
--- a/HISTORY
+++ b/HISTORY
@@ -4,12 +4,13 @@ E-Mail: mail AT andreas DOT vdr-developer DOT org
VDR-Portal: amair
-----------------------------------------------------------
-2010-xx-xx: 3.6.x
+2011-xx-xx: 3.6.x
- Updated: Dutch translation (Submitted by Roel Koelewijn).
- Updated: Finnish translation (Ville Skyttä).
- Improved: Access logging (Ville Skyttä).
- Improved: SVDRP connection error handling/logging/messages (Ville Skyttä).
- Improved: Default SVDRP port is 6419 in initial config if locally installed VDR is >= 1.7.15 (Ville Skyttä).
+- Improved: Use default streamdev host from browser URL when VDR host is localhost (Ville Skyttä).
2010-04-10: 3.6.7
- Updated: Italian translation (Submitted by Diego Pierotto).
diff --git a/README b/README
index 910a2f3..1f1cc87 100644
--- a/README
+++ b/README
@@ -47,6 +47,7 @@ Requirements
- Time::Local
- MIME::Base64
- File::Temp
+ - URI
- URI::Escape
- Locale::gettext OR Locale::Messages
- Optional:
diff --git a/install.sh b/install.sh
index 43f06fd..ac1445e 100755
--- a/install.sh
+++ b/install.sh
@@ -86,6 +86,7 @@ function perlModules()
checkPerlModule Time::Local
checkPerlModule MIME::Base64
checkPerlModule File::Temp
+ checkPerlModule URI
checkPerlModule URI::Escape
diff --git a/vdradmind.pl b/vdradmind.pl
index 9f362b5..440b710 100755
--- a/vdradmind.pl
+++ b/vdradmind.pl
@@ -71,6 +71,7 @@ use POSIX qw(:sys_wait_h strftime mktime locale_h);
use MIME::Base64 ();
use File::Temp ();
use Shell qw(locale);
+use URI ();
use URI::Escape qw(uri_escape);
my $can_use_encode = 1;
@@ -5156,26 +5157,24 @@ sub getReferer {
sub live_stream {
my $channel = $q->param("channel");
my $progname = $q->param("progname");
- my ($data, $ifconfig, $ip);
+ my $url;
if ($CONFIG{ST_STREAMDEV_HOST}) {
- $ip = $CONFIG{ST_STREAMDEV_HOST};
+ $url = URI->new("http://$CONFIG{ST_STREAMDEV_HOST}");
} else {
if ($CONFIG{VDR_HOST} =~ /^localhost(\.localdomain)?|127\.0\.0\.1$/i) {
- $ifconfig = `/sbin/ifconfig eth0`;
- if ($ifconfig =~ /inet.+:(\d+\.\d+\.\d+\.\d+)\s+Bcast/) {
- $ip = $1;
- } else {
- $ip = `hostname`;
- }
+ $url = URI->new($q->url(-base => 1));
+ $url->scheme("http");
} else {
- $ip = $CONFIG{VDR_HOST};
+ $url = URI->new("http://$CONFIG{VDR_HOST}");
}
}
- chomp($ip);
- $data = "";
+ $url->port($CONFIG{ST_STREAMDEV_PORT});
+ $url->path($channel);
+
+ my $data = "";
$data .= "#EXTINF:0,$progname\n" if ($progname);
- $data .= "http://$ip:$CONFIG{ST_STREAMDEV_PORT}/$channel\n";
+ $data .= "$url\n";
return (header("200", $CONFIG{TV_MIMETYPE}, $data));
}
@@ -6838,26 +6837,24 @@ sub run_svdrpcmd {
sub export_channels_m3u {
my $wanted = $q->param("wanted");
my @filenames = ( 'vdr_full_channels', 'vdr_selected_channels', 'vdr_tv_channels', 'vdr_radio_channels' );
- my ($ip, $ifconfig);
+
+ my $url;
if ($CONFIG{ST_STREAMDEV_HOST}) {
- $ip = $CONFIG{ST_STREAMDEV_HOST};
+ $url = URI->new("http://$CONFIG{ST_STREAMDEV_HOST}");
} else {
if ($CONFIG{VDR_HOST} =~ /^localhost(\.localdomain)?|127\.0\.0\.1$/i) {
- $ifconfig = `/sbin/ifconfig eth0`;
- if ($ifconfig =~ /inet.+:(\d+\.\d+\.\d+\.\d+)\s+Bcast/) {
- $ip = $1;
- } else {
- $ip = `hostname`;
- }
+ $url = URI->new($q->url(-base => 1));
+ $url->scheme("http");
} else {
- $ip = $CONFIG{VDR_HOST};
+ $url = URI->new("http://$CONFIG{VDR_HOST}");
}
}
- chomp($ip);
+ $url->port($CONFIG{ST_STREAMDEV_PORT});
my $data = "";
foreach (sort({ $a->{vdr_id} <=> $b->{vdr_id} } (@{$CHAN{$wanted}->{channels}}))) {
- $data .= sprintf("#EXTINF:0,%s\nhttp://%s:%s/%s\n", $_->{name}, $ip, $CONFIG{ST_STREAMDEV_PORT}, $_->{uniq_id});
+ $url->path($_->{uniq_id});
+ $data .= sprintf("#EXTINF:0,%s\n%s\n", $_->{name}, $url);
}
return (header("200", $CONFIG{TV_MIMETYPE}, $data, sprintf("%s.%s", $filenames[$wanted], $CONFIG{TV_EXT}) ));
}