summaryrefslogtreecommitdiff
path: root/plugins/Watrack/myshows/i_myshows_api.inc
diff options
context:
space:
mode:
authorAlexey Kulakov <panda75@bk.ru>2014-01-16 03:11:48 +0000
committerAlexey Kulakov <panda75@bk.ru>2014-01-16 03:11:48 +0000
commitde34b251b442cdf72b13c407d6b60c343c123bb3 (patch)
treea2e05db9606405b78b949ccc67860bb2096f1f5e /plugins/Watrack/myshows/i_myshows_api.inc
parent74220939c1156067d46ccb85cbc307737cd5a244 (diff)
sync
git-svn-id: http://svn.miranda-ng.org/main/trunk@7674 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Watrack/myshows/i_myshows_api.inc')
-rw-r--r--plugins/Watrack/myshows/i_myshows_api.inc68
1 files changed, 32 insertions, 36 deletions
diff --git a/plugins/Watrack/myshows/i_myshows_api.inc b/plugins/Watrack/myshows/i_myshows_api.inc
index 572cc3ee31..2e9f51773d 100644
--- a/plugins/Watrack/myshows/i_myshows_api.inc
+++ b/plugins/Watrack/myshows/i_myshows_api.inc
@@ -68,7 +68,7 @@ function GetMD5(const data;datalen:integer;var digest:TMD5Hash):TMD5Hash;
begin
FillChar(digest,16,0);
- mir_md5_hash(pmir_md5_byte_t(data),datalen,digest);
+ mir_md5_hash(pbyte(data),datalen,digest);
result:=digest;
end;
@@ -154,9 +154,9 @@ var
buf:array [0..511] of AnsiChar;
// bufw:array [0..511] of WideChar;
res,pc:PAnsiChar;
- {img,}shId,epId:pAnsiChar;
+ epId:pAnsiChar;
+ shId:pWideChar;
// imgw:pWideChar;
- json:TJSONSERVICEINTERFACE;
jn,jroot:PJSONNODE;
begin
result:=false;
@@ -171,21 +171,13 @@ begin
res:=SendRequest(buf,REQUEST_GET);
if uint_ptr(res)>$0FFF then
begin
- CallService(MS_JSON_GETINTERFACE,wparam(@json),0);
+ jroot:=json_parse(res);
- jroot:=json.parse(res);
+ jn:=json_get(jroot,'show');
+ shId:=json_as_string(json_get(jn,'id'));
- jn:=json.get(jroot,'show');
- shId:=json.as_string(json.get(jn,'id'));
-
- jn:=json.get(jn,'episodes');
- epId:=json.name(json.at(jn,0));
-{
-kinopoiskId
-image
-ruTitle
-episodes:{:{id:
-}
+ jn:=json_get(jn,'episodes');
+ epId:=json_name(json_at(jn,0));
end
else
begin
@@ -195,7 +187,9 @@ episodes:{:{id:
end;
// Show mark as "watching"
- StrCopy(StrCopyE(StrCopyE(buf,API_URL+'profile/shows/'),shId),'/watching');
+ pc:=StrCopyE(buf,API_URL+'profile/shows/');
+ FastWideToAnsiBuf(shId,pc);
+ StrCat(pc,'/watching');
if SendMSRequest(buf,show) then
begin
// Episode check
@@ -206,42 +200,44 @@ episodes:{:{id:
{
if si.cover=nil then
begin
- jn:=json.get(jroot,'show');
- img:=json.as_string(json.get(jn,'image'));
+ jn:=json_get(jroot,'show');
+ img:=json_as_string(json_get(jn,'image'));
si:=pointer(CallService(MS_WAT_RETURNGLOBAL,WAT_INF_UNICODE,0));
FastAnsiToWide(img,pSongInfoW(si)^.cover);
- json.free(img);
+ json_free(img);
end;
}
//!! add option to show it??
if ServiceExists(MS_POPUP_SHOWMESSAGE)<>0 then
begin
- json.free(shId);
- json.free(epId);
+ json_free(shId);
+ json_free(epId);
- jn:=json.get(jroot,'show');
- shId:=json.as_string(json.get(jn,'title'));
+ jn:=json_get(jroot,'show');
+ shId:=json_as_string(json_get(jn,'title'));
- jn:=json.get(jn,'episodes');
- epId:=json.as_string(json.get(jn,'title'));
+ jn:=json_get(jn,'episodes');
+ pWideChar(epId):=json_as_string(json_get(jn,'title'));
- StrCopy(
- StrCopyE(
- StrCopyE(
- StrCopyE(
- StrCopyE(buf,'Show "'),
+ mGetMem(pc,1024);
+ StrCopyW(
+ StrCopyEW(
+ StrCopyEW(
+ StrCopyEW(
+ StrCopyEW(pWideChar(pc),'Show "'),
shId),
'"'#13#10'episode "'),
- epId),
+ pWideChar(epId)),
'" checked');
- CallService(MS_POPUP_SHOWMESSAGE,TWPARAM(@buf),SM_NOTIFY);
+ CallService(MS_POPUP_SHOWMESSAGEW,TWPARAM(pc),SM_NOTIFY);
+ mFreeMem(pc);
end;
result:=true;
end;
end;
- json.free(shId);
- json.free(epId);
+ json_free(shId);
+ json_free(epId);
- json.delete_(jroot);
+ json_delete(jroot);
end;