-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtunezd.php
68 lines (57 loc) · 2.29 KB
/
tunezd.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
<?php
# tunezd.php
#
# This is the Tunez PHP daemon
/*
* tunez
*
* Copyright (C) 2003, Ivo van Doesburg <idoesburg@outdare.nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
error_reporting(E_ALL ^ E_NOTICE);
$justdb = TRUE;
/* YOU MUST SET THIS TO YOUR tunez.inc.php path!!! */
require("/path/to/your/tunez.inc.php");
/***************************************************/
require_once($_CONF['path_system'] . "classes/song.class.php");
if ($_CONF['mode'] != "shout-php" && $_CONF['mode'] != "local-php") {
die("You should not be using this php script unless you are in shout-php or local-php mode");
}
$queue = new PQueue($_CONF['random_query'], $_CONF['valid_extensions']);
$queue->generate_from_votes();
while(1) {
$queue->read();
$songid = $queue->dequeue();
$song = new song($songid, NULL);
$song->read_data_from_db("filename,type");
if ($_CONF['mode'] == "local-php") {
if($song->type == "mp3" || $song->type == "id3")
$cmd = $_CONF['mpg123_binary'] . " -b 1024 \"$song->filename\" > /dev/null 2> /dev/null";
elseif($song->type == "ogg")
$cmd = $_CONF['ogg123_binary'] . " -b 1024 \"$song->filename\" > /dev/null 2> /dev/null";
else //assuming it's an MP3
$cmd = $_CONF['mpg123_binary'] . " -b 1024 \"$song->filename\" > /dev/null 2> /dev/null";
}
elseif ($_CONF['mode']=="shout-php")
$cmd = $_CONF['shoutcast_binary'] . " -x -3 -t -P " . $_CONF['icecast_v1_password'] . " "
. $_CONF['icecast_v1_host'] . " \"$song->filename\" > /dev/null 2> /dev/null";
else
die("invalid mode");
system($cmd);
}
mysql_close();
?>