/* * spzm.h — scorpiox-scorpioplayer-premiumize-client: Premiumize.me as the sprch handler * "PREMIUMIZE" (row 52). Replaces Premiumize.NET 1.0.4 + * `bosxixi.ScorpioPlayer.Core` `PremiumizeFolderFileAccesssor` (the legacy `DownloadAsync` chain). * * The sprch vtable (sprch.h, sprch_get) is the fleet boundary. This header is the flat * P/Invoke face: every op takes the legacy RuntimeSettings JSON and goes through * sprch_get() with the transport chosen here (libcurl by default, or the in-memory fake, * or a caller's scorpiox_io). * * Buffers: an op writes its JSON into (out, cap). out == NULL or cap == 0 is allowed on * the flat exports: the op runs, and its JSON is only kept for spzm_result_json(). A * result that does not fit returns SPRCH_E_BUFFER and writes nothing past cap. * * Strings returned by spzm_* are owned by the library, per calling thread, and stay * valid until the same thread's next spzm_* call. Copy them. */ #ifndef SPZM_H #define SPZM_H #include "sprch.h" #ifdef __cplusplus extern "C" { #endif #if defined(SPZM_STATIC) # define SPZM_API #elif defined(_WIN32) # if defined(SPZM_BUILD) # define SPZM_API __declspec(dllexport) # else # define SPZM_API __declspec(dllimport) # endif #else # define SPZM_API __attribute__((visibility("default"))) #endif #define SPZM_VERSION "1.0.0" #define SPZM_RUNTIME_TYPE "Premiumize" /* the exact legacy string (PH:12) */ #define SPZM_CAPS 0x2Fu /* LIST|STREAM|DOWNLOAD|WRITES|VALIDATE */ /* ---- identity ---- */ SPZM_API const char *spzm_version(void); SPZM_API const char *spzm_runtime_type(void); SPZM_API int spzm_caps(void); /* ---- sprch ops through the selected transport (SPRCH_OK or SPRCH_E_*) ---- */ SPZM_API int spzm_validate(const char *settings_json, char *out_json, int cap); SPZM_API int spzm_list(const char *settings_json, const char *folder_id, char *out_json, int cap); SPZM_API int spzm_stream_url(const char *settings_json, const char *entry_json, char *out_json, int cap); SPZM_API int spzm_download(const char *settings_json, const char *config_json, char *out_json, int cap); /* Guards download() + spzm_delete_transfer(): 0 = writes refused, != 0 = allowed. */ SPZM_API int spzm_allow_writes(int enable); /* ---- results ---- */ SPZM_API const char *spzm_result_json(void); /* the last op's output JSON ("" if none) */ SPZM_API const char *spzm_last_error(void); /* "" after a success; never holds a secret */ /* ---- pure helpers (no transport) ---- */ /* The URL the ops would build for these settings (SPEC section 4), or NULL. */ SPZM_API const char *spzm_base_url(void); /* ParseSeasonEpisode (SPEC section 7): out_season/out_episode set when 1 is returned. */ SPZM_API int spzm_parse_season_episode(const char *filename, int *out_season, int *out_episode); /* bencode torrent sniff (SPEC D5): 1 = looks like a .torrent file. */ SPZM_API int spzm_is_torrent_file(const char *bytes, size_t n); /* `magnet:?xt=urn:btih:<40 hex|32 base32>` check (MD:134). */ SPZM_API int spzm_is_magnet_link(const char *link); /* A URL with apikey / api_key / Authorization masked (SPEC section 5). */ SPZM_API const char *spzm_redact(const char *url); /* ---- transport selection ---- */ SPZM_API int spzm_set_io(const scorpiox_io *io); /* NULL => back to libcurl */ SPZM_API int spzm_use_curl(void); /* SPRCH_E_NOTSUPPORTED in a no-curl build */ SPZM_API int spzm_use_fake(void); /* ---- the in-memory fake transport (tests, the .console harness's --test) ---- */ /* method "GET" or "POST"; url exact. body NULL + transport_error => a transport failure. */ SPZM_API void spzm_fake_reset(void); SPZM_API int spzm_fake_set(const char *method, const char *url, int http_code, const char *body); SPZM_API int spzm_fake_fail(const char *method, const char *url, const char *transport_error); SPZM_API int spzm_fake_calls(const char *method, const char *url); /* url NULL => all calls */ SPZM_API const char *spzm_fake_last_body(const char *url); /* last POST body to url */ SPZM_API const char *spzm_fake_last_url(void); /* last URL requested */ #ifdef __cplusplus } #endif #endif /* SPZM_H */