blob: 04aab371a1cde0e2a5a94472085d827168f453f1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
#!/usr/bin/perl -w
# Author: Jarle Bjørgeengen
# Date: 2009-03-01
# License: GNU General Public license
# Script for å levere inkeltvideoer basert på $Id
#
# http://wiki.nuug.no/grupper/video/pubfrikanalen
use strict;
use warnings;
use XML::Simple;
use CGI qw/:standard/;
use URI::Escape;
binmode STDOUT, ":utf8";
my $query = new CGI;
my $nuug_frikanalen_url = 'http://www.nuug.no/pub/video/frikanalen/';
my $videoid = $query->param("videoId");
my $playlist = $query->param("playlist");
my $lengde;
my $metainfo = "/home/ftp/pub/video/frikanalen/meta.xml";
my $ref = XMLin($metainfo);
my $id = "id_$videoid";
my $duration = $ref->{$id}->{'Length'};
if (! exists $ref->{$id} ) {
print STDERR "Unable to look up $id\n";
}
my $title = $ref->{$id}->{Title};
my $description = $ref->{$id}->{Description};
my $organization = $ref->{$id}->{Organization};
my $org_escaped = uri_escape($organization);
my $length = int($ref->{$id}->{Length});
my $seconds = ($length%60);
my $minutes = int(($length%3600)/60);
my $hours = int($length/3600);
my $date = $ref->{$id}->{UploadDate};
$date =~ s/T.+$//;
my $tonoflag = $ref->{$id}->{HasTonoRecords};
my $tonostatus;
if ("false" eq $tonoflag) {
$tonostatus = "Innhold krever ikke tono-betaling";
} else {
$tonostatus = "Innhold krever tono-betaling";
}
my $ogvurl = $ref->{$id}->{ogvUri};
my $wmvurl = $ref->{$id}->{VideoUri};
my $playlisturl = $nuug_frikanalen_url . url(-relative=>1) . "?playlist=$videoid.m3u" ;
my $imageuri = $ref->{$id}->{'ImageUri'};
if ($hours) {
$lengde = (sprintf('%2dt %2dm',$hours,$minutes));
} else {
$lengde = (sprintf('%2dm %2ds', $minutes, $seconds));
}
if ($playlist) {
$playlist =~ /(^.+)\.m3u/;
my $id = "id_$1";
my $ogvurl = $ref->{$id}->{ogvUri};
print "Content-type: audio/x-mpegurl\n\n";
print "$ogvurl\n";
exit 0;
} else {
print "Content-type: text/html; charset=UTF-8\n\n";
my $html_video_start;
my $html_video_end;
if ($ENV{'HTTP_USER_AGENT'} =~ m/Opera/i || $ENV{'HTTP_USER_AGENT'} =~ m/firefox/i) {
$html_video_start = '<video id="video" controls="true" autoplay="false">';
$html_video_start .= "<source src=\"$videoid.ogv\" width=\"640\" height=\"360\">";
$html_video_start .= '<object id="video" data="video.m3u" type="audio/x-mpegurl" border="1" width="640" height="360" >';
$html_video_end = '</object>';
$html_video_end .= '</video>';
}
print <<"EOF";
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Frikanalen - med åpne standarder</title>
<link href="style1.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="page">
<div id="top"><img src="logo.png" alt="Frikanalen">
<p id="av"><span class="overskrift">TV FOR ALLE</span><br>
Dette er en alternativ presentasjon av filmene som sendes på
<a href="http://www.frikanalen.no/">Frikanalen</a> i Norge.
Denne alternative presentasjonen benytter åpne standarder og er laget av
<a href="http://www.nuug.no/">NUUG</a>s videogruppe.</p>
<table border="0" cellpadding="0" cellspacing="0" id="custom-menu">
<tbody>
<tr>
<td><a href="http://www.frikanalen.no/om"><img alt="OM FRIKANALEN" src="om.png"></a></td>
<td><a href="http://www.frikanalen.no/lage-tv"><img alt="LAGE TV PÅ FRIKANALEN" src="lage-tv.png"></a></td>
<td><a href="http://www.frikanalen.no/se"><img alt="SE PÅ FRIKANALEN" src="se.png"></a></td>
</tr>
</tbody>
</table>
</div>
<div id="content_video">
<h1>$title</h1>
<p>$description</p>
<p><b>Organisasjon:</b> <a href="frontpage.cgi?organization=$org_escaped">$organization</a></p>
$html_video_start
<applet code="com.fluendo.player.Cortado.class"
archive="http://www.nuug.no/pub/video/frikanalen/bin/cortado-unsigned-20100814.jar"
width="640" height="360">
<param name="url" value="$ogvurl"/>
<param name="local" value="false"/>
<param name="showStatus" value="show"/>
<param name="bufferSize" value="500"/>
<param name="duration" value="$duration"/>
<param name="keepaspect" value="true"/>
<img src="$imageuri" width="640" height="320" border="0" alt="preview">
</applet>
$html_video_end
<p><table cellpadding=5>
<tr><td>Lengde:</td><td> $lengde </td></tr>
<tr><td>Dato:</td><td> $date </td></tr>
<tr><td rowspan="2">$tonostatus</td></tr>
</table>
<p>Dersom du ikke ser noe video på denne siden, har du en nettleser uten fungerende java-støtte. Følgende lenker kan benyttes dersom dette er tilfelle, eller du ønsker mere kontroll på søking (playlist url) eller laste ned hele filen (Ogg Theora) . Vi har også lagt inn direktelink til Windows Media url på frikanalen sin side.
<p>Video URLs:
<br><a href="$playlisturl">Playlist url (m3u) </a>for ekstern avspiller. <a href="http://www.videolan.org">(VLC fungerer godt på alle platformer .)</a>
<br><a href="$ogvurl">Ogg Theora</a>
<br><a href="$wmvurl">Windows Media</a>
<br><a href="frontpage.cgi">Tilbake</a></p>
</div>
<div id="footer">
© 2009 Foreningen Frikanalen, design
<a href="http://www.wildweb.no" target="_blank">Wild Web</a>
</div>
</div>
</body>
</html>
EOF
}
|