[[PageOutline(3-4, Sections)]] == !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 [wiki:XmlRpcTryUploadSubtitles TryUploadSubtitles()]. Most of the information is the same as in [wiki:XmlRpcTryUploadSubtitles 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 [wiki:XmlRpcLogIn 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'', ''[wiki:HashSourceCodes moviehash]'', ''moviebytesize'', ''moviefilename''. * ''subhash'': MD5 hash of subtitle file contents * ''subfilename'': subtitle filename * ''moviehash'': hash calculated for the video file contents, see ''[wiki:HashSourceCodes 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 [wiki:XmlRpcStatusCode list of status codes] ''data'':: link to subtitle on OSDb server (to be used in a web browser) ''subtitles'':: {{{ #!html
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 ==== {{{ #!xml UploadSubtitles d5pnounn3ea5aja0nn4inqamf2 baseinfo idmovieimdb 0119053 sublanguageid cze moviereleasename Almost.Heroes.1998.DVDRip.XviD-FRAGMENT movieaka subauthorcomment cd1 subhash ebe86f4a0357d8c1d635ec49f77e27d6 subfilename almost.heroes.1998.dvdrip.xvid.fragment.cze.srt moviehash 89ceb12ab48e3b1f moviebytesize 731508736 moviefps 23.976 movietimems 5413204 movieframes 129787 moviefilename almost.heroes.1998.dvdrip.xvid.fragment.avi subcontent eNqMv ... gzipped and then base64-encoded subtitle file contents ... x7cPjA== }}} ==== Output ==== {{{ #!xml status 200 OK data http://www.opensubtitles.org/en/subtitles/3337919/almost-heroes-cs/sid-d5pnounn3ea5aja0nn4inqamf2 subtitles 0 seconds 1.705 }}} ---- === Notes === none yet ---- === See also === * [wiki:XmlRpcTryUploadSubtitles TryUploadSubtitles] ---- === Comments === add your comments, hints and suggestions here if you like ... -------- [wiki:XmlRpcTryUploadSubtitles Prev (TryUploadSubtitles)] [wiki:XmlRpcIntro Home] [Next]