1
0
mirror of https://github.com/gryf/mc_adbfs.git synced 2025-12-18 20:10:21 +01:00

Merge remote-tracking branch 'github/master'

This commit is contained in:
2017-03-06 17:12:58 +01:00
2 changed files with 13 additions and 5 deletions

View File

@@ -55,7 +55,7 @@ your device and how fast it is :)
Configuration
=============
You can use configure behaviour of this plugin using ``.ini`` file located under
You can configure behaviour of this plugin using ``.ini`` file located under
``$XDG_CONFIG_HOME/mc/adbfs.ini`` (which usually is located under
``~/.config/mc/adbfs.ini``), and have default values, like:
@@ -65,6 +65,7 @@ You can use configure behaviour of this plugin using ``.ini`` file located under
debug = false
skip_dirs = true
dirs_to_skip = ["acct", "charger", "d", "dev", "proc", "sys"]
suppress_colors = false
root =
where:
@@ -74,6 +75,9 @@ where:
* ``dirs_to_skip`` list of paths to directories which will be skipped during
reading. If leaved empty, or setted to empty list (``[]``) will read
everything (slow!)
* ``suppress_colors`` this option will make ``busybox`` not to display colors,
helpful, if ``busybox ls`` is configured to display colors by default. Does
not affect ``toolbox``.
* ``root`` root directory to read. Everything outside of that directory will be
omitted. That would be the fastest way to access certain location on the
device. Note, that ``dirs_to_skip`` still apply inside this directory.

12
adbfs
View File

@@ -48,17 +48,17 @@ class Conf(object):
r'(?P<size>\d+)?\s'
r'(?P<date>\d{4}-\d{2}-\d{2}\s'
r'\d{2}:\d{2})\s'
r'(?P<name>.*)'}
}
r'(?P<name>.*)'}}
def __init__(self):
self.box = None
self.debug = False
self.dirs_to_skip = ["acct", "charger", "d", "dev", "proc", "sys"]
self.root = None
self.suppress_colors = False
self.get_the_box()
self.read()
self.get_the_box()
def get_the_box(self):
"""Detect if we dealing with busybox or toolbox"""
@@ -67,9 +67,12 @@ class Conf(object):
result = subprocess.check_output('adb shell which '
'busybox'.split(),
stderr=fnull)
if 'busybox' in result:
self.box = Conf.boxes['busybox']
if self.suppress_colors:
self.box.update({'ls': 'busybox ls --color=none -anel',
'rls': 'busybox ls --color=none '
'-Ranel {}'})
Adb.file_re = re.compile(self.box['file_re'])
return
except subprocess.CalledProcessError:
@@ -106,6 +109,7 @@ class Conf(object):
cfg = ConfigParser.SafeConfigParser()
cfg_map = {'debug': (cfg.getboolean, 'debug'),
'dirs_to_skip': (cfg.get, 'dirs_to_skip'),
'suppress_colors': (cfg.get, 'suppress_colors'),
'root': (cfg.get, 'root')}
cfg.read(conf_fname)