Ejemplo n.º 1
0
def check_exists(File):
    global userAgent, SearchMethod, SleepTime

    Headers = {
        'User-Agent': userAgent,
    }

    #langList = [ 'en', 'pl', 'pt', 'ru', 'hu', 'it', 'br', 'cz', 'de' ]

    try:
        Connection = httplib.HTTPConnection('subscene.com', 80, timeout=HTTPTimeout)
        Connection.request("GET", "/s.aspx?q="+convertToQuery(subgetcore.getSearchKeywords(File, True)), headers=Headers)
        Response = Connection.getresponse()
    except Exception as e:
        print("[plugin:subscene] Connection timed out, err: "+str(e))

    plainResponse = Response.read()

    if "No results found." in plainResponse:
        print("[plugin:subscene] No any matches in database found")
        return False


    if Response.status == 200:
        #<a href="/english/Ganz-The-Perfect-Answer-Gantz-Part-2/subtitle-481694.aspx"
        plainResponse = plainResponse.replace("\r", " ")
        plainResponse = plainResponse.replace("\n", " ")
        plainResponse = plainResponse.replace("\t", " ")
        subsFound = re.findall("\<a class\=\"a1\" href\=\"\/([a-z-A-Z\-]+)/([A-Za-z\_\-0-9]+)/subtitle-([0-9]+)\.aspx\" title=\"([A-Za-z_\-\ 0-9\&\^\%\$\#\@\!\*\(\)\+\=]+)\"\>", plainResponse)

        # No subtitles found!
        if not subsFound:
            return False

        sublist = list()

        for sub in subsFound:
            try:
                Language = subgetcore.languageFromName(sub[0])
                LinkName = sub[1]
                ID = str(sub[2])

                title = re.findall("\<span id\=\"r"+ID+"\"\>([A-Za-z0-9\_\-\&\^\%\$\#\@\!\&\(\)\+\=\:\;\'\\\"\ ĘęÓ󥹌śŁłŻżŹźĆćŃń\.\,]+)\<\/span\>", plainResponse)

                if title:
                    title = title[0]
                else:
                    title = LinkName

                # append to list
                sublist.append({'lang': Language, 'site' : 'subscene.com', 'title' : title, 'domain': 'subscene.com', 'data': {'file': File, 'link': "/"+sub[0]+"/"+sub[1]+"/subtitle-"+sub[2]+".aspx", 'lang': sub[0], 'linkname': sub[1], 'subid': ID}, 'file': File})

            except Exception as e:
                print("[plugin:subscene] Exception catched, "+str(e))

        return sublist
    else:
        print("[plugin:subscene] Not found for "+File+", server returned code \""+str(Response.status)+"\"")
        return False
Ejemplo n.º 2
0
    def check_exists(self, File, resultsClass):
        if File is not None:
            movieName = subgetcore.getSearchKeywords(os.path.basename(File))

            if movieName:
                subtitleList = self.getListOfSubtitles(movieName, File, resultsClass)
                return True
            else:
                # This isn't a constant, this is a string-error code that subget recognize
                return subgetcore.NOT_FOUND

        else:
            return subgetcore.NOT_FOUND
Ejemplo n.º 3
0
    def check_exists(self, File, resultsClass):
        if File is not None:
            movieName = subgetcore.getSearchKeywords(os.path.basename(File))
            movieName = self.getMovieName(movieName)

            if movieName:
                result = self.getListOfSubtitles(movieName, File, resultsClass)

                if result is not None and result:
                    return resultsClass
                else:
                    return {'errInfo': "NOT_FOUND"}
        else:
            return {'errInfo': "NOT_FOUND"}
Ejemplo n.º 4
0
    def check_exists(self, File, resultsClass):
        if File is not None:
            movieName = subgetcore.getSearchKeywords(os.path.basename(File))
            movieName = self.getMovieName(movieName)

            if movieName:
                result = self.getListOfSubtitles(movieName, File, resultsClass)

                if result is not None and result:
                    return resultsClass
                else:
                    return {'errInfo': "NOT_FOUND"}
        else:
            return {'errInfo': "NOT_FOUND"}
Ejemplo n.º 5
0
    def check_exists(self, File, resultsClass):
        self.Subget.Logging.output("napisy24.pl is temporary disabled because of required authentication changes", "debug", False)
        return {'errInfo': "NOT_FOUND"}

        if File is not None:
            movieName = subgetcore.getSearchKeywords(os.path.basename(File))

            if movieName:
                subtitleList = self.getListOfSubtitles(movieName, File, resultsClass)
                return True
            else:
                # This isn't a constant, this is a string-error code that subget recognize
                return {'errInfo': "NOT_FOUND"}

        else:
            return {'errInfo': "NOT_FOUND"}
