wiki:XmlRpcUploadSubtitles

UploadSubtitles

Intro

upload given subtitles to OSDb server


Description

struct UploadSubtitles(string $token, struct('baseinfo' => struct('idmovieimdb' => string $idmovieimdb, 'moviereleasename' => string $scene_releasename, 'movieaka' => string $aka_in_subtitle_language, 'sublanguageid' => string $sublanguageid, 'subauthorcomment' => string $author_comment), 'cd1' => struct('subhash' => string $md5subhash, 'subfilename' => string $subfilename, 'moviehash' => string $moviehash, 'moviebytesize' => double $moviebytesize, 'movietimems' => int $movietimems, 'moviefps' => double $moviefps, 'movieframes' => int $movieframes, 'moviefilename' => string $moviefilename, 'subcontent' => string $subtitlecontent), 'cd2' => struct(...)))

This function takes care of uploading subtitles to OSDb server and should be called after TryUploadSubtitles().

Most of the information is the same as in TryUploadSubtitles(), the important part is subcontent.

It should be gzipped (without header) and then base64-encoded contents of the subtitle file.


Parameters

Parameters structure:

struct(
  (string) [token],
  struct(
    struct(
      (string) [idmovieimdb],
      (string) [sublanguageid],
      (string) [moviereleasename],
      (string) [movieaka],
      (string) [subauthorcomment],
    ) [baseinfo],
    struct(
      (string) [subhash],
      (string) [subfilename],
      (string) [moviehash],
      (double) [moviebytesize],
      (int)    [movietimems],
      (int)    [movieframes],
      (double) [moviefps],
      (string) [moviefilename],
      (string) [subcontent]  <-- gzipped and then base64-encoded subtitle file contents
    ) [cd1],
    struct(
      ... same structure as cd1 ...
    ) [cd2],
    ... more subtitle file structures go here (if any) ...
  ) [data]
)
token (required)
token string identifying user's session, taken from LogIn output structure.
data
upload data structure consists of 2+ parts: basic upload information baseinfo and subtitle files cd1, cd2, ...
baseinfo
  • basic upload information structure containing:
    • idmovieimdb: movie's IMDb ID
    • sublanguageid: subtitle language ISO639-3 code
    • moviereleasename: release name
    • movieaka: optional A.K.A. movie title
    • subauthorcomment: optional uploader's comments (insert translator credits here, etc.)
cd1, cd2, …
  • structure containing information about one subtitle file
  • mandatory fields are: subhash, subfilename, moviehash, moviebytesize, moviefilename.
  • subhash: MD5 hash of subtitle file contents
  • subfilename: subtitle filename
  • moviehash: hash calculated for the video file contents, see Hash Source Codes for various implementations
  • moviebytesize: size of video file in bytes
  • movietimems: length of video in miliseconds
  • movieframes: length of video in frames
  • moviefps: frame rate used in video file, e.g. 23.976
  • moviefilename: video filename
  • subcontent: gzipped and then base64-encoded subtitle file contents

Return Values

Output is returned in this structure:

  struct(
    (string)  [status],
    (string)  [data],
    (boolean) [subtitles],
    (double)  [seconds]
  )

and contains these elements:

status
function result code, see list of status codes
data
link to subtitle on OSDb server (to be used in a web browser)
subtitles
TO-DO
seconds
time taken to execute this command on server

Implementations

There are currently no available sample implementations.


Changelog

Version 1: created this function


Examples

Input

<methodCall>
 <methodName>UploadSubtitles</methodName>
 <params>
  <param>
   <value><string>d5pnounn3ea5aja0nn4inqamf2</string></value>
  </param>
  <param>
   <value>
    <struct>
     <member>
      <name>baseinfo</name>
      <value>
       <struct>
        <member>
         <name>idmovieimdb</name>
         <value><string>0119053</string></value>
        </member>
        <member>
         <name>sublanguageid</name>
         <value><string>cze</string></value>
        </member>
        <member>
         <name>moviereleasename</name>
         <value><string>Almost.Heroes.1998.DVDRip.XviD-FRAGMENT</string></value>
        </member>
        <member>
         <name>movieaka</name>
         <value><string/></value>
        </member>
        <member>
         <name>subauthorcomment</name>
         <value><string/></value>
        </member>
       </struct>
      </value>
     </member>
     <member>
      <name>cd1</name>
      <value>
       <struct>
        <member>
         <name>subhash</name>
         <value><string>ebe86f4a0357d8c1d635ec49f77e27d6</string></value>
        </member>
        <member>
         <name>subfilename</name>
         <value><string>almost.heroes.1998.dvdrip.xvid.fragment.cze.srt</string></value>
        </member>
        <member>
         <name>moviehash</name>
         <value><string>89ceb12ab48e3b1f</string></value>
        </member>
        <member>
         <name>moviebytesize</name>
         <value><double>731508736</double></value>
        </member>
        <member>
         <name>moviefps</name>
         <value><double>23.976</double></value>
        </member>
        <member>
         <name>movietimems</name>
         <value><int>5413204</int></value>
        </member>
        <member>
         <name>movieframes</name>
         <value><int>129787</int></value>
        </member>
        <member>
         <name>moviefilename</name>
         <value><string>almost.heroes.1998.dvdrip.xvid.fragment.avi</string></value>
        </member>
        <member>
         <name>subcontent</name>
         <value><string>eNqMv ... gzipped and then base64-encoded subtitle file contents ... x7cPjA==</string></value>
        </member>
       </struct>
      </value>
     </member>
    </struct>
   </value>
  </param>
 </params>
</methodCall>

Output

<methodResponse>
<params>
 <param>
  <value>
   <struct>
    <member>
     <name>status</name>
     <value><string>200 OK</string></value>
    </member>
    <member>
     <name>data</name>
     <value><string>http://www.opensubtitles.org/en/subtitles/3337919/almost-heroes-cs/sid-d5pnounn3ea5aja0nn4inqamf2</string></value>
    </member>
    <member>
     <name>subtitles</name>
     <value><boolean>0</boolean></value>
    </member>
    <member>
     <name>seconds</name>
     <value><double>1.705</double></value>
    </member>
   </struct>
  </value>
 </param>
</params>
</methodResponse>

Notes

none yet


See also


Comments

add your comments, hints and suggestions here if you like ...


Prev (TryUploadSubtitles) Home [Next]

Last modified 9 years ago Last modified on Sep 27, 2008, 6:00:32 PM