當前位置: 首頁>>代碼示例>>Python>>正文


Python fuse.Fuse方法代碼示例

本文整理匯總了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() 
開發者ID:apache,項目名稱:allura,代碼行數:25,代碼來源:accessfs.py

示例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 
開發者ID:ibizaman,項目名稱:pcachefs,代碼行數:18,代碼來源:pcachefs.py

示例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) 
開發者ID:ibizaman,項目名稱:pcachefs,代碼行數:19,代碼來源:pcachefs.py

示例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() 
開發者ID:GunshipPenguin,項目名稱:spreadsheetfs,代碼行數:13,代碼來源:main.py

示例5: __init__

# 需要導入模塊: import fuse [as 別名]
# 或者: from fuse import Fuse [as 別名]
def __init__(self, top):
        fuse.Fuse.__init__(self)
        self.top = top 
開發者ID:omererdem,項目名稱:honeything,代碼行數:5,代碼來源:fuse-cmd.py

示例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) 
開發者ID:mfoetsch,項目名稱:dlna_live_streaming,代碼行數:39,代碼來源:dlna_fuse.py


注:本文中的fuse.Fuse方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。