#ifndef SMSRCH_H #define SMSRCH_H #include #include #ifdef __cplusplus extern "C" { #endif #if defined(_WIN32) || defined(__CYGWIN__) # ifdef SMSRCH_BUILD # define SMSRCH_API __declspec(dllexport) # else # define SMSRCH_API __declspec(dllimport) # endif #else # if defined(__GNUC__) || defined(__clang__) # define SMSRCH_API __attribute__((visibility("default"))) # else # define SMSRCH_API # endif #endif #define SMSRCH_SORT_FEED_ORDER 0 #define SMSRCH_SORT_TITLE_ASC 1 #define SMSRCH_SORT_ARTIST_ASC 2 #define SMSRCH_SORT_NEWEST_FIRST 3 #define SMSRCH_SORT_SHORTEST_FIRST 4 #define SMSRCH_SORT_DOWNLOADED_FIRST 5 SMSRCH_API const char *smsrch_version(void); SMSRCH_API int smsrch_abi_version(void); SMSRCH_API const char *smsrch_last_error(void); SMSRCH_API void smsrch_free(void *ptr); SMSRCH_API int smsrch_selftest(void); /* Build percent-encoded unified search URL: "/search/api?q=&format=json". */ SMSRCH_API char *smsrch_build_search_url(const char *hub_base, const char *query); /* Filter & sort a local tracks JSON array (supports query substring match on title/artist, * downloaded_only filter against cached_urls_json array, and SMSRCH_SORT_* ordering). */ SMSRCH_API char *smsrch_filter_and_sort_tracks_json( const char *tracks_json, const char *query, int downloaded_only, const char *cached_urls_json, int sort_order ); /* Normalize raw music.scorpiox.net/search/api?format=json response into clean local + catalogue buckets. */ SMSRCH_API char *smsrch_normalize_unified_results_json(const char *raw_json, size_t len); #ifdef __cplusplus } #endif #endif /* SMSRCH_H */