parameters: ()
docstring: Change variables through a user supplied configuration file
      abort the script if there are issues with the configuration file values
docstring_summary: Change variables through a user supplied configuration file
      abort the script if there are issues with the configuration file values
docstring_tokens: Change variables through a user supplied configuration file abort the script if there are issues with the configuration file values
function: def setUseroptions():
      """    Change variables through a user supplied configuration file
      abort the script if there are issues with the configuration file values
      """
      global simulation, verbose, channel_icon_override, channel_watch_only, channel_mythvideo_only
      global vid_graphics_dirs, tv_channels, movie_trailers, filename_char_filter
  
      useroptions=u"~/.mythtv/mirobridge.conf"
  
      if useroptions[0]==u'~':
          useroptions=os.path.expanduser(u"~")+useroptions[1:]
      if os.path.isfile(useroptions) == False:
          logger.info(
              u"There was no mirobridge configuration file found (%s)" % useroptions)
          return
  
      cfg = ConfigParser.SafeConfigParser()
      cfg.read(useroptions)
      for section in cfg.sections():
          if section[:5] == u'File ':
              continue
          if section == u'variables':
              for option in cfg.options(section):
                  if option == u'filename_char_filter':
                      for char in cfg.get(section, option):
                          filename_char_filter+=char
                      continue
          if section == u'icon_override':
              # Add the Channel names to the array of Channels that are to use their item's icon
              for option in cfg.options(section):
                  channel_icon_override.append(option)
              continue
          if section == u'watch_only':
              # Add the Channel names to the array of Channels that will only not be moved to MythVideo
              for option in cfg.options(section):
                  if option == u'all miro channels':
                      channel_watch_only = [u'all']
                      break
                  else:
                      channel_watch_only.append(filter(is_not_punct_char, option.lower()))
              continue
          if section == u'mythvideo_only':
              # Add the Channel names to the array of Channels that will be moved to MythVideo only
              for option in cfg.options(section):
                  if option == u'all miro channels':
                      channel_mythvideo_only[u'all'] = cfg.get(section, option)
                      break
                  else:
                      channel_mythvideo_only[filter(is_not_punct_char, option.lower())] = \
                                  cfg.get(section, option)
              for key in channel_mythvideo_only.keys():
                  if not channel_mythvideo_only[key].startswith(vid_graphics_dirs[u'mythvideo']):
                      logger.critical((u"All Mythvideo only configuration (%s) directories (%s) must "\
                                       u"be a subdirectory of the MythVideo base directory (%s).") % \
                                              (key, channel_mythvideo_only[key],
                                               vid_graphics_dirs[u'mythvideo']))
                      sys.exit(1)
                  if channel_mythvideo_only[key][-1] != u'/':
                      channel_mythvideo_only[key]+=u'/'
              continue
          if section == u'watch_then_copy':
              # Add the Channel names to the array of Channels once watched will be copied to MythVideo
              for option in cfg.options(section):
                  if option == u'all miro channels':
                      channel_new_watch_copy[u'all'] = cfg.get(section, option)
                      break
                  else:
                      channel_new_watch_copy[filter(is_not_punct_char, option.lower())] =\
                                   cfg.get(section, option)
              for key in channel_new_watch_copy.keys():
                  if not channel_new_watch_copy[key].startswith(vid_graphics_dirs[u'mythvideo']):
                      logger.critical((u"All 'new->watch->copy' channel (%s) directory (%s) must "\
                                       u"be a subdirectory of the MythVideo base directory (%s).") % \
                                                  (key, channel_new_watch_copy[key],
                                                   vid_graphics_dirs[u'mythvideo']))
                      sys.exit(1)
                  if channel_new_watch_copy[key][-1] != u'/':
                      channel_new_watch_copy[key]+=u'/'
              continue
function_tokens: def setUseroptions ( ) : global simulation , verbose , channel_icon_override , channel_watch_only , channel_mythvideo_only global vid_graphics_dirs , tv_channels , movie_trailers , filename_char_filter useroptions = u"~/.mythtv/mirobridge.conf" if useroptions [ 0 ] == u'~' : useroptions = os . path . expanduser ( u"~" ) + useroptions [ 1 : ] if os . path . isfile ( useroptions ) == False : logger . info ( u"There was no mirobridge configuration file found (%s)" % useroptions ) return cfg = ConfigParser . SafeConfigParser ( ) cfg . read ( useroptions ) for section in cfg . sections ( ) : if section [ : 5 ] == u'File ' : continue if section == u'variables' : for option in cfg . options ( section ) : if option == u'filename_char_filter' : for char in cfg . get ( section , option ) : filename_char_filter += char continue if section == u'icon_override' : # Add the Channel names to the array of Channels that are to use their item's icon for option in cfg . options ( section ) : channel_icon_override . append ( option ) continue if section == u'watch_only' : # Add the Channel names to the array of Channels that will only not be moved to MythVideo for option in cfg . options ( section ) : if option == u'all miro channels' : channel_watch_only = [ u'all' ] break else : channel_watch_only . append ( filter ( is_not_punct_char , option . lower ( ) ) ) continue if section == u'mythvideo_only' : # Add the Channel names to the array of Channels that will be moved to MythVideo only for option in cfg . options ( section ) : if option == u'all miro channels' : channel_mythvideo_only [ u'all' ] = cfg . get ( section , option ) break else : channel_mythvideo_only [ filter ( is_not_punct_char , option . lower ( ) ) ] = cfg . get ( section , option ) for key in channel_mythvideo_only . keys ( ) : if not channel_mythvideo_only [ key ] . startswith ( vid_graphics_dirs [ u'mythvideo' ] ) : logger . critical ( ( u"All Mythvideo only configuration (%s) directories (%s) must " u"be a subdirectory of the MythVideo base directory (%s)." ) % ( key , channel_mythvideo_only [ key ] , vid_graphics_dirs [ u'mythvideo' ] ) ) sys . exit ( 1 ) if channel_mythvideo_only [ key ] [ - 1 ] != u'/' : channel_mythvideo_only [ key ] += u'/' continue if section == u'watch_then_copy' : # Add the Channel names to the array of Channels once watched will be copied to MythVideo for option in cfg . options ( section ) : if option == u'all miro channels' : channel_new_watch_copy [ u'all' ] = cfg . get ( section , option ) break else : channel_new_watch_copy [ filter ( is_not_punct_char , option . lower ( ) ) ] = cfg . get ( section , option ) for key in channel_new_watch_copy . keys ( ) : if not channel_new_watch_copy [ key ] . startswith ( vid_graphics_dirs [ u'mythvideo' ] ) : logger . critical ( ( u"All 'new->watch->copy' channel (%s) directory (%s) must " u"be a subdirectory of the MythVideo base directory (%s)." ) % ( key , channel_new_watch_copy [ key ] , vid_graphics_dirs [ u'mythvideo' ] ) ) sys . exit ( 1 ) if channel_new_watch_copy [ key ] [ - 1 ] != u'/' : channel_new_watch_copy [ key ] += u'/' continue