[[PageOutline(3-4, Sections)]]
== !SearchSubtitles ==
=== Intro ===
search for subtitle files matching your videos using either video file hashes or IMDb IDs.
=== Description ===
'''struct !SearchSubtitles(string $token, array(struct('sublanguageid' => string $sublanguageid, 'moviehash' => string $moviehash, 'moviebytesize' => int $moviesize, 'imdbid' => string $imdbid ), struct(...)))'''
This function can be used to search for subtitle files.
There are two ways to call it:
1. using video file hashes (more at once allowed):
Search the database using video file hashes to get exact matches for your video files.
2. using IMDb IDs:
If method 1 returns no subtitle files, you can use this method to search for subtitle files matching given ''imdbid''.
You'll most probably have to synchronize the subtitles yourself or try more to find a match. If you find one, please, contribute by uploading them using [wiki:XmlRpcUploadSubtitles UploadSubtitles] method.
When this method is used you don't have to specify ''moviehash'' and ''moviebytesize''.
Some fields (IDSubMovieFile, !MovieHash, !MovieByteSize, MovieTimeMS) are missing in output when using this method.
If ''sublanguageid'' is empty or contains the string 'all' - search is performed for all languages.
Also remember you can not combine ''imdbid'' and ''moviehash'' searches in one call.
=== Parameters ===
First parameter is the session ''token'', second is the list of video files using this structure:
{{{
array( <--- array/list of video files
struct( <--- information about one video file
(string) [sublanguageid],
(string) [moviehash],
(double) [moviebytesize],
(string) [imdbid]
), struct( ), ...
}
}}}
''token'' (required)::
token string identifying user's session, taken from [wiki:XmlRpcLogIn LogIn] result structure.
''sublanguageid''::
list of language ISO639-3 language codes to search for, divided by ',' (e.g. 'cze,eng,slo'),
see [wiki:XmlRpcGetSubLanguages GetSubLanguages] function for a list of available languages
''moviehash''::
video file hash as calculated by one of the implementation functions as seen on [wiki:HashSourceCodes Hash Source Codes] page
''moviebytesize''::
size of video file in bytes
''imdbid'' (optional)::
[http://www.imdb.com IMDb] ID of movie this video is part of, belongs to.
=== Return Values ===
Output is returned in this structure:
{{{
struct(
array(
struct( subfile ), struct( subfile ), ...
) [data],
(double) [seconds]
)
}}}
and contains these elements:
''data''::
array of found subtitle file matches, when no matches are found ''data'' is empty.
''subfile''::
structure that holds the subtitle file information, see [wiki:XmlRpcStruSubFile subtitle file structure]
''seconds''::
time taken to execute this command on server
=== Implementations ===
There are currently no available sample implementations.
=== Changelog ===
Version 1: created this function
Version 2: added search by IMDb ID
=== Examples ===
==== Input ====
{{{
#!xml
SearchSubtitles
5fdgt2e9qriblpbojnq0j46op1
sublanguageid
cze,eng,ger,slo
moviehash
7d9cd5def91c9432
moviebytesize
735934464
}}}
==== Output ====
{{{
#!xml
data
IDSubMovieFile
144635
MovieHash
7d9cd5def91c9432
MovieByteSize
735934464
MovieTimeMS
6631000
IDSubtitleFile
1951854837
SubFileName
nedivx-27dresses.en.HI.srt
SubActualCD
1
SubSize
149346
SubHash
d7fb67a524f86b83245a927d7b2d0b75
IDSubtitle
3272414
UserID
451347
SubLanguageID
eng
SubFormat
srt
SubSumCD
1
SubAuthorComment
Extracted from DVD. Hearing Impaired.
SubAddDate
2008-04-15 01:51:02
SubBad
0
SubRating
10.0
SubDownloadsCnt
1013
MovieReleaseName
27.Dresses.DVDRip.XviD-NeDiVx (Hearing Impaired)
IDMovie
30833
IDMovieImdb
988595
MovieName
27 Dresses
MovieNameEng
MovieYear
2008
MovieImdbRating
6.2
UserNickName
LeapinLar
ISO639
en
LanguageName
English
SubDownloadLink
http://www.opensubtitles.org/en/download/file/1951854837.gz
ZipDownloadLink
http://www.opensubtitles.org/en/download/sub/3272414
... more subtitle file structures go here (if any) ...
seconds
0.02
}}}
=== Notes ===
* results are always grouped by !MovieHash, !MovieByteSize, SubLanguageID, IDSubMovieFile and sorted by seencount descending, maximum number of results is 250.
* field '!MovieFrames' isn't being sent from the server. Make this field optional or just remove it.
=== See also ===
* [wiki:XmlRpcDownloadSubtitles DownloadSubtitles]
* [wiki:XmlRpcUploadSubtitles UploadSubtitles]
=== Comments ===
add your comments, hints and suggestion here if you like ...
[Prev] [wiki:XmlRpcIntro Home] [Next]