xref: /openbmc/openbmc/meta-openembedded/meta-webserver/recipes-webadmin/webmin/files/media-tomb.patch (revision 8e7b46e2350c3689938f309eaca929aada20b5a0)
1add mediatomb support
2
3Upstream-Status: Pending
4Signed-off-by: Khem Raj <raj.khem@gmail.com>
5diff -Nru webmin-1.570.bak/mediatomb/index.cgi webmin-1.570/mediatomb/index.cgi
6--- webmin-1.570.bak/mediatomb/index.cgi	1969-12-31 16:00:00.000000000 -0800
7+++ webmin-1.570/mediatomb/index.cgi	2011-10-26 10:00:05.992522036 -0700
8@@ -0,0 +1,13 @@
9+#!/usr/bin/perl
10+# index.cgi
11+# Display MediaTomb option categories
12+
13+require './mediatomb-lib.pl';
14+
15+ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1);
16+
17+
18+$ipaddress = &get_my_address();
19+print &text('index_desc', $ipaddress),"<p>\n";
20+
21+ui_print_footer("/", $text{'index'});
22diff -Nru webmin-1.570.bak/mediatomb/lang/en webmin-1.570/mediatomb/lang/en
23--- webmin-1.570.bak/mediatomb/lang/en	1969-12-31 16:00:00.000000000 -0800
24+++ webmin-1.570/mediatomb/lang/en	2011-10-26 10:01:13.340522186 -0700
25@@ -0,0 +1,2 @@
26+index_title=MediaTomb
27+index_desc=MediaTomb is an open source (GPL) UPnP MediaServer with a nice web user interface. You can access it via <a href='http://$1:49153'>here</a>.
28diff -Nru webmin-1.570.bak/mediatomb/mediatomb-lib.pl webmin-1.570/mediatomb/mediatomb-lib.pl
29--- webmin-1.570.bak/mediatomb/mediatomb-lib.pl	1969-12-31 16:00:00.000000000 -0800
30+++ webmin-1.570/mediatomb/mediatomb-lib.pl	2011-10-26 10:01:34.692522079 -0700
31@@ -0,0 +1,31 @@
32+#!/usr/bin/perl
33+# mediatomb-lib.pl
34+# Common functions for the MediaTomb module
35+
36+BEGIN { push(@INC, ".."); };
37+use WebminCore;
38+&init_config();
39+
40+sub get_my_address
41+{
42+my $myip;
43+if (&foreign_check("net")) {
44+        # Try to get ethernet interface
45+        &foreign_require("net", "net-lib.pl");
46+        my @act = &net::active_interfaces();
47+        my @ifaces = grep { &net::iface_type($_->{'fullname'}) =~ /ether/i }
48+                          @act;
49+        @ifaces = ( $act[0] ) if (!@ifaces && @act);
50+        if (@ifaces) {
51+                return wantarray ? ( map { $_->{'address'} } @ifaces )
52+                                 : $ifaces[0]->{'address'};
53+                }
54+        }
55+$myip = &to_ipaddress(&get_system_hostname());
56+if ($myip) {
57+        # Can resolve hostname .. use that
58+        return wantarray ? ( $myip ) : $myip;
59+        }
60+return wantarray ? ( ) : undef;
61+}
62+
63diff -Nru webmin-1.570.bak/mediatomb/module.info webmin-1.570/mediatomb/module.info
64--- webmin-1.570.bak/mediatomb/module.info	1969-12-31 16:00:00.000000000 -0800
65+++ webmin-1.570/mediatomb/module.info	2011-10-26 09:59:50.428528369 -0700
66@@ -0,0 +1,3 @@
67+desc=MediaTomb
68+category=others
69+longdesc=MediaTomb access module
70