示例#1
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($society, $id)
 {
     $song = song::find($id);
     $song->delete();
     return Redirect::route('society.songs.index', $society)->with('okmessage', 'Song has been deleted');
 }
示例#2
0
 switch ($_GET['action']) {
     case 'load':
         $result = mysql_query("TRUNCATE `" . $database_table_prefix . "artist`");
         $result = mysql_query("TRUNCATE `" . $database_table_prefix . "album`");
         $result = mysql_query("TRUNCATE `" . $database_table_prefix . "song`");
         if (!file_exists('Library.xml')) {
             die('<p>Export your iTunes music library as <strong>Library.xml</strong> and place it in this directory.</p>');
         }
         $data = simplexml_load_file('Library.xml');
         if (!$data) {
             die('<p>Error loading iTunes data.');
         }
         $properties = array('Name', 'Artist', 'Album', 'Rating', 'Play Count');
         $count = 0;
         foreach ($data->dict->dict->dict as $tune) {
             $song = new song();
             $next = false;
             foreach ($tune as $property) {
                 if ($next != false) {
                     // this is such an ugly hack, but otherwise the data was still in a simpleXMLObject
                     // and I didn't know how to get it out - somebody help me out here
                     ob_start();
                     print $property;
                     $song->{$next} = ob_get_contents();
                     ob_end_clean();
                 }
                 if (in_array($property, $properties)) {
                     $next = strtolower(str_replace(' ', '_', $property));
                 } else {
                     $next = false;
                 }
示例#3
0
 public function for_song()
 {
     $error = array();
     $song_clem = DB::connection('clem')->query('SELECT title, album, artist, albumartist, year, genre, filename,track FROM songs');
     foreach ($song_clem as $value) {
         /* AJOUT D'ARTISTES */
         if (trim($value->artist) != '') {
             $band = new Band(null, 1, utf8_encode($value->artist), null, null);
             try {
                 $band->add();
             } catch (Exception $e) {
                 $this->_error_msg .= 'artiste :' . $e->getMessage() . '<br>';
                 break;
             }
         }
         /* AJOUT D'ALBUM */
         if (trim($value->album) != '') {
             $name_band = Band::from_name_band(utf8_encode($value->artist));
             $album = new Album(null, $name_band[0]->id_band, 1, utf8_encode($value->album), $value->year);
             try {
                 $album->add();
             } catch (Exception $e) {
                 $this->_error_msg .= 'album: ' . $e->getMessage() . '<br>';
                 break;
             }
         }
         if (trim($value->title) != '') {
             $album = Album::from_name_album(utf8_encode($value->album));
             $song = new song(null, 1, utf8_encode($value->title), $value->year, null, $value->filename, $value->track);
             $song->set_id_kind(explode(';', $value->genre));
             $song->id_album = $album[0]->id_album;
             try {
                 $song->add();
             } catch (Exception $e) {
                 $this->_error_msg .= 'chanson: ' . $e->getMessage() . '<br>';
                 break;
             }
         }
     }
     // var_dump($song_clem);
 }
示例#4
0
 private function prepareURIRequest($song, $prefix)
 {
     if ($song == null) {
         return null;
     }
     $songUrl = $song['link'];
     $songId = preg_replace('/(.+)\\/oid\\/(\\d+)\\/(.+)/i', '${2}', $songUrl);
     $song = new song($songId);
     $song->format();
     $songItem = Upnp_Api::_itemSong($song, '');
     $domDIDL = Upnp_Api::createDIDL($songItem);
     $xmlDIDL = $domDIDL->saveXML();
     return array('InstanceID' => 0, $prefix . 'URI' => $songUrl, $prefix . 'URIMetaData' => htmlentities($xmlDIDL));
 }
示例#5
0
if ($fp_rbs) {
    fputs($fp_rbs, "GET /7.html HTTP/1.0\r\nUser-Agent: XML Getter (Mozilla Compatible)\r\n\r\n");
    while (!feof($fp_rbs)) {
        $page .= fgets($fp_rbs, 1000);
    }
    fclose($fp_rbs);
    $page = ereg_replace(".*<body>", "", $page);
    $page = ereg_replace("</body>.*", "", $page);
    $numbers = explode(",", $page);
    $shoutcast_currentlisteners = $numbers[0];
    $connected = $numbers[1];
    $shoutcast_peaklisteners = $numbers[2];
    $shoutcast_maxlisteners = $numbers[3];
    $shoutcast_reportedlisteners = $numbers[4];
    $shoutcast_bitrate = $numbers[5];
    $shoutcast_cursong_rbs = song::songR($numbers);
    //$numbers[6];
    $shoutcast_curbwidth = $shoutcast_bitrate * $shoutcast_currentlisteners;
    $shoutcast_peakbwidth = $shoutcast_bitrate * $shoutcast_peaklisteners;
}
// Class zum auslesen des Modi's über api sc_trans 2
class transRlf
{
    var $host;
    var $port;
    var $adminpass;
    var $adminuser;
    function getInfoTrans($option)
    {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, 'http://' . $this->adminuser . ':' . $this->adminpass . '@' . $this->host . ':' . $this->port . '/api');