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

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): John Baab
  • Date: 2010-08-13 01:53:54 UTC
  • mfrom: (19 lucid)
  • mto: This revision was merged to the branch mainline in revision 20.
  • Revision ID: james.westby@ubuntu.com-20100813015354-pb6w02upqqnegsep
Tags: upstream-2.2.0
ImportĀ upstreamĀ versionĀ 2.2.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/perl
2
2
 
3
3
use strict;
 
4
use lib '/usr/share/mythexport/configs';
 
5
use lib '/usr/share/mythexport';
4
6
use CGI qw(:standard);
5
7
use HTML::Template;
 
8
use MythTV;
6
9
 
7
10
require includes;
8
11
 
9
 
my $content = "<form action=\"setup_details.cgi\" method=\"post\"><p>";
 
12
my $myth = new MythTV();
 
13
my $connect = undef;
 
14
# connect to database
 
15
$connect = $myth->{'dbh'};
 
16
 
 
17
my $dir = '/usr/share/mythexport/configs';
10
18
 
11
19
my $template = HTML::Template->new(filename => 'template/template.tmpl');
12
20
 
13
 
$content .= "Choose a Device:<br />
14
 
<input type=\"radio\" id=\"cowon\" name=\"device\" value=\"cowon\" /> Cowon<br />
15
 
<input type=\"radio\" id=\"android\" name=\"device\" value=\"android\" /> Android<br />
16
 
<input type=\"radio\" id=\"ipod\" name=\"device\" value=\"ipod\" /> iPod<br />
17
 
<input type=\"radio\" id=\"psp\" name=\"device\" value=\"psp\" /> PSP<br />
18
 
<input type=\"radio\" id=\"archos\" name=\"device\" value=\"archos\" /> Archos<br />
19
 
<input type=\"radio\" id=\"zune\" name=\"device\" value=\"zune\" /> Zune<br />
20
 
<input type=\"radio\" id=\"xbox360\" name=\"device\" value=\"xbox360\" /> Xbox 360<br />
21
 
<input type=\"radio\" id=\"laptop\" name=\"device\" value=\"laptop\" /> Laptop<br />
22
 
<input type=\"radio\" id=\"mp3\" name=\"device\" value=\"mp3\" /> mp3<br />
23
 
<input type=\"radio\" id=\"symlink\" name=\"device\" value=\"symlink\" /> Symlink<br />
24
 
<input type=\"radio\" id=\"custom\" name=\"device\" value=\"custom\" /> Custom<br />
25
 
<input type=\"submit\" id=\"submit\" name=\"submit\" value=\"Submit\" /><br /><br />
26
 
- or -<br /><br />
27
 
<a href=\"setup_edit.cgi\">Edit an existing configuration</a>
 
21
# find the user jobs
 
22
my $query = "SELECT data from settings where value like ?";
 
23
my $query_handle = $connect->prepare($query);
 
24
$query_handle->execute("UserJobDesc%")  || die "Unable to query mythexport_job_queue table";
 
25
 
 
26
opendir(my $dh, $dir) || die "can't opendir $dir: $!";
 
27
my @modules = grep { /\.pm/ && -f "$dir/$_" } readdir($dh);
 
28
 
 
29
my $content = "<form action=\"newsetupsave.cgi\" method=\"post\"><p>
 
30
    Choose a Configuration:<br /><table border=\"1\">
 
31
    <tr><th>&nbsp;</th><th>Name</th><th>Description</th><th>Devices</th><th>Notes</th></tr>";
 
32
 
 
33
 
 
34
foreach my $config (@modules) {
 
35
    next if $config eq "ExportBase.pm";
 
36
    (my $class = $config) =~ s/.pm//;
 
37
    require $config;
 
38
 
 
39
    my $object = new $class();
 
40
    my $description = $object->Description();
 
41
    my $devices = $object->Devices();
 
42
    my $notes = $object->Notes();
 
43
    
 
44
    $content .= "<tr><td><input type=\"checkbox\" name=\"config\" id=\"$class\" value=\"$class\" /></td>
 
45
        <td>$class</td><td>$description</td><td>$devices</td><td>$notes</td></tr>";
 
46
}
 
47
 
 
48
$content .= "</table><br />";
 
49
 
 
50
$content .= "Select a User Jobs:<br />";
 
51
my $i = 1;
 
52
while(my ($description) = $query_handle->fetchrow_array()) {
 
53
    $content .= "<input type=\"radio\" id=\"radio$i\" name=\"userjob\" value=\"$i\" />$description<br />";
 
54
    $i++;
 
55
}
 
56
 
 
57
$content .= "Description: <input type=\"text\" id=\"description\" name=\"description\" value=\"\" /><br />
 
58
<span style=\"color:red;\">*WARNING: Proceeding will overwrite any data for this User Job</span><br /><br />
 
59
Delete Period: <input type=\"text\" id=\"deletePeriod\" name=\"deletePeriod\" value=\"\" />&nbsp;(number of days to keep exported files, empty will never delete)<br />
 
60
Podcast Name: <input type=\"text\" id=\"podcastName\" name=\"podcastName\" value=\"\" />&nbsp;(optional)<br /><br />
 
61
<input type=\"submit\" id=\"submit\" name=\"submit\" value=\"Submit\" />
28
62
</p></form>";
29
63
 
30
64
$template->param(CONTENT => $content);