本文整理汇总了Python中settings.settings.get_listen_port函数的典型用法代码示例。如果您正苦于以下问题:Python get_listen_port函数的具体用法?Python get_listen_port怎么用?Python get_listen_port使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_listen_port函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: load_browser
def load_browser():
logging.info('Loading browser...')
global is_pro_init
is_pro_init = get_is_pro_init()
if not is_pro_init:
logging.debug('Detected Pro initiation cycle.')
# Wait for the intro file to exist (if it doesn't)
intro_file = '/home/pi/.screenly/intro.html'
while not path.isfile(intro_file):
logging.debug('intro.html missing. Going to sleep.')
sleep(0.5)
browser_load_url = 'file://' + intro_file
elif settings['show_splash']:
browser_load_url = "http://%s:%s/splash_page" % (settings.get_listen_ip(), settings.get_listen_port())
else:
browser_load_url = black_page
browser = sh.Command('uzbl-browser')(uri=browser_load_url, _bg=True)
logging.info('Browser loaded. Running as PID %d.' % browser.pid)
if settings['show_splash']:
# Show splash screen for 60 seconds.
sleep(60)
else:
# Give browser some time to start (we have seen multiple uzbl running without this)
sleep(10)
return browser
开发者ID:phobozad,项目名称:screenly-ose,代码行数:33,代码来源:viewer.py
示例2: load_browser
def load_browser():
logging.info('Loading browser...')
global is_pro_init, current_browser_url
is_pro_init = get_is_pro_init()
if not is_pro_init:
logging.debug('Detected Pro initiation cycle.')
# Wait for the intro file to exist (if it doesn't)
intro_file = path.join(settings.get_configdir(), 'intro.html')
while not path.isfile(intro_file):
logging.debug('intro.html missing. Going to sleep.')
sleep(0.5)
browser_load_url = 'file://' + intro_file
elif settings['show_splash']:
browser_load_url = "http://%s:%s/splash_page" % (settings.get_listen_ip(), settings.get_listen_port())
else:
browser_load_url = black_page
geom = [l for l in sh.xwininfo('-root').split("\n") if 'geometry' in l][0].split('y ')[1]
browser = sh.Command('uzbl-browser')(g=geom, uri=browser_load_url, _bg=True)
current_browser_url = browser_load_url
logging.info('Browser loaded. Running as PID %d.' % browser.pid)
if settings['show_splash']:
# Show splash screen for 60 seconds.
sleep(60)
else:
# Give browser some time to start (we have seen multiple uzbl running without this)
sleep(10)
return browser
开发者ID:asoleh,项目名称:screenly-ose,代码行数:35,代码来源:viewer.py
示例3: splash_page
def splash_page():
my_ip = get_node_ip()
if my_ip:
ip_lookup = True
url = "http://{}:{}".format(my_ip, settings.get_listen_port())
else:
ip_lookup = False
url = "Unable to look up your installation's IP address."
return template('splash_page', ip_lookup=ip_lookup, url=url)
开发者ID:Geo-Joy,项目名称:sync-pi-ose,代码行数:10,代码来源:server.py
示例4: main
def main():
setup()
url = 'http://{0}:{1}/splash_page'.format(settings.get_listen_ip(), settings.get_listen_port()) if settings['show_splash'] else 'file://' + BLACK_PAGE
load_browser(url=url)
if settings['show_splash']:
sleep(SPLASH_DELAY)
scheduler = Scheduler()
logging.debug('Entering infinite loop.')
while True:
asset_loop(scheduler)
开发者ID:banglardamal,项目名称:lynda-ose,代码行数:13,代码来源:viewer.py
示例5: splash_page
def splash_page():
my_ip = get_node_ip()
if my_ip:
ip_lookup = True
# If we bind on 127.0.0.1, `enable_ssl.sh` has most likely been
# executed and we should access over SSL.
if settings.get_listen_ip() == '127.0.0.1':
url = 'https://{}'.format(my_ip)
else:
url = "http://{}:{}".format(my_ip, settings.get_listen_port())
else:
ip_lookup = False
url = "Unable to look up your installation's IP address."
return template('splash_page', ip_lookup=ip_lookup, url=url)
开发者ID:krinate,项目名称:screenly-ose,代码行数:16,代码来源:server.py
示例6: main
def main():
setup()
url = (
"http://{0}:{1}/splash_page".format(settings.get_listen_ip(), settings.get_listen_port())
if settings["show_splash"]
else "file://" + BLACK_PAGE
)
load_browser(url=url)
if settings["show_splash"]:
sleep(SPLASH_DELAY)
scheduler = Scheduler()
logging.debug("Entering infinite loop.")
while True:
asset_loop(scheduler)
开发者ID:tomvleeuwen,项目名称:screenly-ose,代码行数:17,代码来源:viewer.py
示例7: load_browser
def load_browser():
logging.info('Loading browser...')
browser_bin = "uzbl-browser"
browser_resolution = settings['resolution']
if settings['show_splash']:
browser_load_url = "http://%s:%s/splash_page" % (settings.get_listen_ip(), settings.get_listen_port())
else:
browser_load_url = black_page
browser_args = [browser_bin, "--geometry=" + browser_resolution, "--uri=" + browser_load_url]
browser = Popen(browser_args)
logging.info('Browser loaded. Running as PID %d.' % browser.pid)
if settings['show_splash']:
# Show splash screen for 60 seconds.
sleep(60)
else:
# Give browser some time to start (we have seen multiple uzbl running without this)
sleep(10)
return browser
开发者ID:07jetta,项目名称:screenly-ose,代码行数:23,代码来源:viewer.py
示例8: load_browser
def load_browser():
logging.info('Loading browser...')
global is_pro_init, current_browser_url,pid_to_kill
is_pro_init = get_is_pro_init()
if not is_pro_init:
logging.debug('Detected Pro initiation cycle.')
# Wait for the intro file to exist (if it doesn't)
intro_file = path.join(settings.get_configdir(), 'intro.html')
while not path.isfile(intro_file):
logging.debug('intro.html missing. Going to sleep.')
sleep(0.5)
browser_load_url = 'file://' + intro_file
elif settings['show_splash']:
browser_load_url = "http://%s:%s/splash_page" % (settings.get_listen_ip(), settings.get_listen_port())
else:
browser_load_url = black_page
browser = sh.Command('chromium-browser')(browser_load_url,disable_restore_background_contents=True,disable_restore_session_state=False,kiosk=True,_bg=True)
current_browser_url = browser_load_url
logging.info('Browser loaded. Running as PID %d.' % browser.pid)
if settings['show_splash']:
# Show splash screen for 60 seconds.
sleep(60)
else:
# Give browser some time to start (we have seen multiple uzbl running without this)
sleep(10)
pid_to_kill=browser.pid
logging.info('Done')
return browser
开发者ID:reiabreu,项目名称:screenly-ose,代码行数:36,代码来源:viewer.py
示例9: static
return 'Sorry, this page does not exist!'
################################
# Static
################################
@route('/static/:path#.+#', name='static')
def static(path):
return static_file(path, root='static')
if __name__ == "__main__":
# Make sure the asset folder exist. If not, create it
if not path.isdir(settings['assetdir']):
mkdir(settings['assetdir'])
# Create config dir if it doesn't exist
if not path.isdir(settings.get_configdir()):
makedirs(settings.get_configdir())
with db.conn(settings['database']) as conn:
global db_conn
db_conn = conn
with db.cursor(db_conn) as c:
c.execute(queries.exists_table)
if c.fetchone() is None:
c.execute(assets_helper.create_assets_table)
run(host=settings.get_listen_ip(),
port=settings.get_listen_port(), fast=True,
reloader=True)
开发者ID:Geo-Joy,项目名称:sync-pi-ose,代码行数:30,代码来源:server.py
示例10: match_details
def match_details():
my_ip = get_node_ip()
url = "http://{}:{}".format(my_ip, settings.get_listen_port())
return template('match_details', url=url)
开发者ID:Ultimatum22,项目名称:screenly-ose,代码行数:4,代码来源:server.py
示例11: static
# Static
################################
@route('/static/:path#.+#', name='static')
def static(path):
return static_file(path, root='static')
if __name__ == "__main__":
# Make sure the asset folder exist. If not, create it
if not path.isdir(settings['assetdir']):
mkdir(settings['assetdir'])
# Create config dir if it doesn't exist
if not path.isdir(settings.get_configdir()):
makedirs(settings.get_configdir())
with db.conn(settings['database']) as conn:
global db_conn
db_conn = conn
with db.cursor(db_conn) as c:
c.execute(queries.exists_table)
if c.fetchone() is None:
c.execute(assets_helper.create_assets_table)
run(
host=settings.get_listen_ip(),
port=settings.get_listen_port(),
server='gunicorn',
timeout=240,
)
开发者ID:krinate,项目名称:screenly-ose,代码行数:30,代码来源:server.py
示例12: mistake403
@error(403)
def mistake403(code):
return "The parameter you passed has the wrong format!"
@error(404)
def mistake404(code):
return "Sorry, this page does not exist!"
################################
# Static
################################
@route("/static/:path#.+#", name="static")
def static(path):
return static_file(path, root="static")
if __name__ == "__main__":
# Make sure the asset folder exist. If not, create it
if not path.isdir(settings.get_asset_folder()):
mkdir(settings.get_asset_folder())
initiate_db()
run(host=settings.get_listen_ip(), port=settings.get_listen_port(), reloader=True)
开发者ID:robburrows,项目名称:screenly-ose,代码行数:28,代码来源:server.py
注:本文中的settings.settings.get_listen_port函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论