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.
dulf
Posts: 4
Joined: Sat Oct 17, 2009 3:40 pm

Partial Subtitles returned

Sat Oct 17, 2009 3:47 pm

I'm developing a small automatic subtitle downloader and i ran into a strange issue:
I identified my videofile using the hash,
I found a subtitle file using SearchSubtitles,
I found the IDSubtitleFile, and called DownloadSubtitles with that ID.

I got a datafield string back, decoded and ungzipped it, and now its only 16k.

If i search the site and locate the subtitles with that same ID its 47k..

what am I doing wrong?

here's the code:

Code: Select all

private string DownloadSubtitlesByFileId(string subtitleFileId) { string returnValue = string.Empty; string[] query = new string[] {subtitleFileId}; XmlRpcStruct response = _client.DownloadSubtitles(_token, query); object[] subtitleFiles = response["data"] as object[]; XmlRpcStruct firstSubTitleFile = subtitleFiles.FirstOrDefault() as XmlRpcStruct; string encodedSubtitles = firstSubTitleFile["data"] as string; byte[] zippedSubtitles = Convert.FromBase64String(encodedSubtitles); returnValue = UnZip(zippedSubtitles); return returnValue; } private string UnZip(byte[] byteArray) { //Prepare for decompress System.IO.MemoryStream ms = new System.IO.MemoryStream(byteArray); System.IO.Compression.GZipStream sr = new System.IO.Compression.GZipStream(ms, System.IO.Compression.CompressionMode.Decompress); //Reset variable to collect uncompressed result byteArray = new byte[byteArray.Length]; //Decompress int rByte = sr.Read(byteArray, 0, byteArray.Length); //Transform byte[] unzip data to string System.Text.StringBuilder sB = new System.Text.StringBuilder(rByte); //Read the number of bytes GZipStream red and do not a for each bytes in //resultByteArray; for (int i = 0; i < rByte; i++) { sB.Append((char)byteArray[i]); } sr.Close(); ms.Close(); sr.Dispose(); ms.Dispose(); return sB.ToString(); }

dulf
Posts: 4
Joined: Sat Oct 17, 2009 3:40 pm

Mon Oct 19, 2009 10:42 pm

56 reads and no reply?

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

Mon Nov 09, 2009 6:19 pm

56 reads and no reply?
A reply would come if there was inclination and knowledge. What does it matter the number of reads the topic has had? You've pasted code instead of explaining the logic and you haven't even said what language the code is in.

Also, you say you receive a short file but you don't say whether it's a truncated subtitle file or something else.

You don't include a sample moviehash and bytesize to try the same search nor the subtitle ID to compare.

You're surprised you don't get answers. I'm surprised you could ever get any.
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 27 guests