Forum rules
Under no circumstances is spamming or advertising of any kind allowed. Do not post any abusive, obscene, vulgar, slanderous, hateful, threatening, sexually-orientated or any other material that may violate others security. Profanity or any kind of insolent behavior to other members (regardless of rank) will not be tolerated. Remember, what you don’t find offensive can be offensive to other members. Please treat each other with the kind of reverence you’d expect from other members.
Failure to comply with any of the above will result in users being banned without notice. If any further details are needed, contact: “The team” using the link at the bottom of the forum page. Thank you.
z_stoichev
Posts: 7
Joined: Tue Jun 24, 2008 9:20 pm

xml-rpc SearchSubtitles request format

Wed Jun 25, 2008 11:11 am

Hi! I have troubles constructing the SearchSubtitles request. Can someone post a working XML for it, so I compare my XML to it. I tried using RpcArray, and RpcStruct with no luck so far ;/ The result's [data] is always False.

z_stoichev
Posts: 7
Joined: Tue Jun 24, 2008 9:20 pm

Wed Jun 25, 2008 12:15 pm

Quite funny, docs say
[data] => Array
(
[0] => Array
(
[idsubtitlefile] => 10
[data] => MQ0KMDA6MDA6MzgsMzAwIC0tPiAwMDowMDo0MSwwMDA...
)
[1] => Array
(
[idsubtitlefile] => 20
[data] => MQ0KMDA6MDA6MjYsMjgzIC0tPiAwMD...
)
still it returs an array named 'MovieNameEng'!

So it seams Wikis are out of date?!

z_stoichev
Posts: 7
Joined: Tue Jun 24, 2008 9:20 pm

Wed Jun 25, 2008 10:48 pm

The SearchSubtitles request problem solved! - The first part of the result is Array, and inside it we have Structs. Quite strange, indeed, the Wikis say there should be only arrays :/

Btw, I have implemented Delphi XmlRpc classes based on dxmlrpc package, so I could release them if anyone is interested, under GPL :)

ibebbs
Posts: 2
Joined: Fri Jun 27, 2008 12:52 am

Re: xml-rpc SearchSubtitles request format

Fri Jun 27, 2008 12:55 am

Hi! I have troubles constructing the SearchSubtitles request. Can someone post a working XML for it, so I compare my XML to it. I tried using RpcArray, and RpcStruct with no luck so far ;/ The result's [data] is always False.
Hi,

I'm also struggling to work out the request (not response) format. I am working in c# but know Delphi, if you could post the code showing how you build your request, I could probably translate it.

Thanks!

z_stoichev
Posts: 7
Joined: Tue Jun 24, 2008 9:20 pm

Fri Jun 27, 2008 2:05 pm

Sure! Here we go:

Code: Select all

procedure TOSDBForm.DoFindSubtitles(Mode: TResShowMode; Lang: String); var RpcFunction: TRpcFunction; Find: TRpcStruct; Data: TRpcArray; begin if not IsBusy then begin Searching('Searching Database...'); try Find := nil; case Mode of rsmSubtitles: begin if FIMDBid <> '' then begin Find := TRpcStruct.Create; Find.AddItem('sublanguageid',Lang); // language id //Find.AddItem('moviehash',''); // hash //Find.AddItem('moviebytesize',''); // bytes Find.AddItem('imdbid',FIMDBid); // IMDB id end end; rsmMovieSubs: begin if FFSize <> 0 then begin Find := TRpcStruct.Create; Find.AddItem('sublanguageid',Lang); // language id Find.AddItem('moviehash',Edit2.Text); // hash Find.AddItem('moviebytesize',FFSize); // bytes //Find.AddItem('imdbid',''); // IMDB id end; end; end; if Assigned(Find) then begin Data := TRpcArray.Create; Data.AddItem(Find); RpcFunction := TRpcFunction.Create; RpcFunction.ObjectMethod := 'SearchSubtitles'; RpcFunction.AddItem(FToken); RpcFunction.AddItem(Data); DoShowResult(rsmSubtitles,ExecuteXmlRpc(RpcFunction),340,85); end; finally SearchingDone; end; DoSelectOne; end; end;
where DoFindSubtitles() implements both searches by IMDB-ID and by Movie Hash/Size, and DoShowResult() implements visualization of the results found:

Code: Select all

procedure TOSDBForm.DoShowResult(Mode: TResShowMode; Info: IRpcStruct; W1,W2: Integer); var i: Integer; List: IRpcStruct; Subs: IRpcArray; begin ... if Info.KeyExists('MovieNameEng') then if Info.Keys['MovieNameEng'].IsArray then begin Subs := Info.Keys['MovieNameEng'].AsArray; for i := 0 to Subs.Count-1 do begin List := Subs.Items[i].AsStruct; with ListView1.Items.Add,List do begin Caption := Keys['SubFileName'].AsString; SubItems.Add(Keys['LanguageName'].AsString); SubItems.Add(Keys['IDSubtitleFile'].AsString); // Subs OSDB id end; end; end; ... end;
The "FIMDBid" is global (class) variable which hold the selected movie IMDB-ID (as string). It might be left-padded with zeros. And "Lang" is selected language for search result. It might be "all", or any 3-digit ISO639-2 language code. You can execute GetSubLanguages() xml-rpc to retrieve list of all languages.

Hope this helps ;)
Dako

User avatar
eduo
Posts: 716
Joined: Sat Feb 10, 2007 1:40 am
Location: Information Technology
Contact: ICQ Website Yahoo Messenger

Mon Jun 30, 2008 2:01 pm

