Skip to content
This repository has been archived by the owner on Jul 26, 2022. It is now read-only.

Commit

Permalink
escape search query string to enhance searching relevance
Browse files Browse the repository at this point in the history
  • Loading branch information
scorpp committed Mar 3, 2013
1 parent 2ed02ab commit 4a7cb34
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CMakeCPackOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ endmacro(dpkg_arch)
# CPack configuration
set(CPACK_PACKAGE_NAME "deadbeef-plugin-vk")
set(CPACK_PACKAGE_VENDOR "https://github.com/scorpp/db-vk")
set(CPACK_PACKAGE_VERSION "0.1-10")
set(CPACK_PACKAGE_VERSION "0.1-11")
set(CPACK_PACKAGE_CONTACT "[email protected]")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Deadbeef plugin for VKontakte")

Expand Down
9 changes: 8 additions & 1 deletion vkontakte.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <deadbeef/gtkui_api.h>
#include <json-glib/json-glib.h>
#include <string.h>
#include <curl/curl.h>

#include "common-defs.h"
#include "vk-api.h"
Expand Down Expand Up @@ -224,14 +225,20 @@ vk_send_audio_request_and_parse_response (const gchar *url, SearchQuery *query)
static void
vk_search_audio_thread_func (void *ctx) {
SearchQuery *query = (SearchQuery *) ctx;
CURL *curl;

curl = curl_easy_init ();

char *escaped_search_str = curl_easy_escape (curl, query->query, 0);
char *method_url = g_strdup_printf (VK_API_METHOD_AUDIO_SEARCH "?access_token=%s&count=%d&q=%s",
vk_auth_data->access_token,
VK_AUDIO_MAX_TRACKS,
query->query);
escaped_search_str);
vk_send_audio_request_and_parse_response (method_url, query);

g_free (method_url);
g_free (escaped_search_str);
curl_easy_cleanup (curl);
g_free ((gchar *) query->query);
g_free (query);
http_tid = 0;
Expand Down

0 comments on commit 4a7cb34

Please sign in to comment.