File tree Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -169,8 +169,14 @@ Notes:
169169
170170#### Get all tracks from the library
171171````
172- GET /server/api/library/tracks
172+ GET /server/api/library/tracks[?trackTitle=:title|artistName=:artist|albumName=:album|search=:anything]
173173````
174+ Following search criteria should be added in query string:
175+ - ` trackTitle ` ,
176+ - ` artistName ` ,
177+ - ` albumName ` ,
178+ - ` search ` (cumulative search on track title, artist and album).
179+
174180The API returns:
175181- 200 with an array of tracks,
176182- 204 if there is no track in library,
Original file line number Diff line number Diff line change 55 *
66 * Provides the list of all the tracks included in the library
77 *
8- * @version 1.0 .0
8+ * @version 1.1 .0
99 *
1010 * @api
1111 */
3838 $ api ->checkParameterExists ('title ' , $ parameter ['trackTitle ' ]);
3939 $ api ->checkParameterExists ('artist ' , $ parameter ['artistName ' ]);
4040 $ api ->checkParameterExists ('album ' , $ parameter ['albumName ' ]);
41+ $ api ->checkParameterExists ('search ' , $ parameter ['search ' ]);
4142 //querying the library
4243 if (!$ library ->populateTracks ($ parameter )) {
4344 $ api ->output (500 , 'Querying error ' );
Original file line number Diff line number Diff line change @@ -339,7 +339,7 @@ public function getBase64()
339339 *
340340 * This is a set of tracks (library, search, ...)
341341 *
342- * @version 1.0 .0
342+ * @version 1.1 .0
343343 *
344344 * @internal
345345 */
@@ -387,6 +387,9 @@ public function populateTracks($parameters)
387387 case 'albumName ' :
388388 $ sqlCondition .= ' AND `album`.`name` LIKE :albumName ' ;
389389 break ;
390+ case 'search ' :
391+ $ sqlCondition .= ' AND (`track`.`title` LIKE :trackTitle OR `artist`.`name` LIKE :artistName OR `album`.`name` LIKE :albumName) ' ;
392+ break ;
390393 }
391394 }
392395 }
@@ -405,6 +408,11 @@ public function populateTracks($parameters)
405408 case 'albumName ' :
406409 $ query ->bindValue (':albumName ' , "% $ value% " , PDO ::PARAM_STR );
407410 break ;
411+ case 'search ' :
412+ $ query ->bindValue (':trackTitle ' , "% $ value% " , PDO ::PARAM_STR );
413+ $ query ->bindValue (':artistName ' , "% $ value% " , PDO ::PARAM_STR );
414+ $ query ->bindValue (':albumName ' , "% $ value% " , PDO ::PARAM_STR );
415+ break ;
408416 }
409417 }
410418 }
You can’t perform that action at this time.
0 commit comments