Example #1
0
        private APIResponse GetFolder(APIRequest request)
        {
            string folderPath = APIUtils.DecodeUrlDataString(request.Segment);
            Dictionary <string, object> responseData = null;

            if (MediaDatabase.GetFolderExists(folderPath))
            {
                responseData = new Dictionary <string, object>();
                responseData.Add("path", folderPath);
                responseData.Add("folders", MediaDatabase.GetFoldersInFolder(folderPath));
                responseData.Add("songs", MediaDatabase.GetSongsInFolder(folderPath));
            }
            else
            {
                throw new ResourceNotFoundException();
            }

            return(new APIResponse(JsonConvert.SerializeObject(new { data = responseData })));
        }