-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathplayer.php
More file actions
executable file
·72 lines (61 loc) · 1.68 KB
/
player.php
File metadata and controls
executable file
·72 lines (61 loc) · 1.68 KB
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
#!/usr/bin/php
<?php
require('config.php');
$o = $argv[1];
if($o == '--play'){
$Player = new Player();
$song_bank = $Player->loadSession();
while(TRUE){
$out = $Player->playNext($song_bank);
$song_bank = $out['song_bank'];
$play_cmd = "omxplayer " . escapeshellarg($out['path']);
echo "playing {$out['path']} \n";
exec($play_cmd);
}
}
if($o == '--reset' || $o == '--hard-reset'){
echo "resetting play count\n";
$Song = new Song();
$Song->resetPlayCount();
}
if($o == '--hard-reset'){
echo "clearing queue\n";
$Queue = new Queue();
$Queue->clear();
}
if($o == '--setup' || $o == '--hard-reset'){
$Song = new Song();
$Player = new Player();
echo 'indexing ' . MUSIC_DIRECTORY . "\n";
$Song->scanMusicDir();
$song_bank = $Player->loadSession();
echo "\ngenerating queue\n";
for($i=0;$i<7;$i++){
echo '.';
$song_bank = $Player->addHeat($song_bank);
}
}
if($o == '--show-songs'){
$Song = new Song();
$song_bank = $Song->getAll();
echo print_r($song_bank,TRUE);
}
if($o == '--show-queue'){
$Queue = new Queue();
$song_bank = $Queue->getAll();
echo print_r($song_bank,TRUE);
}
if($o == '--help'){
echo"--play \tstart normal play\n";
echo"--setup \trun to re-index music dir\n";
echo"--reset \tset play count to all songs to 0\n";
echo"--hard-reset \tclear queue set play count to 0 and reindex\n";
echo"--show-songs \tshow songs without play count\n";
echo"--first \tplay first bride groom dance\n";
echo"--bride-dad \tplay bride father dance\n";
echo"--garter \tplay garter toss song\n";
echo"--bouquet \tplay bouquet toss song\n";
echo"addr: \t\thttp://" . exec("ifconfig | grep 192.168 | cut -d':' -f2 | cut -d' ' -f1") . "/webJukeboxLocal\n";
}
echo "\n";
?>