#NEWLINE# def convert_fm_topic_to_gcc( self , topic ) : #NEWLINE# #INDENT# 'Convert a fm topic using gcc instead of country code' #NEWLINE# if ( ( not ( topic [ : 10 ] == '/topic/fm/' ) ) or ( topic [ 13 ] == '/' ) ) : #NEWLINE# #INDENT# return topic #NEWLINE# #UNINDENT# self . logger . debug ( ( 'Converting %s to use gcc' % ( topic , ) ) ) #NEWLINE# def convert_topic( ) : #NEWLINE# #INDENT# splited_topic = topic . split ( '/' ) #NEWLINE# cc = splited_topic [ 3 ] #NEWLINE# self . logger . debug ( ( 'Querying gcc value for %s, nothing in cache !' % ( cc , ) ) ) #NEWLINE# result = self . do_query ( 'get_gcc' , { #NEWLINE# #INDENT# 'cc' : cc , #NEWLINE# #UNINDENT# } ) #NEWLINE# if ( result is None ) : #NEWLINE# #INDENT# self . logger . error ( 'No reply when convert_fm_topic_to_gcc ?' ) #NEWLINE# return topic #NEWLINE# #UNINDENT# splited_topic [ 3 ] = result [ 'gcc' ] #NEWLINE# return '/' . join ( splited_topic ) #NEWLINE# #UNINDENT# return self . cache . get ( key = ( 'topic-to-gcc-' + topic ) , createfunc = convert_topic )