-
Notifications
You must be signed in to change notification settings - Fork 0
/
webgui.php
80 lines (77 loc) · 2.18 KB
/
webgui.php
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>NRK</title>
</head>
<body>
<?Php
ini_set('display_errors',1);
error_reporting(E_ALL);
ini_set('max_execution_time',0);
require 'functions.php';
$nrk=new nrkripper;
$starttime=time();
function checkboxvalue($field)
{
if(isset($_POST[$field]) && !empty($_POST[$field]))
return 'checked="checked"';
}
function boolfield($field)
{
if(isset($_POST[$field]) && !empty($_POST[$field]))
return true;
else
return false;
}
?>
<form id="form1" name="form1" method="post" action="">
<p>
Hva skal rippes?
<select name="mode" id="mode">
<option value="episode" <?Php if(!isset($_POST['script']) || $_POST['script']=='episode') echo 'selected="selected"'; ?>>Enkelt program/episode</option>
<option value="serie" <?Php if(isset($_POST['script']) && $_POST['script']=='serie') echo 'selected="selected"'; ?>>Hel serie</option>
</select>
</p>
<p>URL til serie eller episode:
<input name="source" type="text" id="source" value="<?Php if(isset($_POST['source'])) echo $_POST['source']; ?>" />
</p>
<p>
<input type="submit" name="button" id="button" value="Submit" />
</p>
</form>
<?Php
if(isset($_POST['button']))
{
$error='';
$source=$_POST['source'];
if(empty($source))
$error.="URL til spilleliste eller album er ikke opgitt<br />\n";
$compilation=boolfield('compilation');
$albumfolders=boolfield('albumfolders');
$artistalbumfolder=boolfield('artistalbumfolder');
$covername=boolfield('covername');
if(!empty($error))
die("Følgende feil oppstod:<br />\n$error");
if($_POST['mode']=='episode')
{
$status=$nrk->nrkrip($_POST['source'],$nrk->config['outpath']);
if($status!==false)
var_dump($status);
else
echo $nrk->error;
}
elseif($_POST['mode']=='serie')
{
//echo nl2br($nrk->serierip($url));
$argv[1]=$_POST['source'];
require 'serie.php';
}
}
$endtime=time();
echo "Scriptet startet $starttime og ble ferdig $endtime og har brukt ";
echo $endtime-$starttime;
echo " sekunder";
?>
</body>
</html>