| 1 | |
| 2 | [[PageOutline(3-4, Sections)]] |
| 3 | |
| 4 | == !UploadSubtitles == |
| 5 | |
| 6 | |
| 7 | === Intro === |
| 8 | |
| 9 | upload given subtitles to OSDb server |
| 10 | |
| 11 | ---- |
| 12 | === Description === |
| 13 | |
| 14 | '''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(...)))''' |
| 15 | |
| 16 | This function takes care of uploading subtitles to OSDb server and should be called after [wiki:XmlRpcTryUploadSubtitles TryUploadSubtitles()]. |
| 17 | |
| 18 | Most of the information is the same as in [wiki:XmlRpcTryUploadSubtitles TryUploadSubtitles()], the important part is ''subcontent''. |
| 19 | |
| 20 | It should be gzipped (without header) and then base64-encoded contents of the subtitle file. |
| 21 | |
| 22 | |
| 23 | ---- |
| 24 | === Parameters === |
| 25 | |
| 26 | Parameters structure: |
| 27 | {{{ |
| 28 | struct( |
| 29 | (string) [token], |
| 30 | struct( |
| 31 | struct( |
| 32 | (string) [idmovieimdb], |
| 33 | (string) [sublanguageid], |
| 34 | (string) [moviereleasename], |
| 35 | (string) [movieaka], |
| 36 | (string) [subauthorcomment], |
| 37 | ) [baseinfo], |
| 38 | struct( |
| 39 | (string) [subhash], |
| 40 | (string) [subfilename], |
| 41 | (string) [moviehash], |
| 42 | (double) [moviebytesize], |
| 43 | (int) [movietimems], |
| 44 | (int) [movieframes], |
| 45 | (double) [moviefps], |
| 46 | (string) [moviefilename], |
| 47 | (string) [subcontent] <-- gzipped and then base64-encoded subtitle file contents |
| 48 | ) [cd1], |
| 49 | struct( |
| 50 | ... same structure as cd1 ... |
| 51 | ) [cd2], |
| 52 | ... more subtitle file structures go here (if any) ... |
| 53 | ) [data] |
| 54 | ) |
| 55 | }}} |
| 56 | |
| 57 | ''token (required)'':: |
| 58 | token string identifying user's session, taken from [wiki:XmlRpcLogIn LogIn] output structure. |
| 59 | ''data'':: |
| 60 | upload data structure consists of 2+ parts: basic upload information ''baseinfo'' and subtitle files ''cd1'', ''cd2'', ... |
| 61 | ''baseinfo'':: |
| 62 | * basic upload information structure containing: |
| 63 | * ''idmovieimdb'': movie's IMDb ID |
| 64 | * ''sublanguageid'': subtitle language ISO639-3 code |
| 65 | * ''moviereleasename'': release name |
| 66 | * ''movieaka'': optional A.K.A. movie title |
| 67 | * ''subauthorcomment'': optional uploader's comments (insert translator credits here, etc.) |
| 68 | ''cd1'', ''cd2'', ...:: |
| 69 | * structure containing information about one subtitle file |
| 70 | * mandatory fields are: ''subhash'', ''subfilename'', ''[wiki:HashSourceCodes moviehash]'', ''moviebytesize'', ''moviefilename''. |
| 71 | * ''subhash'': MD5 hash of subtitle file contents |
| 72 | * ''subfilename'': subtitle filename |
| 73 | * ''moviehash'': hash calculated for the video file contents, see ''[wiki:HashSourceCodes Hash Source Codes]'' for various implementations |
| 74 | * ''moviebytesize'': size of video file in bytes |
| 75 | * ''movietimems'': length of video in miliseconds |
| 76 | * ''movieframes'': length of video in frames |
| 77 | * ''moviefps'': frame rate used in video file, e.g. 23.976 |
| 78 | * ''moviefilename'': video filename |
| 79 | * ''subcontent'': gzipped and then base64-encoded subtitle file contents |
| 80 | |
| 81 | ---- |
| 82 | === Return Values === |
| 83 | |
| 84 | Output is returned in this structure: |
| 85 | {{{ |
| 86 | struct( |
| 87 | (string) [status], |
| 88 | (string) [data], |
| 89 | (boolean) [subtitles], |
| 90 | (double) [seconds] |
| 91 | ) |
| 92 | }}} |
| 93 | |
| 94 | and contains these elements: |
| 95 | ''status'':: |
| 96 | function result code, see [wiki:XmlRpcStatusCode list of status codes] |
| 97 | ''data'':: |
| 98 | link to subtitle on OSDb server (to be used in a web browser) |
| 99 | ''subtitles'':: |
| 100 | {{{ |
| 101 | #!html |
| 102 | <div style='color:red'>TO-DO</div> |
| 103 | }}} |
| 104 | ''seconds'':: |
| 105 | time taken to execute this command on server |
| 106 | |
| 107 | |
| 108 | ---- |
| 109 | === Implementations === |
| 110 | |
| 111 | There are currently no available sample implementations. |
| 112 | |
| 113 | |
| 114 | ---- |
| 115 | === Changelog === |
| 116 | |
| 117 | Version 1: created this function |
| 118 | |
| 119 | |
| 120 | ---- |
| 121 | === Examples === |
| 122 | |
| 123 | |
| 124 | ==== Input ==== |
| 125 | |
| 126 | {{{ |
| 127 | #!xml |
| 128 | <methodCall> |
| 129 | <methodName>UploadSubtitles</methodName> |
| 130 | <params> |
| 131 | <param> |
| 132 | <value><string>d5pnounn3ea5aja0nn4inqamf2</string></value> |
| 133 | </param> |
| 134 | <param> |
| 135 | <value> |
| 136 | <struct> |
| 137 | <member> |
| 138 | <name>baseinfo</name> |
| 139 | <value> |
| 140 | <struct> |
| 141 | <member> |
| 142 | <name>idmovieimdb</name> |
| 143 | <value><string>0119053</string></value> |
| 144 | </member> |
| 145 | <member> |
| 146 | <name>sublanguageid</name> |
| 147 | <value><string>cze</string></value> |
| 148 | </member> |
| 149 | <member> |
| 150 | <name>moviereleasename</name> |
| 151 | <value><string>Almost.Heroes.1998.DVDRip.XviD-FRAGMENT</string></value> |
| 152 | </member> |
| 153 | <member> |
| 154 | <name>movieaka</name> |
| 155 | <value><string/></value> |
| 156 | </member> |
| 157 | <member> |
| 158 | <name>subauthorcomment</name> |
| 159 | <value><string/></value> |
| 160 | </member> |
| 161 | </struct> |
| 162 | </value> |
| 163 | </member> |
| 164 | <member> |
| 165 | <name>cd1</name> |
| 166 | <value> |
| 167 | <struct> |
| 168 | <member> |
| 169 | <name>subhash</name> |
| 170 | <value><string>ebe86f4a0357d8c1d635ec49f77e27d6</string></value> |
| 171 | </member> |
| 172 | <member> |
| 173 | <name>subfilename</name> |
| 174 | <value><string>almost.heroes.1998.dvdrip.xvid.fragment.cze.srt</string></value> |
| 175 | </member> |
| 176 | <member> |
| 177 | <name>moviehash</name> |
| 178 | <value><string>89ceb12ab48e3b1f</string></value> |
| 179 | </member> |
| 180 | <member> |
| 181 | <name>moviebytesize</name> |
| 182 | <value><double>731508736</double></value> |
| 183 | </member> |
| 184 | <member> |
| 185 | <name>moviefps</name> |
| 186 | <value><double>23.976</double></value> |
| 187 | </member> |
| 188 | <member> |
| 189 | <name>movietimems</name> |
| 190 | <value><int>5413204</int></value> |
| 191 | </member> |
| 192 | <member> |
| 193 | <name>movieframes</name> |
| 194 | <value><int>129787</int></value> |
| 195 | </member> |
| 196 | <member> |
| 197 | <name>moviefilename</name> |
| 198 | <value><string>almost.heroes.1998.dvdrip.xvid.fragment.avi</string></value> |
| 199 | </member> |
| 200 | <member> |
| 201 | <name>subcontent</name> |
| 202 | <value><string>eNqMv ... gzipped and then base64-encoded subtitle file contents ... x7cPjA==</string></value> |
| 203 | </member> |
| 204 | </struct> |
| 205 | </value> |
| 206 | </member> |
| 207 | </struct> |
| 208 | </value> |
| 209 | </param> |
| 210 | </params> |
| 211 | </methodCall> |
| 212 | }}} |
| 213 | |
| 214 | |
| 215 | ==== Output ==== |
| 216 | |
| 217 | {{{ |
| 218 | #!xml |
| 219 | <methodResponse> |
| 220 | <params> |
| 221 | <param> |
| 222 | <value> |
| 223 | <struct> |
| 224 | <member> |
| 225 | <name>status</name> |
| 226 | <value><string>200 OK</string></value> |
| 227 | </member> |
| 228 | <member> |
| 229 | <name>data</name> |
| 230 | <value><string>http://www.opensubtitles.org/en/subtitles/3337919/almost-heroes-cs/sid-d5pnounn3ea5aja0nn4inqamf2</string></value> |
| 231 | </member> |
| 232 | <member> |
| 233 | <name>subtitles</name> |
| 234 | <value><boolean>0</boolean></value> |
| 235 | </member> |
| 236 | <member> |
| 237 | <name>seconds</name> |
| 238 | <value><double>1.705</double></value> |
| 239 | </member> |
| 240 | </struct> |
| 241 | </value> |
| 242 | </param> |
| 243 | </params> |
| 244 | </methodResponse> |
| 245 | }}} |
| 246 | |
| 247 | |
| 248 | ---- |
| 249 | === Notes === |
| 250 | |
| 251 | none yet |
| 252 | |
| 253 | |
| 254 | ---- |
| 255 | === See also === |
| 256 | |
| 257 | * [wiki:XmlRpcTryUploadSubtitles TryUploadSubtitles] |
| 258 | |
| 259 | |
| 260 | ---- |
| 261 | === Comments === |
| 262 | |
| 263 | add your comments, hints and suggestions here if you like ... |
| 264 | |
| 265 | |
| 266 | -------- |
| 267 | [wiki:XmlRpcTryUploadSubtitles Prev (TryUploadSubtitles)] [wiki:XmlRpcIntro Home] [Next] |