1 | 58a57,59
|
---|
2 | > // Someday, music.php will let us stream
|
---|
3 | > // entire playlists to any spot on planet earth
|
---|
4 | > //
|
---|
5 | 62,77c63
|
---|
6 | <
|
---|
7 | < if( $_GET['playAll']){
|
---|
8 | < header("Content-type:audio/x-mpegurl");
|
---|
9 | < // generate m3u playlist
|
---|
10 | < $mythmusic->generateM3U();
|
---|
11 | < }elseif( $_GET['play']){
|
---|
12 | < // set header to be a playlist
|
---|
13 | < header("Content-type:audio/x-mpegurl");
|
---|
14 | < $mythmusic->playItem();
|
---|
15 | < }else {
|
---|
16 | < $mythmusic->display();
|
---|
17 | < }
|
---|
18 | <
|
---|
19 | <
|
---|
20 | <
|
---|
21 | <
|
---|
22 | ---
|
---|
23 | > $mythmusic->display();
|
---|
24 | 103d88
|
---|
25 | < var $streamfilename;
|
---|
26 | 108d92
|
---|
27 | <
|
---|
28 | 111,114d94
|
---|
29 | <
|
---|
30 | < // phpinfo();
|
---|
31 | <
|
---|
32 | <
|
---|
33 | 162,164d141
|
---|
34 | <
|
---|
35 | <
|
---|
36 | <
|
---|
37 | 182,186d158
|
---|
38 | < $this->streamfilename='';
|
---|
39 | <
|
---|
40 | < $first_dir = 1 ;
|
---|
41 | <
|
---|
42 | <
|
---|
43 | 190d161
|
---|
44 | <
|
---|
45 | 192,202d162
|
---|
46 | <
|
---|
47 | < if($first_dir){
|
---|
48 | < $this->streamfilename = $this->streamfilename.rawurlencode(utf8tolocal($dir));
|
---|
49 | < //$this->streamfilename = $this->streamfilename.$dir;
|
---|
50 | < $first_dir = 0 ;
|
---|
51 | < }else {
|
---|
52 | < $this->streamfilename = $this->streamfilename.'/'.rawurlencode(utf8tolocal($dir));
|
---|
53 | < //$this->streamfilename = $this->streamfilename.'/'.$dir;
|
---|
54 | < }
|
---|
55 | <
|
---|
56 | <
|
---|
57 | 206,213c166
|
---|
58 | < }
|
---|
59 | < // need to split it since otherwise the / will be urlencoded
|
---|
60 | < $file_array = preg_split('/\//', $_GET['play']);
|
---|
61 | < foreach($file_array as $file_item){
|
---|
62 | < $file_str = $file_str.'/'.rawurlencode($file_item);
|
---|
63 | < }
|
---|
64 | <
|
---|
65 | <
|
---|
66 | ---
|
---|
67 | > }
|
---|
68 | 218,265d170
|
---|
69 | < function playItem(){
|
---|
70 | <
|
---|
71 | <
|
---|
72 | < // need to split it since otherwise the / will be urlencoded
|
---|
73 | < $file_array = preg_split('/\//', $_GET['play']);
|
---|
74 | < foreach($file_array as $file_item){
|
---|
75 | < $file_str = $file_str.'/'.rawurlencode($file_item);
|
---|
76 | < }
|
---|
77 | <
|
---|
78 | < printf("http://%s:%s/%s/%s\n",
|
---|
79 | < $_SERVER["SERVER_NAME"],
|
---|
80 | < $_SERVER["SERVER_PORT"] ,
|
---|
81 | < "mythweb/data/music",
|
---|
82 | < $file_str);
|
---|
83 | <
|
---|
84 | < // stop here since we only generating a playlist
|
---|
85 | < exit;
|
---|
86 | <
|
---|
87 | < }
|
---|
88 | <
|
---|
89 | < function generateM3U()
|
---|
90 | < {
|
---|
91 | <
|
---|
92 | < printf("#EXTM3U\n");
|
---|
93 | <
|
---|
94 | < // A big number since we dont want to limit the number of items in playlist
|
---|
95 | < $this->init(10000);
|
---|
96 | < if($this->totalCount > 0)
|
---|
97 | < {
|
---|
98 | < while($this->readRow())
|
---|
99 | < {
|
---|
100 | < printf("#EXTINF:%d,%s-%s\n", (int)(((int)$this->length)/1000),$this->artist,$this->title);
|
---|
101 | < printf("http://%s:%s/%s/%s\n",
|
---|
102 | < $_SERVER["SERVER_NAME"],
|
---|
103 | < $_SERVER["SERVER_PORT"] ,
|
---|
104 | < "mythweb/data/music",
|
---|
105 | < $this->streamfilename);
|
---|
106 | <
|
---|
107 | < }
|
---|
108 | < }
|
---|
109 | < if($this->result)
|
---|
110 | < mysql_free_result($this->result);
|
---|
111 | <
|
---|
112 | < exit();
|
---|
113 | <
|
---|
114 | < }
|
---|
115 | <
|
---|
116 | <
|
---|
117 | 279,280c184
|
---|
118 | <
|
---|
119 | < $music->printDetail($this->title,$this->length,$this->artist,$this->album,$this->genre,$this->urlfilename,$this->streamfilename);
|
---|
120 | ---
|
---|
121 | > $music->printDetail($this->title,$this->length,$this->artist,$this->album,$this->genre,$this->urlfilename);
|
---|
122 | 387,388d290
|
---|
123 | <
|
---|
124 | <
|
---|