Python fuse.Fuse() Examples

The following are 7 code examples of fuse.Fuse(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module fuse , or try the search function .
Example #1
Source File: accessfs.py    From allura with Apache License 2.0 6 votes vote down vote up
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() 
Example #2
Source File: pcachefs.py    From pcachefs with Apache License 2.0 6 votes vote down vote up
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 
Example #3
Source File: pcachefs.py    From pcachefs with Apache License 2.0 6 votes vote down vote up
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) 
Example #4
Source File: main.py    From spreadsheetfs with MIT License 5 votes vote down vote up
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() 
Example #5
Source File: fuse-cmd.py    From honeything with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, top):
        fuse.Fuse.__init__(self)
        self.top = top 
Example #6
Source File: dlna_fuse.py    From dlna_live_streaming with GNU General Public License v2.0 5 votes vote down vote up
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) 
Example #7
Source File: pcachefs.py    From pcachefs with Apache License 2.0 5 votes vote down vote up
def main(args=None):
    usage="""
    pCacheFS: A persistently caching filesystem.
    """ + fuse.Fuse.fusage

    version = "%prog " + fuse.__version__

    server = PersistentCacheFs(version=version, usage=usage, dash_s_do='setsingle')

    parsed_args = server.parse(args, errex=1)
    if not parsed_args.getmod('showhelp'):
        server.main()