~ubuntu-branches/ubuntu/precise/mythexport/precise

« back to all changes in this revision

Viewing changes to usr/share/mythtv/mythexport/player.cgi

  • Committer: Bazaar Package Importer
  • Author(s): John Baab
  • Date: 2010-08-13 01:53:54 UTC
  • mfrom: (1.1.16 upstream)
  • Revision ID: james.westby@ubuntu.com-20100813015354-h2w1q6caq1mlv5vo
Tags: 2.2.0-0ubuntu1
* FFe (LP: #617570).
* Added HTML5 streaming page to web interface.
* New device config method. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl
 
2
 
 
3
use strict;
 
4
use CGI qw(:standard);
 
5
use HTML::Template;
 
6
use Config::Simple;
 
7
use MythTV;
 
8
 
 
9
require includes;
 
10
 
 
11
my $connect = undef;
 
12
my $file = "/etc/mythtv/mythexport/mythexport.cfg";
 
13
my ($script,$content) = "";
 
14
my $template = HTML::Template->new(filename => 'template/html5.tmpl');
 
15
 
 
16
# if we have a valid config
 
17
if(-e $file && -s $file > 5){
 
18
    my $cfg = new Config::Simple();
 
19
    $cfg->read($file) || die $cfg->error();
 
20
 
 
21
    my $myth = new MythTV();
 
22
    # connect to database
 
23
    $connect = $myth->{'dbh'};
 
24
 
 
25
    my $id = param("id");
 
26
 
 
27
    # find the exported recordings
 
28
    my $query = "SELECT file FROM mythexport where id=?";
 
29
    my $query_handle = $connect->prepare($query);
 
30
    $query_handle->execute($id)  || die "Unable to query mythexport table";
 
31
 
 
32
    $content = "<p>This page is a work in progress, it may work for your Anroid device or iPhone.<br />";
 
33
 
 
34
    while ( my $file = $query_handle->fetchrow_array() ) {
 
35
            $content .= "<video width=\"480\" height=\"320\" autobuffer controls onClick=\"this.play();\">
 
36
        <source  src=\"/mythexport/video/$file\" /></video>";
 
37
    }
 
38
 
 
39
    $content .= "</p>";
 
40
}
 
41
else{
 
42
    $content = "<p>Missing or Invalid configuration file, please create one.</p>";
 
43
}
 
44
 
 
45
$template->param(CONTENT => $content);
 
46
 
 
47
print generateContentType(), $template->output;
 
48
exit(0);