Ejemplo n.º 6
0
    def check_exists(self, File, results):
        global subgetObject
        global language

        if File is not None:
            movieName = subgetcore.getSearchKeywords(os.path.basename(File))
             
            if movieName:
                #!!!: this var is unused
                subtitleList = self.getListOfSubtitles(movieName, File, results)
                return True
            else:
                return {'errInfo': "NOT_FOUND"}

        else:
            return {'errInfo': "NOT_FOUND"}
Ejemplo n.º 7
0
    def check_exists(self, File, results):
        global subgetObject
        global language

        if File is not None:
            movieName = subgetcore.getSearchKeywords(os.path.basename(File))
             
            if movieName:
                #!!!: this var is unused
                subtitleList = self.getListOfSubtitles(movieName, File, results)
                return True
            else:
                return subgetcore.NOT_FOUND

        else:
            return subgetcore.NOT_FOUND
Ejemplo n.º 8
0
    def check_exists(self, File, resultsClass):
        self.Subget.Logging.output(
            "napisy24.pl is temporary disabled because of required authentication changes",
            "debug", False)
        return {'errInfo': "NOT_FOUND"}

        if File is not None:
            movieName = subgetcore.getSearchKeywords(os.path.basename(File))

            if movieName:
                subtitleList = self.getListOfSubtitles(movieName, File,
                                                       resultsClass)
                return True
            else:
                # This isn't a constant, this is a string-error code that subget recognize
                return {'errInfo': "NOT_FOUND"}

        else:
            return {'errInfo': "NOT_FOUND"}
Ejemplo n.º 9
0
def check_exists(File):
    global userAgent, SearchMethod, SleepTime

    Headers = {
        'User-Agent': userAgent,
    }

    #langList = [ 'en', 'pl', 'pt', 'ru', 'hu', 'it', 'br', 'cz', 'de' ]

    try:
        Connection = httplib.HTTPConnection('subscene.com',
                                            80,
                                            timeout=HTTPTimeout)
        Connection.request(
            "GET",
            "/s.aspx?q=" +
            convertToQuery(subgetcore.getSearchKeywords(File, True)),
            headers=Headers)
        Response = Connection.getresponse()
    except Exception as e:
        print("[plugin:subscene] Connection timed out, err: " + str(e))

    plainResponse = Response.read()

    if "No results found." in plainResponse:
        print("[plugin:subscene] No any matches in database found")
        return False

    if Response.status == 200:
        #<a href="/english/Ganz-The-Perfect-Answer-Gantz-Part-2/subtitle-481694.aspx"
        plainResponse = plainResponse.replace("\r", " ")
        plainResponse = plainResponse.replace("\n", " ")
        plainResponse = plainResponse.replace("\t", " ")
        subsFound = re.findall(
            "\<a class\=\"a1\" href\=\"\/([a-z-A-Z\-]+)/([A-Za-z\_\-0-9]+)/subtitle-([0-9]+)\.aspx\" title=\"([A-Za-z_\-\ 0-9\&\^\%\$\#\@\!\*\(\)\+\=]+)\"\>",
            plainResponse)

        # No subtitles found!
        if not subsFound:
            return False

        sublist = list()

        for sub in subsFound:
            try:
                Language = subgetcore.languageFromName(sub[0])
                LinkName = sub[1]
                ID = str(sub[2])

                title = re.findall(
                    "\<span id\=\"r" + ID +
                    "\"\>([A-Za-z0-9\_\-\&\^\%\$\#\@\!\&\(\)\+\=\:\;\'\\\"\ ĘęÓ󥹌śŁłŻżŹźĆćŃń\.\,]+)\<\/span\>",
                    plainResponse)

                if title:
                    title = title[0]
                else:
                    title = LinkName

                # append to list
                sublist.append({
                    'lang': Language,
                    'site': 'subscene.com',
                    'title': title,
                    'domain': 'subscene.com',
                    'data': {
                        'file':
                        File,
                        'link':
                        "/" + sub[0] + "/" + sub[1] + "/subtitle-" + sub[2] +
                        ".aspx",
                        'lang':
                        sub[0],
                        'linkname':
                        sub[1],
                        'subid':
                        ID
                    },
                    'file': File
                })

            except Exception as e:
                print("[plugin:subscene] Exception catched, " + str(e))

        return sublist
    else:
        print("[plugin:subscene] Not found for " + File +
              ", server returned code \"" + str(Response.status) + "\"")
        return False