def external_download(song, filename, url):
 cmd = config.DOWNLOAD_COMMAND.get
 (ddir, basename) = (config.DDIR.get, os.path.basename(filename))
 cmd_list = shlex.split(cmd)
 def list_string_sub(orig, repl, lst):
  ' Replace substrings for items in a list. '
  return [(x if (orig not in x) else x.replace(orig, repl)) for x in lst]
 cmd_list = list_string_sub('%F', filename, cmd_list)
 cmd_list = list_string_sub('%d', ddir, cmd_list)
 cmd_list = list_string_sub('%f', basename, cmd_list)
 cmd_list = list_string_sub('%u', url, cmd_list)
 cmd_list = list_string_sub('%i', song.ytid, cmd_list)
 util.dbg('Downloading using: %s', ' '.join(cmd_list))
 subprocess.call(cmd_list)

def external_download ( song , filename , url ) : cmd = config . DOWNLOAD_COMMAND . get ( ddir , basename ) = ( config . DDIR . get , os . path . basename ( filename ) ) cmd_list = shlex . split ( cmd ) def list_string_sub ( orig , repl , lst ) : return [ ( x if ( orig not in x ) else x . replace ( orig , repl ) ) for x in lst ] cmd_list = list_string_sub ( '%F' , filename , cmd_list ) cmd_list = list_string_sub ( '%d' , ddir , cmd_list ) cmd_list = list_string_sub ( '%f' , basename , cmd_list ) cmd_list = list_string_sub ( '%u' , url , cmd_list ) cmd_list = list_string_sub ( '%i' , song . ytid , cmd_list ) util . dbg ( 'Downloading using: %s' , ' ' . join ( cmd_list ) ) subprocess . call ( cmd_list )
perform download using external application .