abbi031892 / periscope

Automatically exported from code.google.com/p/periscope
0 stars 0 forks source link

[enhancement] Support for thesubdb.com #28

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi,
any possibility of include thesubdb.com subtitle provider on periscope? SubDB 
is a great source of portuguese subtitles for new TV shows and movies (it 
support a bunch of other languages as well as you can see in 
http://blog.thesubdb.com/ ). The search is based on hash, but the algorithm is 
pretty simple and the demo client is written in python. So I think it wouldn't 
be a problem to integrate the code.

The SubDB API documentation can be found at:
http://thesubdb.com/api

SubDB demo client:
http://github.com/jrhames/pyrrot-cli

Thanks in advance.

Original issue reported on code.google.com by xikinhu@gmail.com on 16 Aug 2010 at 12:17

GoogleCodeExporter commented 8 years ago
It seems to be a pretty straightforward REST API to make the request. It should 
be fast and easy to include into periscope.

I'd however like to have one more method available but can't find the contact 
page on thesubdb.com website and the twitter account does not allow for direct 
messages.

Original comment by patrick....@gmail.com on 16 Aug 2010 at 7:50

GoogleCodeExporter commented 8 years ago
What method do you need? I can get it done for you.

Original comment by xikinhu@gmail.com on 16 Aug 2010 at 1:26

GoogleCodeExporter commented 8 years ago
I suppose you're the guy behind thesubdb.com or you know the guy behind it. In 
the following, I'll consider you as the admin/developer behind the API.

Currently, for what I've read, thesubdb.com provides a GET to download 
subtitles and a POST to upload subtitles

periscope works in two steps : first a GET to list subtitles (but not download 
them) from all the know websites and then a GET to download the subtitle. This 
allows me to first list a bunch of subtitles and then select the one I really 
want (the selection algorithm is currently pretty simple and takes only into 
account the language but this could grow into a more complex logic later on)

So what I'd like is REST call like:
http://api.thesubdb.com/?action=search&language=pt,en&hash=edc1981d6459c6111fe36
205b4aff6c2
That would return a JSON (or XML if you prefer, but JSON is usually the norm 
for REST APIs) with probably just available : True/False.

This way I can make a query but without actually downloading a subtitle (that's 
for bandwith efficiency, yours and mine)

If you could also tell me if you plan to support languages in a country 
specific variation ? Will there be at some point pt subtitles (for Portuguese), 
while also having pt-br (for people that specifically want Brazilian Portugues 
subtitles).

A REST call to list languages would also be nice, you've got the code to show 
them in the statistics section, so it should be pretty trivial :
http://api.thesubdb.com/?action=languages

I've already been asked to support upload (by the OpenSubtitles.org admin), 
when I'll add this, I'll add support for upload on your thesubdb.com as well.

Original comment by patrick....@gmail.com on 16 Aug 2010 at 1:41

GoogleCodeExporter commented 8 years ago
We already have an undocumented API function called search that returns the 
available languages for a hash. The use is: 
http://api.thesubdb.com/?action=search&hash=edc1981d6459c6111fe36205b4aff6c2

It'll return a list of available languages separated by comma, ex.:
pt,en,ru

If there isn't a subtitle for the given hash, 404 is returned. I can add a flag 
to return the result in another format if you desire. I'll add this function to 
the documentation this week and the languages method to the top of my to-do 
list.

About the upload, It would be great. If you need any help, please, let me know.

Original comment by xikinhu@gmail.com on 16 Aug 2010 at 2:56

GoogleCodeExporter commented 8 years ago
Ok, the undocumented search should be enough. Your example link returns a 412 
error code though (maybe it's still beta).

If I could give you some advice about API functions, I would tell you to take a 
look at REST API and JSON technologies, that's what most people are using for 
APIs today (from Twitter to Google, Flickr, Facebook, ...)

Original comment by patrick....@gmail.com on 16 Aug 2010 at 3:56

GoogleCodeExporter commented 8 years ago
Are you using the correct User-Agent to do the requests? See the section 
User-Agent at the API documentation.

Original comment by xikinhu@gmail.com on 16 Aug 2010 at 4:12

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Patrick, I forgot to mention that, the reason why we don't have a separation 
between portuguese/brazilian portuguese (or english uk/us, etc) is because 
Google Language Detect API can't differ those. As the majority of the users 
from SubDB are from Brazil, we assumed brazilian portuguese as default. This is 
not the best solution, but I don't think this is gonna change in a near future. 
We choose to provide the service as simple as it can be for both developers and 
users and the way it is now, developers can simple upload a subtitle file with 
a video file hash and SubDB will do the rest.

Original comment by xikinhu@gmail.com on 17 Aug 2010 at 1:25

GoogleCodeExporter commented 8 years ago
I've just committed the TheSubDB plugin for periscope.

For info, you should write in the documentation that the sandbox does not 
return most subtitle with the download command or at least provide an empty srt 
like you did for the sample hash from the doc.

I was puzzled when using the search command I got a result but then the 
download gave me a 404 error.

I did not have much files that where in your database, so if you have the time, 
could you take a copy of svn, remove other plugins from the __init__.py file in 
the plugin folder so that only TheSubDB stays and run a few tests with files 
you have ?

Original comment by patrick....@gmail.com on 24 Aug 2010 at 5:57

GoogleCodeExporter commented 8 years ago
Thanks Patrick. I'll check it out and run a few tests when I get home.

Original comment by xikinhu@gmail.com on 24 Aug 2010 at 6:25

GoogleCodeExporter commented 8 years ago
I just made a few tests as I promised, and the SubDB plugin appears to be 
working as expected. I have successfully downloaded 8 subtitles with it.

Original comment by xikinhu@gmail.com on 25 Aug 2010 at 2:27