10
10
my $connect = undef;
11
my $file = "/etc/mythtv/mythexport/mythexport_settings.cfg";
12
12
my $template = HTML::Template->new(filename => 'template/template.tmpl');
14
my $script = "<script type=\"text/javascript\">//<![CDATA[
15
function showBlocks(){
16
document.getElementById(\"hidden\").style.display=\"block\";
18
function hideBlocks(){
19
document.getElementById(\"hidden\").style.display=\"none\";
23
my $myth = new MythTV();
25
$connect = $myth->{'dbh'};
27
my $cfg = new Config::Simple();
28
$cfg->read('/etc/mythtv/mythexport_settings.cfg');
30
my $block = param("block");
32
my $test = $cfg->as_string();
34
$test =~ s/^(.*?)\[//;
35
$test =~ s/\](.*?)\[/,/g;
36
$test =~ s/\](.*?)$//;
38
my @blocks = split(",", $test);
40
my $query = "SELECT title,subtitle,description,starttime,chanid
41
FROM recorded order by title, subtitle, starttime";
42
my $query_handle = $connect->prepare($query);
43
$query_handle->execute() || die "Unable to query mythexport table";
45
my $content = "<form id=\"form\" action=\"otg_job.cgi\" method=\"post\">
46
<p>Choose a Location: <input type=\"text\" id=\"location\" name=\"location\" value=\"\" /><br />
47
<input type=\"radio\" id=\"otgFull\" name=\"type\" value=\"otgFull\" onclick=\"javascript:hideBlocks();\" checked=\"checked\" />Full Featured
48
<input type=\"radio\" id=\"otgLight\" name=\"type\" value=\"otgLight\" onclick=\"javascript:showBlocks();\" />Lightweight<br />
49
<span id=\"hidden\" style=\"display:none\">Choose an export profile: <select id=\"block\" name=\"block\" onchange=\"javascript:changeBlock();\">";
52
$content .= "<option value=\"$_\"";
54
$content .= " selected=\"selected\"";
56
$content .= ">$_</option>";
58
$content .= "</select><br /></span>Choose recordings to take on the go:
59
<table border=\"1\"><th></th><th>Title</th><th>Description</th><th>Start Time</th>";
61
while ( my ($title,$subtitle,$description,$starttime,$chanid) = $query_handle->fetchrow_array() ) {
62
$content .= "<tr><td><input type=\"checkbox\" name=\"recordings\" value=\"$chanid|$starttime\" /></td>
66
$content .= ": $subtitle";
68
$content .= "<td>$description</td><td>$starttime</td></tr>";
71
$content .= "</table><br />
72
<input type=\"submit\" id=\"submitButton\" name=\"submitButton\" value=\"Submit\" />
13
my ($script,$content) = "";
15
# if we have a valid config
16
if(-e $file && -s $file > 207){
17
$script = "<script type=\"text/javascript\">//<![CDATA[
18
function showBlocks(){
19
document.getElementById(\"hidden\").style.display=\"block\";
21
function hideBlocks(){
22
document.getElementById(\"hidden\").style.display=\"none\";
26
my $myth = new MythTV();
28
$connect = $myth->{'dbh'};
30
my $cfg = new Config::Simple();
31
$cfg->read($file) || die $cfg->error();
33
my $block = param("block");
35
my $test = $cfg->as_string();
37
$test =~ s/^(.*?)\[//;
38
$test =~ s/\](.*?)\[/,/g;
39
$test =~ s/\](.*?)$//;
41
my @blocks = split(",", $test);
43
my $query = "SELECT title,subtitle,description,starttime,chanid
44
FROM recorded order by title, subtitle, starttime";
45
my $query_handle = $connect->prepare($query);
46
$query_handle->execute() || die "Unable to query mythexport table";
48
$content = "<form id=\"form\" action=\"otg_job.cgi\" method=\"post\">
49
<p>Choose a Location: <input type=\"text\" id=\"location\" name=\"location\" value=\"\" /><br />
50
<input type=\"radio\" id=\"otgFull\" name=\"type\" value=\"otgFull\" onclick=\"javascript:hideBlocks();\" checked=\"checked\" />Full Featured
51
<input type=\"radio\" id=\"otgLight\" name=\"type\" value=\"otgLight\" onclick=\"javascript:showBlocks();\" />Lightweight<br />
52
<span id=\"hidden\" style=\"display:none\">Choose an export profile: <select id=\"block\" name=\"block\" onchange=\"javascript:changeBlock();\">";
55
$content .= "<option value=\"$_\"";
57
$content .= " selected=\"selected\"";
59
$content .= ">$_</option>";
61
$content .= "</select><br /></span>Choose recordings to take on the go:
62
<table border=\"1\"><th></th><th>Title</th><th>Description</th><th>Start Time</th>";
64
while ( my ($title,$subtitle,$description,$starttime,$chanid) = $query_handle->fetchrow_array() ) {
65
$content .= "<tr><td><input type=\"checkbox\" name=\"recordings\" value=\"$chanid|$starttime\" /></td>
69
$content .= ": $subtitle";
71
$content .= "<td>$description</td><td>$starttime</td></tr>";
74
$content .= "</table><br />
75
<input type=\"submit\" id=\"submitButton\" name=\"submitButton\" value=\"Submit\" />
79
$content = "<p>Missing or Invalid configuration file, please create one.</p>";
75
82
$template->param(SCRIPT => $script);
76
83
$template->param(CONTENT => $content);
77
84
$template->param(LOCATION => "otg");
79
86
print generateContentType(), $template->output;
b'\\ No newline at end of file'