I have working XML samples for all the XMLRPCs methods and transactions SolEol currently supports (actually, I have it set-up so in debug mode all XML files are always kept in disk).

I can provide useable sample files for several of the methods required, both the request and response. I could even upload these to the trac:

LogIn, SearchSubtitles, CheckSubhash, CheckMovieHash, DownloadSubtitles

Will add support in the near future for (in no particular order):

-SearchToMail (relies on proper config of OS account)
-DetectLanguage (should also be a feature of "UploadSubtitles", to my eyes)
-TryUploadSubtitles (SubHash should be included in all responses as it's the individual identifier for each item, currently it's not)
-UploadSubtitles
-ReportWrongMovieHash

A problem is that most methods don't say what's mandatory and what isn't, as well as not providing sample files (I will try to upload mine to help with this).

I don't support LogOut because, frankly, the API tends to log users out whenever it damn well pleases and won't report this back, so it makes no sense (API tokens should be self-refreshing, each usage extending the timeout further).

User avatar
eduo
Posts: 716
Joined: Sat Feb 10, 2007 1:40 am
Location: Information Technology
Contact: ICQ Website Yahoo Messenger

Tue Jul 01, 2008 1:32 am

Sample XML files:

LogIn (response)
CheckMovieHash (response)
CheckSubHash (response)
SearchSubtitles (response)
TryUploadSubtitles (response)

I hope this is useful. I'm thinking of uploading them to the Trac as samples next to each method.

EDIT: Added "TryUploadSubtitles" method.
Last edited by eduo on Sun Jul 13, 2008 3:56 am, edited 1 time in total.
http://eduo.info/
[url=http://eduo.info/soleol/]OpenSubtitles from your desktop: SolEol for Mac/Windows/Linux[/url]
[url=http://forums.plexapp.com/index.php?showtopic=325&st=0&p=2480&#entry2480]My current episode processing work flow[/url].

ibebbs
Posts: 2
Joined: Fri Jun 27, 2008 12:52 am

Sun Jul 06, 2008 2:16 pm

Thanks Z and Eduo, I now have my C# search working fine.

I had actually constructed the request correctly but was specifying an incorrect language ID - only realised when I saw the "eng" in Eduo's examples.

I will make this code public once it is tidied up a little.

Thanks again!

User avatar
oss
Site Admin
Posts: 5891
Joined: Sat Feb 25, 2006 11:26 pm
Contact: Website

Mon Jul 07, 2008 8:37 am

eduo - if you can, please take care of trac wiki, upload sample files, do anything what can help to other users.

for some methods - all fileds are mandatory, if it is not written, they are not :)

also I will try to change TryUpload and Upload for autodetecting language if not language field is not provided, no problem.

User avatar
eduo
Posts: 716
Joined: Sat Feb 10, 2007 1:40 am
Location: Information Technology
Contact: ICQ Website Yahoo Messenger

Wed Jul 09, 2008 12:40 am

I was checking my procedures and I wanted to compare them to a flow diagram I had seen once (in trac? in google? in forja? I can't remember now :) ) where each process was graphically displayed. Both the upload and download of subs.

Is this anywhere? I want to take a look at it and maybe update it with the new functionality that's been added.

Also, if new funcionality is added to the methods shouldn't a changelog be kept? Without it it may be hard to know there've been changes. If a new method changes things radically it may break older clients.
http://eduo.info/
[url=http://eduo.info/soleol/]OpenSubtitles from your desktop: SolEol for Mac/Windows/Linux[/url]
[url=http://forums.plexapp.com/index.php?showtopic=325&st=0&p=2480&#entry2480]My current episode processing work flow[/url].

User avatar
eduo
Posts: 716
Joined: Sat Feb 10, 2007 1:40 am
Location: Information Technology
Contact: ICQ Website Yahoo Messenger

Sat Jul 12, 2008 11:40 pm

I'm not getting any responses, yet I keep posting, in hopes of receiving a message.

I tried updating the trac for XMLRPC without any luck. It says Akismet detects too many links and then it's spam.

I have placed the corrected page in http://eduo.hopto.org/~eduo/xmls.txt

I have edited the post above and included samples for the current TryUploadSubtitles.
http://eduo.info/
[url=http://eduo.info/soleol/]OpenSubtitles from your desktop: SolEol for Mac/Windows/Linux[/url]
[url=http://forums.plexapp.com/index.php?showtopic=325&st=0&p=2480&#entry2480]My current episode processing work flow[/url].

Majky
Site Admin
Posts: 44
Joined: Wed May 31, 2006 10:03 am
Contact: Website

Enhanced XML-RPC documentation

Thu Sep 25, 2008 6:35 pm

hi,


just started a new 'enhanced' documentation of the XML-RPC API, using your provided examples. Hope you don't mind. ;)

I have most (95%) of the functions successfully implemented so I'll add all the missing examples along the way.

take a look at the current status here: http://trac.opensubtitles.org/projects/ ... mlRpcIntro

any comments, suggestions are welcome.

heavily under construction right now :)


<Majky>

User avatar
eduo
Posts: 716
Joined: Sat Feb 10, 2007 1:40 am
Location: Information Technology
Contact: ICQ Website Yahoo Messenger

Fri Sep 26, 2008 12:34 am

It looks very nice. Great work!

Let me know if you need more samples or anything!
http://eduo.info/
[url=http://eduo.info/soleol/]OpenSubtitles from your desktop: SolEol for Mac/Windows/Linux[/url]
[url=http://forums.plexapp.com/index.php?showtopic=325&st=0&p=2480&#entry2480]My current episode processing work flow[/url].

Return to “Developing”

Who is online

Users browsing this forum: No registered users and 26 guests