@@ 51-63 (lines=13) @@ | ||
48 | } |
|
49 | if(preg_match(JarvisLanguage::translate('preg_match_stop',get_called_class()), $command)) { |
|
50 | $result = @socket_connect($socket, 'localhost', 9999); |
|
51 | if ($result === false) { |
|
52 | //Error handling |
|
53 | JarvisPHP::getLogger()->warn('Failed to connect!'); |
|
54 | $answer = 'Failed to connect!'; |
|
55 | } |
|
56 | else { |
|
57 | $vlc_remote_command = 'stop'.chr(13); |
|
58 | $vlc_remote_command = 'quit'.chr(13); |
|
59 | socket_write($socket, $vlc_remote_command, strlen($vlc_remote_command)); |
|
60 | socket_close($socket); |
|
61 | JarvisPHP::getLogger()->debug('Radio stopped'); |
|
62 | $answer = 'Radio stopped'; |
|
63 | } |
|
64 | $start_vlc = false; |
|
65 | } |
|
66 | if($start_vlc) { |
|
@@ 74-85 (lines=12) @@ | ||
71 | sleep(1); |
|
72 | ||
73 | $result = @socket_connect($socket, 'localhost', 9999); |
|
74 | if ($result === false) { |
|
75 | //Error handling |
|
76 | JarvisPHP::getLogger()->warn('Failed to connect!'); |
|
77 | $answer = 'Failed to connect!'; |
|
78 | } |
|
79 | else { |
|
80 | $vlc_remote_command = 'add '.$stream_url.chr(13); |
|
81 | socket_write($socket, $vlc_remote_command, strlen($vlc_remote_command)); |
|
82 | socket_close($socket); |
|
83 | JarvisPHP::getLogger()->debug('Radio started'); |
|
84 | $answer = 'Radio started'; |
|
85 | } |
|
86 | } |
|
87 | ||
88 | $response = new \JarvisPHP\Core\JarvisResponse($answer, JarvisPHP::getRealClassName(get_called_class()), true); |