本文整理汇总了Python中Configuration.Configuration.get方法的典型用法代码示例。如果您正苦于以下问题:Python Configuration.get方法的具体用法?Python Configuration.get怎么用?Python Configuration.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Configuration.Configuration
的用法示例。
在下文中一共展示了Configuration.get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: processTask
# 需要导入模块: from Configuration import Configuration [as 别名]
# 或者: from Configuration.Configuration import get [as 别名]
def processTask( self, task ):
self.inputDirectory = task.getOptions()['inputDirectory']
self.videoTwoPass = task.getOptions()['videoTwoPass']
avsFiles = task.getOptions()['avsFiles']
totalFiles = task.getOptions()['filesNumber']
# update db in case of leonardo multiprofile
if task.getOptions()['leonardoUse']:
prefix = self.inputDirectory.split( '\\' )[-1]
id = int( prefix )
self.db.updateTable( 'title', id, 'start_timestamp', datetime.datetime.now() )
i = 0
for avs in avsFiles:
self.com = Commands( task )
commands = self.com.getCommands( avs )
self.setCommands( commands )
self.avsFileLogging( 'processing', avs, i, totalFiles )
c = Thread( target = self.runCommands, args = () )
c.start()
c.join()
i += 1
self.avsFileLogging( 'finished', i, totalFiles )
# update db in case of leonardo multiprofile
if task.getOptions()['leonardoUse']:
self.db.updateTable( 'title', id, 'end_timestamp', datetime.datetime.now() )
self.db.updateTable( 'title', id, 'status', 'Completed' )
outputDir = task.getOptions()['outputDirectory']
videoFiles = QC.loadFiles(outputDir, Configuration.get( 'videoSettings', 'outputFormat' ))
for file in videoFiles:
fileToRemove = os.path.join(outputDir, file)
os.remove(fileToRemove)
audioFiles = QC.loadFiles(outputDir, Configuration.get( 'audioSettings', 'outputFormat' ))
for file in audioFiles:
if QC.regex(file, '.audio.'):
fileToRemove = os.path.join(outputDir, file)
os.remove(fileToRemove)
示例2: Configuration
# 需要导入模块: from Configuration import Configuration [as 别名]
# 或者: from Configuration.Configuration import get [as 别名]
#! /usr/bin/env python3
# import FileManager as FM
from KeyboardParser import KeyboardParser
import Helps
import Utils
import os
from Configuration import Configuration
config = Configuration()
annuaire_type = config.get("MAIN", "type")
ChoosenListType = Utils.getClass(annuaire_type)
contacts = ChoosenListType(config)
Helps.welcome()
parser = KeyboardParser(contacts, config, ChoosenListType)
os._exit(0)
示例3: __init__
# 需要导入模块: from Configuration import Configuration [as 别名]
# 或者: from Configuration.Configuration import get [as 别名]
def __init__( self ):
self.leonardo = Configuration.get( 'leonardo' )
示例4: YoutubeDownloader
# 需要导入模块: from Configuration import Configuration [as 别名]
# 或者: from Configuration.Configuration import get [as 别名]
class YoutubeDownloader(multiprocessing.Process):
def __init__(self, work_queue, result_queue):
global doDebug
# base class initialization
multiprocessing.Process.__init__(self)
self.name = os.path.basename(os.path.abspath("."))
self.__config = Configuration(self.name)
# job management stuff
self.work_queue = work_queue
self.result_queue = result_queue
self.kill_received = False
def run(self):
global doDebug
while not self.kill_received:
if doDebug:
print "check for next url"
try:
url = self.work_queue.get()
self.__config.refresh()
videos_directory = self.__config.get('Configuration', 'videos_directory')
self.useFormat = self.__config.get('Download Options', 'useFormat')
self.videoFormat = self.__config.get('Download Options', 'videoFormat')
self.maxVideoFormat = self.__config.get('Download Options', 'maxVideoFormat')
self.useAuthentication = self.__config.get('Download Options', 'useAuthentication')
self.userName = self.__config.get('Download Options', 'userName')
self.userPassword = self.__config.get('Download Options', 'userPassword')
self.ignoreErrors = self.__config.get('Download Options', 'ignoreErrors')
self.resumeDownload = self.__config.get('Download Options', 'resumeDownload')
self.noOverwrites = self.__config.get('Download Options', 'noOverwrites')
self.useTitle = self.__config.get('Download Options', 'useTitle')
if not videos_directory:
p = subprocess.Popen(["xdg-user-dir","VIDEOS"],stdout=subprocess.PIPE,stderr=subprocess.PIPE,shell=False)
directoryName, errors = p.communicate()
directoryName=directoryName.rstrip()
videos_directory = os.path.abspath(directoryName)
if not (videos_directory == os.path.abspath('.')):
os.chdir(videos_directory)
if doDebug:
print "current video directory is: "+os.path.abspath('.')
retcode = self.main(url)
except Queue.Empty:
time.sleep(1)
def debug(self):
global doDebug
doDebug = True
def main(self,url):
global doDebug
if doDebug:
print "In main URL is: "+url
parser, opts, args = parseOpts()
#Need to set user options from config file if we can
if self.useFormat == '0':
opts.format = youtube.videoFormats.get(self.videoFormat)
elif self.useFormat == '1':
opts.format_limit = youtube.videoFormats.get(self.maxVideoFormat)
if self.useAuthentication == '1':
opts.username = self.userName
opts.password = self.userPassword
opts.continue_dl = self.resumeDownload
opts.ignoreerrors = self.ignoreErrors
opts.nooverwrites = self.noOverwrites
opts.usetitle = self.useTitle
# Open appropriate CookieJar
if opts.cookiefile is None:
jar = cookielib.CookieJar()
else:
try:
jar = cookielib.MozillaCookieJar(opts.cookiefile)
if os.path.isfile(opts.cookiefile) and os.access(opts.cookiefile, os.R_OK):
jar.load()
except (IOError, OSError), err:
time.sleep(1)
# Dump user agent
if opts.dump_user_agent:
print std_headers['User-Agent']
# Batch file verification
batchurls = []
if opts.batchfile is not None:
try:
if opts.batchfile == '-':
batchfd = sys.stdin
else:
batchfd = open(opts.batchfile, 'r')
batchurls = batchfd.readlines()
batchurls = [x.strip() for x in batchurls]
batchurls = [x for x in batchurls if len(x) > 0 and not re.search(r'^[#/;]', x)]
except IOError:
time.s;eep(1)
all_urls = batchurls
#.........这里部分代码省略.........
示例5: __init__
# 需要导入模块: from Configuration import Configuration [as 别名]
# 或者: from Configuration.Configuration import get [as 别名]
class application :
def __init__(self):
#init threading
gobject.threads_init()
#keep track of the window size
self.window_height=0
self.window_width=0
self.window_is_hidden = False
self.has_status_icon = False
#keep track of the initial conversation id so that conversations don't colide
self.conversation_id="0"
#keep track of the filters
self.filters ={'users':[],'strings':[]}
self.options={'run_as_tray_app':False,'context_backwards':False,'no_avatars':False,'notifications':True,'notify_replies':False}
#keep track of the direct_message requests
self.last_direct_message_time=0
#something something direct message
self.is_direct_message_mode=False
self.direct_message_to=None
self.waiting_requests=0
self.is_first_dents = True
#keep track of the respond to id
self.respond_to_id=0
self.pre_group_page=None
self.pre_user_page=None
#keep track of the last time statuses where pulled
self.last_get_statuses = 0
#what are the assets?
asset_dir = 'assets'
heybuddy_dir = os.path.dirname( os.path.realpath( __file__ ) )
self.readme_file = os.path.join(heybuddy_dir,'README.txt')
self.standard_icon_path = os.path.join(heybuddy_dir,asset_dir,'icon.png')
self.direct_icon_path = os.path.join(heybuddy_dir,asset_dir,'direct_icon.png')
self.networking_icon_path = os.path.join(heybuddy_dir,asset_dir,'icon1.png')
self.throbber_icon_path = os.path.join(heybuddy_dir,asset_dir,'throbber.gif')
self.default_icon_path = self.standard_icon_path
self.conf = Configuration(app_name)
#has the account info been authenticated?
self.credentials_verified = self.conf.get_bool('access', 'credentials_verified')
self.xmlprocessor = XMLProcessor()
#create a regex to replace parts of a dent
self.regex_tag = re.compile("(^| )#([\w-]+)", re.UNICODE)
self.regex_group = re.compile("(^| )!([\w-]+)")
self.regex_user=re.compile("(^|[^A-z0-9])@(\w+)")
self.regex_url=re.compile("(http[s]?://.*?)(\.$|\. |\s|$)",re.IGNORECASE)
#get the initial dents
self.initial_dents = self.conf.get('settings','initial_dents',default='20' )
self.dent_limit = int(self.initial_dents)*2
#get the pull time
self.pull_time = self.conf.get('settings','pull_time',default='60')
self.pull_time_changed_bool = False
self.pull_time_mentions = False
#build the gui
self.build_gui()
#where is the certs file?
ca_certs_files = [
"/etc/ssl/certs/ca-certificates.crt",
"/etc/ssl/certs/ca-bundle.crt",
]
#what if there isn't a cert_file
cert_file=None
#determine the certs_file
for f in ca_certs_files:
if os.path.exists(f):
cert_file=f
break
#create the communicator
self.comm = Communicator(app_name, cert_file)
self.comm.connect('statusesXML',self.process_statusesXML,self.dentspage)
self.comm.connect('mentionsXML',self.process_statusesXML,self.mentionspage)
self.comm.connect('favoritesXML', self.process_statusesXML,self.favoritespage)
self.comm.connect('group-statusesXML',self.process_statusesXML,self.grouppage)
self.comm.connect('user-statusesXML',self.process_statusesXML,self.userpage)
self.comm.connect('direct_messagesXML',self.process_statusesXML,self.directspage,True)
self.comm.connect('conversationXML',self.process_conversationXML)
self.comm.connect('userXML',self.process_userXML)
self.comm.connect('groupXML',self.process_groupXML)
self.comm.connect('new-statusXML',self.process_new_statusXML)
self.comm.connect('redent-statusXML',self.process_new_statusXML)
self.comm.connect('user_is_friendXML',self.process_user_is_friendXML)
self.comm.connect('user_is_memberXML',self.process_user_is_memberXML)
self.comm.connect('friendshipXML',self.process_friendshipXML)
self.comm.connect('exception-caught',self.process_communication_exception)
self.comm.connect('widget-image',self.process_widget_image)
self.comm.connect('direct-messageXML',self.process_new_directXML)
self.comm.connect('verify_credentialsXML',self.process_verifycredentialsXML)
self.comm.connect('configXML',self.process_configXML)
#create an image cacher thingy
self.imagecache = ImageCache()
self.imagecache.set_disabled( self.conf.get_bool_option('no_avatars') )
self.imagecache.connect('get-widget-image', self.get_widget_image)
#Create notify-er if has pynotify
if has_pynotify:
self.notify = Notify()
#align the window
self.align_window()
#.........这里部分代码省略.........