Esempio n. 1
0
 def process(self, filepath, langs):
     ''' main method to call on the plugin, pass the filename and the wished 
     languages and it will query the subtitles source '''
     fname = self.getFileName(filepath)
     temp_lang = []
     
     #Convert subtitle language to plugin requirements
     temp_lang = []
     for x in langs:
         if x == "All":
             temp_lang = []
             break
         elif x == "None":
             pass
         else:
             #temp_lang.append(toOpenSubtitles_two(str(x)))
             temp_lang.append(languageTranslate(x, 0, 2))
     langs = temp_lang    
      #Convert subtitle language to plugin requirements
      
     try:
         subs = self.query(fname, langs)
         print str(subs)
         
         
         if not subs and fname.rfind(".[") > 0:
             # Try to remove the [VTV] or [EZTV] at the end of the file
             teamless_filename = fname[0 : fname.rfind(".[")]
             subs = self.query(teamless_filename, langs)
             return subs
         else:
             return subs
     except Exception, e:
         log.exception("Error raised by plugin")
         return []
Esempio n. 2
0
    def process(self, filepath, langs):
        ''' main method to call on the plugin, pass the filename and the wished
        languages and it will query the subtitles source '''

        #Convert subtitle language to plugin requirements
        temp_lang = []
        for x in langs:
            if x == "All":
                temp_lang = []
                break
            elif x == "None":
                pass
            else:
                #temp_lang.append(toOpenSubtitles_two(str(x)))
                temp_lang.append(languageTranslate(x, 0, 2))
        langs = temp_lang
        #Convert subtitle language to plugin requirements

        #fname = unicode(self.getFileName(filepath).lower())
        fname = self.getFileName(filepath).lower()
        guessedData = self.guessFileData(fname)
        if guessedData['type'] == 'tvshow':
            subs = self.query(guessedData['name'], guessedData['season'], guessedData['episode'], guessedData['teams'], langs)
            return subs
        else:
            return []
Esempio n. 3
0
    def process(self, filepath, langs):
        ''' main method to call on the plugin, pass the filename and the wished 
        languages and it will query the subtitles source '''
        fname = self.getFileName(filepath)
        temp_lang = []

        #Convert subtitle language to plugin requirements
        temp_lang = []
        for x in langs:
            if x == "All":
                temp_lang = []
                break
            elif x == "None":
                pass
            else:
                #temp_lang.append(toOpenSubtitles_two(str(x)))
                temp_lang.append(languageTranslate(x, 0, 2))
        langs = temp_lang
        #Convert subtitle language to plugin requirements

        try:
            subs = self.query(fname, langs)
            print str(subs)

            if not subs and fname.rfind(".[") > 0:
                # Try to remove the [VTV] or [EZTV] at the end of the file
                teamless_filename = fname[0:fname.rfind(".[")]
                subs = self.query(teamless_filename, langs)
                return subs
            else:
                return subs
        except Exception, e:
            log.exception("Error raised by plugin")
            return []
Esempio n. 4
0
    def process(self, filepath, langs):
        ''' main method to call on the plugin, pass the filename and the wished 
        languages and it will query the subtitles source '''
        
        #Convert subtitle language to plugin requirements
        temp_lang = []
        for x in langs:
            if x == "All":
                temp_lang = []
                break
            elif x == "None":
                pass
            else:
                #temp_lang.append(toOpenSubtitles_two(str(x)))
                temp_lang.append(languageTranslate(x, 0, 2))                
        langs = temp_lang
        #Convert subtitle language to plugin requirements
        
        #fname = unicode(self.getFileName(filepath).lower())
        fname = self.getFileName(filepath).lower()
        guessedData = self.guessFileData(fname)
        if guessedData['type'] == 'tvshow':
            subs = self.query(guessedData['name'], guessedData['season'], guessedData['episode'], guessedData['teams'], langs)
#            import os
#            os.system('echo "%s" > /txt' % subs)
            return subs
        else:
            return []
Esempio n. 5
0
    def process(self, filepath, langs):
        """ main method to call on the plugin, pass the filename and the wished 
        languages and it will query OpenSubtitles.org """

        # Convert subtitle language to plugin requirements
        temp_lang = []
        for x in langs:
            if x == "All":
                temp_lang = []
                break
            elif x == "None":
                pass
            else:
                # temp_lang.append(toOpenSubtitles_two(str(x)))
                temp_lang.append(languageTranslate(x, 0, 2))
        langs = temp_lang
        # Convert subtitle language to plugin requirements

        if os.path.isfile(filepath):
            filehash = self.hashFile(filepath)
            size = os.path.getsize(filepath)
            fname = self.getFileName(filepath)
            return self.query(moviehash=filehash, langs=langs, bytesize=size, filename=fname)
        else:
            fname = self.getFileName(filepath)
            return self.query(langs=langs, filename=fname)
