summaryrefslogtreecommitdiffstats
path: root/apps/media/ajax
diff options
context:
space:
mode:
authorRobin Appelman <icewind1991@gmail.com>2011-08-01 00:32:44 +0200
committerRobin Appelman <icewind1991@gmail.com>2011-08-01 00:32:44 +0200
commitcbf8f822de35748e079df695dd322ada32d02f69 (patch)
tree5b29d072cc692e340f300dbd17d2aa81bd700193 /apps/media/ajax
parentf88b47745911f06a844fbc3f35a347c679f0339c (diff)
downloadnextcloud-server-cbf8f822de35748e079df695dd322ada32d02f69.tar.gz
nextcloud-server-cbf8f822de35748e079df695dd322ada32d02f69.zip
automatically scan songs that are played from the filebrowser
Diffstat (limited to 'apps/media/ajax')
-rw-r--r--apps/media/ajax/api.php13
1 files changed, 13 insertions, 0 deletions
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();