本文整理汇总了Python中fuse.Fuse方法的典型用法代码示例。如果您正苦于以下问题:Python fuse.Fuse方法的具体用法?Python fuse.Fuse怎么用?Python fuse.Fuse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fuse
的用法示例。
在下文中一共展示了fuse.Fuse方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: import fuse [as 别名]
# 或者: from fuse import Fuse [as 别名]
def main():
usage = """
Userspace nullfs-alike: mirror the filesystem tree from some point on.
""" + fuse.Fuse.fusage
server = AccessFS(version="%prog " + fuse.__version__,
usage=usage,
dash_s_do='setsingle')
server.parser.add_option(mountopt="root", metavar="PATH", default='/',
help="mirror filesystem from under PATH [default: %default]")
server.parse(values=server, errex=1)
try:
if server.fuse_args.mount_expected():
os.chdir(server.root)
except OSError:
print("can't enter root of underlying filesystem", file=sys.stderr)
sys.exit(1)
server.main()
示例2: __init__
# 需要导入模块: import fuse [as 别名]
# 或者: from fuse import Fuse [as 别名]
def __init__(self, *args, **kw):
fuse.Fuse.__init__(self, *args, **kw)
# Currently we have to run in single-threaded mode to prevent
# the cache becoming corrupted
self.parse(['-s'])
self.parser.add_option('-c', '--cache-dir', dest='cache_dir', help="Specifies the directory where cached data should be stored. This will be created if it does not exist.")
self.parser.add_option('-t', '--target-dir', dest='target_dir', help="The directory which we are caching. The content of this directory will be mirrored and all reads cached.")
self.parser.add_option('-v', '--virtual-dir', dest='virtual_dir', help="The folder in the mount dir in which the virtual filesystem controlling pcachefs will reside.")
self.cache_dir = None
self.target_dir = None
self.virtual_dir = None
self.cacher = None
self.vfs = None
示例3: main
# 需要导入模块: import fuse [as 别名]
# 或者: from fuse import Fuse [as 别名]
def main(self, args=None):
options = self.cmdline[0]
if options.cache_dir is None:
self.parser.error('Need to specify --cache-dir')
if options.target_dir is None:
self.parser.error('Need to specify --target-dir')
self.cache_dir = options.cache_dir
self.target_dir = options.target_dir
self.virtual_dir = options.virtual_dir or '.pcachefs'
self.cacher = Cacher(self.cache_dir, UnderlyingFs(self.target_dir))
self.vfs = vfs.VirtualFS(self.virtual_dir, self.cacher)
signal.signal(signal.SIGINT, signal.SIG_DFL)
fuse.Fuse.main(self, args)
示例4: main
# 需要导入模块: import fuse [as 别名]
# 或者: from fuse import Fuse [as 别名]
def main():
usage = """
spreadsheetfs
""" + fuse.Fuse.fusage
init_fs_data()
server = SpreadsheetFS(version="%prog " + fuse.__version__,
usage=usage,
dash_s_do="setsingle")
server.parse(errex=1)
server.main()
示例5: __init__
# 需要导入模块: import fuse [as 别名]
# 或者: from fuse import Fuse [as 别名]
def __init__(self, top):
fuse.Fuse.__init__(self)
self.top = top
示例6: __init__
# 需要导入模块: import fuse [as 别名]
# 或者: from fuse import Fuse [as 别名]
def __init__(self, *args, **kw):
fuse.Fuse.__init__(self, *args, **kw)
self.output = ReadThread.Output(TEMP_FILE)
self.hasMoreData = threading.Condition()
pulseaudio_monitor = os.popen("pactl list | grep -A2 '^Source #' "
" | grep 'Name: .*\.monitor$' | awk '{print $NF}' | tail -n1").read().strip()
print "Using PulseAudio monitor", pulseaudio_monitor
live_filter = os.path.abspath(os.path.join(os.getcwd(), "matroska_live_filter.py"))
cmd = ("parec -d %(pulseaudio_monitor)s"
" | ffmpeg -f s16le -ac 2 -ar 44100 -i - -f x11grab -r 20 -s 1024x576"
" -i :0.0+128,224 -acodec ac3 -ac 1 -vcodec libx264 -vpre fast"
" -threads 0 -f matroska - "
" | %(live_filter)s - ") % locals()
print "Running capture command:", cmd
self.process = subprocess.Popen(cmd, stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
shell=True)
t = ReadThread(self.process, self.process.stdout,
self.output, self.hasMoreData)
t.setDaemon(True)
t.start()
stderr_thrd = ReadThread(self.process, self.process.stderr, None, None)
stderr_thrd.setDaemon(True)
stderr_thrd.start()
# Read some data so that it's ready immediately when the player requests
# it (my player appears to have a short timeout and gives up when it
# has to wait too long for the metadata).
self.read("", 1024 * 1024, 0)