def _transcripts_logic(transcripts_presence, videos):
 command = None
 subs = ''
 if (transcripts_presence['youtube_diff'] and transcripts_presence['youtube_local'] and transcripts_presence['youtube_server']):
  command = 'replace'
  subs = videos['youtube']
 elif transcripts_presence['youtube_local']:
  command = 'found'
  subs = videos['youtube']
 elif transcripts_presence['youtube_server']:
  command = 'import'
 elif transcripts_presence['html5_local']:
  if ((len(transcripts_presence['html5_local']) == 1) or transcripts_presence['html5_equal']):
   command = 'found'
   subs = transcripts_presence['html5_local'][0]
  else:
   command = 'choose'
   subs = transcripts_presence['html5_local'][0]
 elif (transcripts_presence['current_item_subs'] and (not transcripts_presence['is_youtube_mode'])):
  log.debug('Command is use existing %s subs', transcripts_presence['current_item_subs'])
  command = 'use_existing'
 else:
  command = 'not_found'
 log.debug('Resulted command: %s, current transcripts: %s, youtube mode: %s', command, transcripts_presence['current_item_subs'], transcripts_presence['is_youtube_mode'])
 return (command, subs)

def _transcripts_logic ( transcripts_presence , videos ) : command = None subs = '' if ( transcripts_presence [ 'youtube_diff' ] and transcripts_presence [ 'youtube_local' ] and transcripts_presence [ 'youtube_server' ] ) : command = 'replace' subs = videos [ 'youtube' ] elif transcripts_presence [ 'youtube_local' ] : command = 'found' subs = videos [ 'youtube' ] elif transcripts_presence [ 'youtube_server' ] : command = 'import' elif transcripts_presence [ 'html5_local' ] : if ( ( len ( transcripts_presence [ 'html5_local' ] ) == 1 ) or transcripts_presence [ 'html5_equal' ] ) : command = 'found' subs = transcripts_presence [ 'html5_local' ] [ 0 ] else : command = 'choose' subs = transcripts_presence [ 'html5_local' ] [ 0 ] elif ( transcripts_presence [ 'current_item_subs' ] and ( not transcripts_presence [ 'is_youtube_mode' ] ) ) : log . debug ( 'Command is use existing %s subs' , transcripts_presence [ 'current_item_subs' ] ) command = 'use_existing' else : command = 'not_found' log . debug ( 'Resulted command: %s, current transcripts: %s, youtube mode: %s' , command , transcripts_presence [ 'current_item_subs' ] , transcripts_presence [ 'is_youtube_mode' ] ) return ( command , subs )
by transcripts_presence content .