コード例 #1
0
         $time = round($getid3->info['playtime_seconds']);
         $size = filesize($fullname);
         $addtime = time();
         $sqlfullname = str_replace("\\", "\\\\", $fullname);
         if ($title == "") {
             $title = $filename;
         }
         $catalog_obj = $as->getCatalogFromName($user, $password, $catalog);
         $catalog_id = $catalog_obj['id'];
         $album_obj = $as->getAlbumFromName($user, $password, $album);
         if ($album_obj['id'] == "") {
             $album_id = $as->createAlbum($user, $password, $album, $year);
         } else {
             $album_id = $album_obj['id'];
         }
         $artist_obj = $as->getArtistFromName($user, $password, $artist);
         if ($artist_obj['id'] == "") {
             $artist_id = $as->createArtist($user, $password, $artist);
         } else {
             $artist_id = $artist_obj['id'];
         }
         $song_obj = $as->getSongFromData($user, $password, $title, $artist_id, $album_id, $year);
         if ($song_obj['id'] == "") {
             $song_id = $as->createSong($user, $password, $sqlfullname, $catalog_id, $album_id, $year, $artist_id, $title, $bitrate, $rate, $size, $time, $addtime);
         } else {
             $song_id = $song_obj['id'];
         }
     } catch (Exception $e) {
         echo 'An error occured: ' . $e->message;
     }
 }