From cbf8f822de35748e079df695dd322ada32d02f69 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 1 Aug 2011 00:32:44 +0200 Subject: automatically scan songs that are played from the filebrowser --- apps/media/ajax/api.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'apps/media/ajax') diff --git a/apps/media/ajax/api.php b/apps/media/ajax/api.php index b8883166732..e0183ff05de 100644 --- a/apps/media/ajax/api.php +++ b/apps/media/ajax/api.php @@ -107,6 +107,19 @@ if($arguments['action']){ case 'get_songs': echo json_encode(OC_MEDIA_COLLECTION::getSongs($arguments['artist'],$arguments['album'],$arguments['search'])); break; + case 'get_path_info': + $songId=OC_MEDIA_COLLECTION::getSongByPath($arguments['path']); + if($songId==0){ + unset($_SESSION['collection']); + $songId= OC_MEDIA_SCANNER::scanFile($arguments['path']); + } + if($songId>0){ + $song=OC_MEDIA_COLLECTION::getSong($songId); + $song['artist']=OC_MEDIA_COLLECTION::getArtistName($song['song_artist']); + $song['album']=OC_MEDIA_COLLECTION::getAlbumName($song['song_album']); + echo json_encode($song); + } + break; case 'play': ob_end_clean(); -- cgit v1.2.3