Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

update opensubtitle api url (not working..)

  • Loading branch information...
commit 6da1c0b758993ce21a59a954b4136cf63274e5ae 1 parent f14b512
Marcos Piccinini authored
1  bin/subtitle_it
@@ -4,6 +4,7 @@
4 4 # Created on 2008-09-04.
5 5 # Copyleft (c) 2008. MIT License.
6 6 #
  7 +$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
7 8 begin
8 9 require 'rubygems'
9 10 rescue LoadError
3  lib/subtitle_it/languages.rb
@@ -4,6 +4,8 @@ module SubtitleIt
4 4 # Cze => Czech ....
5 5 #
6 6 # LANGUAGE / HUMAN NAME / OPENSUBTITLE CODE
  7 + #
  8 + # Need to rewrite "Portuguese" => [:pt, :por, :whatever]
7 9 LANGS = {
8 10 :aa => 'Afar',
9 11 :ab => 'Abkhazian',
@@ -58,4 +60,5 @@ module SubtitleIt
58 60 :ro => 'Romanian',
59 61 :zh => 'Chinese'
60 62 }
  63 +
61 64 end
13 lib/subtitle_it/subdown.rb
@@ -9,7 +9,7 @@
9 9
10 10 module SubtitleIt
11 11 class Subdown
12   - HOST = "http://www.opensubtitles.org/xml-rpc"
  12 + HOST = "http://api.opensubtitles.org/xml-rpc"
13 13 HOST_DEV = "http://dev.opensubtitles.org/xml-rpc"
14 14
15 15 USER_AGENT = "SubtitleIt #{SubtitleIt::VERSION::STRING}"
@@ -70,12 +70,13 @@ def imdb_info(movie)
70 70 movie.info = result['data'][movie.haxx] # TODO: Handle if no result for movie
71 71 end
72 72
73   -# def subtitle_languages
74   -# LANGS.map { |l| l[0].to_s }
75   - # TODO.. get the correct codes
76   -# end
  73 + def self.subtitle_languages
  74 + LANGS.map do |k, v|
  75 + "#{k} -> #{v}"
  76 + end.join("\n")
  77 + end
77 78 #
78   -# def Subdown.opsub_id( language ) # Get the Opensubtitle.org language id from the language string (e.g. 'French' returns 'fra' )
  79 +# def Subdown.opsub_id( language ) # Get the Opensubtitle.org language id from the language string (e.g. 'French' returns 'fra' )
79 80 # ary = LANGS.find do |sym_lang|
80 81 # sym_lang if sym_lang[1].downcase == language.downcase
81 82 # end

0 comments on commit 6da1c0b

Please sign in to comment.
Something went wrong with that request. Please try again.