Esempio n. 6
0
    def process(self, filepath, langs):
        ''' main method to call on the plugin, pass the filename and the wished
        languages and it will query OpenSubtitles.org '''

        #Convert subtitle language to plugin requirements
        temp_lang = []
        for x in langs:
            if x == "All":
                temp_lang = []
                break
            elif x == "None":
                pass
            else:
                #temp_lang.append(toOpenSubtitles_two(str(x)))
                temp_lang.append(languageTranslate(x, 0, 2))
        langs = temp_lang
        #Convert subtitle language to plugin requirements

        if os.path.isfile(filepath):
            filehash = self.hashFile(filepath)
            size = os.path.getsize(filepath)
            fname = self.getFileName(filepath)
            return self.query(moviehash=filehash,
                              langs=langs,
                              bytesize=size,
                              filename=fname)
        else:
            fname = self.getFileName(filepath)
            return self.query(langs=langs, filename=fname)
Esempio n. 7
0
            "fa":"per",
            "ro":"rum",
            "ru":"rus",
            "sr":"scc",
            "sl":"slv",
            "sv":"swe",
            "th":"tha",
            "tr":"tur",
            "uk":"ukr",
            "vi":"vie"}"""

OS_LANGS = {}
for x in LANGUAGES:
    # languageTranslate(x[0], 0, 2)
    # languageTranslate(x[0], 0, 3)
    OS_LANGS.update({languageTranslate(x[0], 0, 2): languageTranslate(x[0], 0, 3)})


class OpenSubtitle(SubtitleDatabase.SubtitleDB):
    url = "http://www.opensubtitles.org/"
    site_name = "OpenSubtitles"

    def __init__(self, config, cache_folder_path):
        super(OpenSubtitle, self).__init__(OS_LANGS)
        self.server_url = "http://api.opensubtitles.org/xml-rpc"
        self.revertlangs = dict(map(lambda item: (item[1], item[0]), self.langs.items()))

    def process(self, filepath, langs):
        """ main method to call on the plugin, pass the filename and the wished 
        languages and it will query OpenSubtitles.org """
Esempio n. 8
0
            "ro":"rum",
            "ru":"rus",
            "sr":"scc",
            "sl":"slv",
            "sv":"swe",
            "th":"tha",
            "tr":"tur",
            "uk":"ukr",
            "vi":"vie"}"""

OS_LANGS = {}
for x in LANGUAGES:
    #languageTranslate(x[0], 0, 2)
    #languageTranslate(x[0], 0, 3)
    OS_LANGS.update(
        {languageTranslate(x[0], 0, 2): languageTranslate(x[0], 0, 3)})


class OpenSubtitle(SubtitleDatabase.SubtitleDB):
    url = "http://www.opensubtitles.org/"
    site_name = "OpenSubtitles"

    def __init__(self, config, cache_folder_path):
        super(OpenSubtitle, self).__init__(OS_LANGS)
        self.server_url = 'http://api.opensubtitles.org/xml-rpc'
        self.revertlangs = dict(
            map(lambda item: (item[1], item[0]), self.langs.items()))

    def process(self, filepath, langs):
        ''' main method to call on the plugin, pass the filename and the wished
        languages and it will query OpenSubtitles.org '''
Esempio n. 9
0
            "fa":"per",
            "ro":"rum",
            "ru":"rus",
            "sr":"scc",
            "sl":"slv",
            "sv":"swe",
            "th":"tha",
            "tr":"tur",
            "uk":"ukr",
            "vi":"vie"}"""

OS_LANGS = {}
for x in LANGUAGES:
  #languageTranslate(x[0], 0, 2)
  #languageTranslate(x[0], 0, 3)
  OS_LANGS.update({languageTranslate(x[0], 0, 2): languageTranslate(x[0], 0, 3)})


class OpenSubtitle(SubtitleDatabase.SubtitleDB):
    url = "http://www.opensubtitles.org/"
    site_name = "OpenSubtitles"

    def __init__(self, config, cache_folder_path):
        super(OpenSubtitle, self).__init__(OS_LANGS)
        self.server_url = 'http://api.opensubtitles.org/xml-rpc'
        self.revertlangs = dict(map(lambda item: (item[1], item[0]), self.langs.items()))

    def process(self, filepath, langs):
        ''' main method to call on the plugin, pass the filename and the wished
        languages and it will query OpenSubtitles.org '''