#NEWLINE# def tvrageEpisode( self , tvrage , title , date , season , episode ) : #NEWLINE# #INDENT# monthMap = { #NEWLINE# #INDENT# '01' : 'Jan' , #NEWLINE# '02' : 'Feb' , #NEWLINE# '03' : 'Mar' , #NEWLINE# '04' : 'Apr' , #NEWLINE# '05' : 'May' , #NEWLINE# '06' : 'Jun' , #NEWLINE# '07' : 'Jul' , #NEWLINE# '08' : 'Aug' , #NEWLINE# '09' : 'Sep' , #NEWLINE# '10' : 'Oct' , #NEWLINE# '11' : 'Nov' , #NEWLINE# '12' : 'Dec' , #NEWLINE# #UNINDENT# } #NEWLINE# title = cleantitle . tv ( title ) #NEWLINE# try : #NEWLINE# #INDENT# url = ( self . tvrage_link % tvrage ) #NEWLINE# result = client . request ( url , timeout = '5' ) #NEWLINE# search = re . compile ( '<td.+?><a.+?title=.+?season.+?episode.+?>(\\d+?)x(\\d+?)<.+?<td.+?>(\\d+?/.+?/\\d+?)<.+?<td.+?>.+?href=.+?>(.+?)<' ) . findall ( result . replace ( '\n' , '' ) ) #NEWLINE# d = ( '%02d/%s/%s' % ( int ( date . split ( '-' ) [ 2 ] ) , monthMap [ date . split ( '-' ) [ 1 ] ] , date . split ( '-' ) [ 0 ] ) ) #NEWLINE# match = [ d for i in search if ( d == i [ 2 ] ) ] #NEWLINE# if ( len ( match ) == 1 ) : #NEWLINE# #INDENT# return ( str ( ( '%01d' % int ( match [ 0 ] [ 0 ] ) ) ) , str ( ( '%01d' % int ( match [ 0 ] [ 1 ] ) ) ) ) #NEWLINE# #UNINDENT# match = [ i for i in search if ( title == cleantitle . tv ( i [ 3 ] ) ) ] #NEWLINE# if ( len ( match ) == 1 ) : #NEWLINE# #INDENT# return ( str ( ( '%01d' % int ( match [ 0 ] [ 0 ] ) ) ) , str ( ( '%01d' % int ( match [ 0 ] [ 1 ] ) ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# except : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# url = ( self . epguides_link % tvrage ) #NEWLINE# result = client . request ( url , timeout = '5' ) #NEWLINE# search = re . compile ( '\\d+?,(\\d+?),(\\d+?),.+?,(\\d+?/.+?/\\d+?),"(.+?)",.+?,".+?"' ) . findall ( result ) #NEWLINE# d = ( '%02d/%s/%s' % ( int ( date . split ( '-' ) [ 2 ] ) , monthMap [ date . split ( '-' ) [ 1 ] ] , date . split ( '-' ) [ 0 ] [ ( - 2 ) : ] ) ) #NEWLINE# match = [ i for i in search if ( d == i [ 2 ] ) ] #NEWLINE# if ( len ( match ) == 1 ) : #NEWLINE# #INDENT# return ( str ( ( '%01d' % int ( match [ 0 ] [ 0 ] ) ) ) , str ( ( '%01d' % int ( match [ 0 ] [ 1 ] ) ) ) ) #NEWLINE# #UNINDENT# match = [ i for i in search if ( title == cleantitle . tv ( i [ 3 ] ) ) ] #NEWLINE# if ( len ( match ) == 1 ) : #NEWLINE# #INDENT# return ( str ( ( '%01d' % int ( match [ 0 ] [ 0 ] ) ) ) , str ( ( '%01d' % int ( match [ 0 ] [ 1 ] ) ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# except : #NEWLINE# #INDENT# pass