"""
-__version__ = "0.5.0"
-__revision__ = "$Id: obexftp,v 1.6 2004/06/13 21:48:59 phd Exp $"
-__date__ = "$Date: 2004/06/13 21:48:59 $"[7:-2]
+__version__ = "0.5.1"
+__revision__ = "$Id: obexftp,v 1.7 2004/06/13 22:04:56 phd Exp $"
+__date__ = "$Date: 2004/06/13 22:04:56 $"[7:-2]
__author__ = "Oleg Broytmann <phd@phd.pp.ru>"
__copyright__ = "Copyright (C) 2004 PhiloSoft Design"
sys.stderr.write(msg + '\n')
def error(msg):
- log_error(msg + '\n')
+ log_error(msg)
sys.exit(1)
if len(sys.argv) < 2:
error("""\
It is not a program - it is a VFS for Midnight Commander.
-Put it in /usr/lib/mc/extfs.""")
+Put it in /usr/lib/mc/extfs. For more information read the source!""")
def setup_transport():
# Parse ObexFTP XML directory listings
class DirectoryEntry(object):
+ """Represent remote files and directories"""
+
def __init__(self, type):
self.type = type
self.size = 0
)
raise ValueError, "unknown type '%s'; expected 'file' or 'folder'" % self.type
-def get_entries(dom, tag):
+def get_entries(dom, type):
entries = []
- for subtag in dom.getElementsByTagName(tag):
- entry = DirectoryEntry(tag)
- attrs = subtag.attributes
+ for obj in dom.getElementsByTagName(type):
+ entry = DirectoryEntry(type)
+ attrs = obj.attributes
for i in range(attrs.length):
attr = attrs.item(i)
setattr(entry, attr.name, attr.value)
"""Remove a file from the VFS"""
obexftp_args = setup_transport()
obex_filename = sys.argv[3]
-
- setup_tmpdir()
os.system("%s %s -k '%s' 2>/dev/null" % (obexftp_prog, obexftp_args, obex_filename))
- cleanup_tmpdir()
def mcobex_mkdir():
"""Create a directory in the VFS"""
obexftp_args = setup_transport()
obex_dirname = sys.argv[3]
-
- setup_tmpdir()
os.system("%s %s -C '%s' 2>/dev/null" % (obexftp_prog, obexftp_args, obex_dirname))
- cleanup_tmpdir()
mcobex_rmdir = mcobex_rm