summaryrefslogtreecommitdiff
path: root/plugins/Watrack
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-02-11 18:56:03 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-02-11 18:56:03 +0300
commit985cddceaca1d74cf90b218b05dbeb71e5916e04 (patch)
treea6e3e7479f5a2d33bdc38a2919e4f5b9034e12f8 /plugins/Watrack
parent1b24f4ec94f90b7d4613387f3afb69202c9158d5 (diff)
old xml api removed from pascal plugins
Diffstat (limited to 'plugins/Watrack')
-rw-r--r--plugins/Watrack/lastfm/i_last_api.inc315
-rw-r--r--plugins/Watrack/lastfm/i_last_dlg.inc5
-rw-r--r--plugins/Watrack/lastfm/lastfm.pas10
3 files changed, 1 insertions, 329 deletions
diff --git a/plugins/Watrack/lastfm/i_last_api.inc b/plugins/Watrack/lastfm/i_last_api.inc
index a5be3d3111..3d58bd27dd 100644
--- a/plugins/Watrack/lastfm/i_last_api.inc
+++ b/plugins/Watrack/lastfm/i_last_api.inc
@@ -265,318 +265,3 @@ begin
else
StrDupW(result,Info);
end;
-
-function GetArtistInfo(var data:tLastFMInfo;lang:integer):int;
-var
- si:pSongInfo;
- res,pc:pAnsiChar;
- request:array [0..1023] of AnsiChar;
- root,actnode,node,nnode:HXML;
- i:integer;
- pcw,p,pp:PWideChar;
- artist:pAnsiChar;
-begin
- result:=0;
- if data.artist=nil then
- begin
- si:=pointer(CallService(MS_WAT_RETURNGLOBAL,WAT_INF_UNICODE,0));
- pWideChar(artist):=si^.artist;
- end
- else
- pWideChar(artist):=data.artist;
- if artist=nil then
- exit;
- WideToUTF8(pWideChar(artist),artist);
- pc:=FullEncode(StrCopyE(request,
- 'http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&api_key='+api_key+'&artist='),
- artist);
- mFreeMem(artist);
- if lang<>0 then
- StrCopyE(StrCopyE(pc,'&lang='),pAnsiChar(@lang));
- res:=SendRequest(request,REQUEST_GET);
- if (res<>nil) and (uint_ptr(res)>$0FFF) then
- begin
- UTF8ToWide(res,pcw);
- mFreeMem(res);
-
- i:=StrLenW(pcw)*SizeOf(WideChar);
- root:=xmlParseString(pcw,@i,nil);
-
- actnode:=xmlGetChild(xmlGetChild(root,0),0); // "artist"
-
- if data.artist=nil then
- StrDupW(data.artist,xmlGetText(xmlGetNthChild(actnode,'name',0)));
-
- i:=0;
- repeat
- node:=xmlGetNthChild(actnode,'image',i);
- if node=0 then break;
- if StrCmpW(xmlGetAttrValue(node,'size'),'medium')=0 then
- begin
- WideToUTF8(xmlGetText(node),data.image);
- break;
- end;
- inc(i);
- until false;
-
- // bio
- p:=StrPosW(pcw,'<content><![CDATA[');
- if p<>nil then
- begin
- inc(p,18);
- pp:=StrPosW(p,']]');
- if pp<> nil then pp^:=#0;
- data.info:=FixInfo(p);
- end;
-
- // similar
- i:=0;
- pcw:=pWideChar(@request); pcw^:=#0;
- node:=xmlGetNthChild(actnode,'similar',0);
- repeat
- nnode:=xmlGetNthChild(xmlGetNthChild(node,'artist',i),'name',0);
- if nnode=0 then break;
- if pcw<>@request then
- begin
- pcw^:=','; inc(pcw);
- pcw^:=' '; inc(pcw);
- end;
- pcw:=StrCopyEW(pcw,xmlGetText(nnode));
- inc(i);
- until false;
- pcw:=#0;
- StrDupW(data.similar,pWideChar(@request));
-
- // tags
- i:=0;
- pcw:=pWideChar(@request); pcw^:=#0;
- node:=xmlGetNthChild(actnode,'tags',0);
- repeat
- nnode:=xmlGetNthChild(xmlGetNthChild(node,'tag',i),'name',0);
- if nnode=0 then break;
- if pcw<>@request then
- begin
- pcw^:=','; inc(pcw);
- pcw^:=' '; inc(pcw);
- end;
- pcw:=StrCopyEW(pcw,xmlGetText(nnode));
- inc(i);
- until false;
- pcw:=#0;
- StrDupW(data.tags,pWideChar(@request));
- xmlDestroyNode(root);
- end;
-end;
-
-function GetAlbumInfo(var data:tLastFMInfo;lang:integer):int;
-var
- si:pSongInfo;
- res,pc:pAnsiChar;
- request:array [0..1023] of AnsiChar;
- root,actnode,node,nnode:HXML;
- i:integer;
- p,pp,pcw:PWideChar;
- album,artist:pAnsiChar;
-begin
- result:=0;
- si:=nil;
- if data.album=nil then
- begin
- si:=pointer(CallService(MS_WAT_RETURNGLOBAL,WAT_INF_UNICODE,0));
- pWideChar(album):=si^.album;
- end
- else
- pWideChar(album):=data.album;
- if album=nil then
- exit;
- WideToUTF8(pWideChar(album),album);
- pc:=FullEncode(StrCopyE(request,
- 'http://ws.audioscrobbler.com/2.0/?method=album.getinfo&api_key='+api_key+'&album='),
- album);
- mFreeMem(album);
- if data.artist=nil then
- begin
- if si=nil then
- si:=pointer(CallService(MS_WAT_RETURNGLOBAL,WAT_INF_UNICODE,0));
- pWideChar(artist):=si^.artist;
- end
- else
- pWideChar(artist):=data.artist;
- if artist<>nil then
- begin
- WideToUTF8(pWideChar(artist),artist);
- pc:=FullEncode(StrCopyE(pc,'&artist='),artist);
- mFreeMem(artist);
- end;
-
- if lang<>0 then
- StrCopyE(StrCopyE(pc,'&lang='),pAnsiChar(@lang));
-
- res:=SendRequest(request,REQUEST_GET);
- if res<>nil then
- begin
- UTF8ToWide(res,pcw);
- mFreeMem(res);
-
- i:=StrLenW(pcw)*SizeOf(WideChar);
- root:=xmlParseString(pcw,@i,nil);
-
- actnode:=xmlGetChild(xmlGetChild(root,0),0); // "album"
-
- if data.album=nil then
- StrDupW(data.album,xmlGetText(xmlGetNthChild(actnode,'name',0)));
- StrDupW(data.release,xmlGetText(xmlGetNthChild(actnode,'releasedate',0)));
- if data.artist=nil then
- StrDupW(data.artist,xmlGetText(xmlGetNthChild(actnode,'artist',0)));
-
- i:=0;
- repeat
- node:=xmlGetNthChild(actnode,'image',i);
- if node=0 then break;
- if StrCmpW(xmlGetAttrValue(node,'size'),'medium')=0 then
- begin
- WideToUTF8(xmlGetText(node),data.image);
- break;
- end;
- inc(i);
- until false;
-
- p:=StrPosW(pcw,'<content><![CDATA[');
- if p<>nil then
- begin
- inc(p,18);
- pp:=StrPosW(p,']]');
- if pp<> nil then pp^:=#0;
- data.info:=FixInfo(p);
- end;
-
- // tags
- i:=0;
- pcw:=pWideChar(@request); pcw^:=#0;
- node:=xmlGetNthChild(actnode,'toptags',0);
- repeat
- nnode:=xmlGetNthChild(xmlGetNthChild(node,'tag',i),'name',0);
- if nnode=0 then break;
- if pcw<>@request then
- begin
- pcw^:=','; inc(pcw);
- pcw^:=' '; inc(pcw);
- end;
- pcw:=StrCopyEW(pcw,xmlGetText(nnode));
- inc(i);
- until false;
- pcw:=#0;
- StrDupW(data.tags,pWideChar(@request));
-
- xmlDestroyNode(root);
- end;
-end;
-
-function GetTrackInfo(var data:tLastFMInfo;lang:integer):int;
-var
- si:pSongInfo;
- res,pc:pAnsiChar;
- request:array [0..1023] of AnsiChar;
- root,actnode,node,anode:HXML;
- i:integer;
- p,pp,pcw:PWideChar;
- title,artist:pAnsiChar;
-begin
- result:=0;
- si:=nil;
- if data.album=nil then
- begin
- si:=pointer(CallService(MS_WAT_RETURNGLOBAL,WAT_INF_UNICODE,0));
- pWideChar(title):=si^.title;
- end
- else
- pWideChar(title):=data.title;
- if title=nil then
- exit;
- WideToUTF8(pWideChar(title),title);
- pc:=FullEncode(StrCopyE(request,
- 'http://ws.audioscrobbler.com/2.0/?method=track.getinfo&api_key='+api_key+'&track='),
- title);
- mFreeMem(title);
- if data.artist=nil then
- begin
- if si=nil then
- si:=pointer(CallService(MS_WAT_RETURNGLOBAL,WAT_INF_UNICODE,0));
- pWideChar(artist):=si^.artist;
- end
- else
- pWideChar(artist):=data.artist;
- if artist<>nil then
- begin
- WideToUTF8(pWideChar(artist),artist);
- pc:=FullEncode(StrCopyE(pc,'&artist='),artist);
- mFreeMem(artist);
- end;
-
- if lang<>0 then
- StrCopyE(StrCopyE(pc,'&lang='),pAnsiChar(@lang));
-
- res:=SendRequest(request,REQUEST_GET);
- if res<>nil then
- begin
- UTF8ToWide(res,pcw);
- mFreeMem(res);
-
- i:=StrLenW(pcw)*SizeOf(WideChar);
- root:=xmlParseString(pcw,@i,nil);
-
- actnode:=xmlGetChild(xmlGetChild(root,0),0); // "track"
- if data.artist=nil then
- StrDupW(data.artist,xmlGetText(xmlGetNthChild(xmlGetNthChild(actnode,'artist',0),'name',0)));
-
- anode:=xmlGetNthChild(actnode,'album',i);
-
- if data.album=nil then
- StrDupW(data.album,xmlGetText(xmlGetNthChild(anode,'title',0)));
-
- data.trknum:=StrToInt(xmlGetAttrValue(anode,'position'));
- if data.title=nil then
- StrDupW(data.title,xmlGetText(xmlGetNthChild(actnode,'name',0)));
-
- i:=0;
- repeat
- node:=xmlGetNthChild(anode,'image',i);
- if node=0 then break;
- if StrCmpW(xmlGetAttrValue(node,'size'),'medium')=0 then
- begin
- WideToUTF8(xmlGetText(node),data.image);
- break;
- end;
- inc(i);
- until false;
-
- p:=StrPosW(pcw,'<content><![CDATA[');
- if p<>nil then
- begin
- inc(p,18);
- pp:=StrPosW(p,']]');
- if pp<> nil then pp^:=#0;
- data.info:=FixInfo(p);
- end;
-
- // tags
- i:=0;
- pcw:=pWideChar(@request); pcw^:=#0;
- node:=xmlGetNthChild(actnode,'toptags',0);
- repeat
- anode:=xmlGetNthChild(xmlGetNthChild(node,'tag',i),'name',0);
- if anode=0 then break;
- if pcw<>@request then
- begin
- pcw^:=','; inc(pcw);
- pcw^:=' '; inc(pcw);
- end;
- pcw:=StrCopyEW(pcw,xmlGetText(anode));
- inc(i);
- until false;
- pcw:=#0;
- StrDupW(data.tags,pWideChar(@request));
-
- xmlDestroyNode(root);
- end;
-end;
diff --git a/plugins/Watrack/lastfm/i_last_dlg.inc b/plugins/Watrack/lastfm/i_last_dlg.inc
index 44beb5bdf7..ab15fc8cd2 100644
--- a/plugins/Watrack/lastfm/i_last_dlg.inc
+++ b/plugins/Watrack/lastfm/i_last_dlg.inc
@@ -69,16 +69,11 @@ begin
if loword(wParam)=IDC_INFO_ARTIST then
begin
SetDlgItemTextW(Dialog,IDC_ALT,TranslateW('Similar artists'));
- GetArtistInfo(data,lfm_lang);
SetDlgItemTextW(Dialog,IDC_DATA_ALBUM,data.similar);
end
else
begin
SetDlgItemTextW(Dialog,IDC_ALT,TranslateW('Album'));
- if loword(wParam)=IDC_INFO_TRACK then
- GetTrackInfo (data,lfm_lang)
- else
- GetAlbumInfo (data,lfm_lang);
SetDlgItemTextW(Dialog,IDC_DATA_ALBUM,data.album);
end;
diff --git a/plugins/Watrack/lastfm/lastfm.pas b/plugins/Watrack/lastfm/lastfm.pas
index 2c0428de6b..f83601f966 100644
--- a/plugins/Watrack/lastfm/lastfm.pas
+++ b/plugins/Watrack/lastfm/lastfm.pas
@@ -132,16 +132,8 @@ end;
{$i i_last_dlg.inc}
function SrvLastFMInfo(wParam:WPARAM;lParam:LPARAM):int;cdecl;
-var
- data:tLastFMInfo;
begin
- case wParam of
- 0: result:=GetArtistInfo(data,lParam);
- 1: result:=GetAlbumInfo (data,lParam);
- 2: result:=GetTrackInfo (data,lParam);
- else
- result:=0;
- end;
+ result:=0;
end;
function SrvLastFM(wParam:WPARAM;lParam:LPARAM):int;cdecl;