diff --git a/src/Classes/ServiceAPI/MyRadio_Podcast.php b/src/Classes/ServiceAPI/MyRadio_Podcast.php index 25252e84b..685e23125 100644 --- a/src/Classes/ServiceAPI/MyRadio_Podcast.php +++ b/src/Classes/ServiceAPI/MyRadio_Podcast.php @@ -903,18 +903,32 @@ public function getCover() /** * Searches searchable *text* metadata for the specified value. Does not work for image metadata. - * + * if $q is set, then $path_query must be set to "search". This allows the query to be given in path or in parameters. + + * * @todo effective_from/to not yet implemented * - * @param string $query The query value. + * @param string $path_query The query value encoded in the path (DEPRECATED). + * @param string $q The query value as a query string. to use this, $path_query must be set to "search" * @param array $string_keys The metadata keys to search * @param int $effective_from UTC Time to search from. * @param int $effective_to UTC Time to search to. * * @return array The shows that match the search terms */ - public static function searchMeta($query, $string_keys = null, $effective_from = null, $effective_to = null) + public static function searchMeta($path_query, $q="", $string_keys = null, $effective_from = null, $effective_to = null) { + if($path_query != "search" && $q != "") { + throw new MyRadioException( + "the path_query must be set to 'search' if q is set in the query string", + 400 + ); + } + if ($path_query == "search" && $q != ""){ + $query = $q; + } else { + $query = $path_query; + } if (is_null($string_keys)) { $string_keys = ['title', 'description', 'tag']; } diff --git a/src/Classes/ServiceAPI/MyRadio_Show.php b/src/Classes/ServiceAPI/MyRadio_Show.php index 634abfd5d..1480c4959 100755 --- a/src/Classes/ServiceAPI/MyRadio_Show.php +++ b/src/Classes/ServiceAPI/MyRadio_Show.php @@ -1028,18 +1028,31 @@ public static function getMostListened($date = 0) /** * Searches searchable *text* metadata for the specified value. Does not work for image metadata. + * if $q is set, then $path_query must be set to "search". This allows the query to be given in path or in parameters. * * @todo effective_from/to not yet implemented * - * @param string $query The query value. + * @param string $path_query The query value encoded in the path (DEPRECATED). + * @param string $q The query value as a query string. to use this, $path_query must be set to "search" * @param array $string_keys The metadata keys to search * @param int $effective_from UTC Time to search from. * @param int $effective_to UTC Time to search to. * * @return array The shows that match the search terms */ - public static function searchMeta($query, $string_keys = null, $effective_from = null, $effective_to = null) + public static function searchMeta($path_query, $q="", $string_keys = null, $effective_from = null, $effective_to = null) { + if($path_query != "search" && $q != "") { + throw new MyRadioException( + "the path_query must be set to 'search' if q is set in the query string", + 400 + ); + } + if ($path_query == "search" && $q != ""){ + $query = $q; + } else { + $query = $path_query; + } if (is_null($string_keys)) { $string_keys = ['title', 'description', 'tag']; }