]> git.phdru.name Git - extfs.d.git/commitdiff
Version 0.5.1. More comments. Do not need a temp dir for rm and mkdir.
authorOleg Broytman <phd@phdru.name>
Sun, 13 Jun 2004 22:04:56 +0000 (22:04 +0000)
committerOleg Broytman <phd@phdru.name>
Sun, 13 Jun 2004 22:04:56 +0000 (22:04 +0000)
git-svn-id: file:///home/phd/archive/SVN/mc-extfs/trunk@17 1a6e6372-1aea-0310-bd00-dc960550e1df

obexftp

diff --git a/obexftp b/obexftp
index bfe801e4b8b09e17713b8c465ddef080568efd69..3f6d25f2c7cf5f191bc5edb024122490c918d657 100755 (executable)
--- a/obexftp
+++ b/obexftp
@@ -42,9 +42,9 @@ caches the result, so you can browse directories quickly.
 
 """
 
 
 """
 
-__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"
 
 __author__ = "Oleg Broytmann <phd@phd.pp.ru>"
 __copyright__ = "Copyright (C) 2004 PhiloSoft Design"
 
@@ -63,14 +63,14 @@ def log_error(msg):
    sys.stderr.write(msg + '\n')
 
 def error(msg):
    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.
    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():
 
 
 def setup_transport():
@@ -95,6 +95,8 @@ def setup_transport():
 # Parse ObexFTP XML directory listings
 
 class DirectoryEntry(object):
 # Parse ObexFTP XML directory listings
 
 class DirectoryEntry(object):
+   """Represent remote files and directories"""
+
    def __init__(self, type):
       self.type = type
       self.size = 0
    def __init__(self, type):
       self.type = type
       self.size = 0
@@ -130,11 +132,11 @@ class DirectoryEntry(object):
             )
       raise ValueError, "unknown type '%s'; expected 'file' or 'folder'" % self.type
 
             )
       raise ValueError, "unknown type '%s'; expected 'file' or 'folder'" % self.type
 
-def get_entries(dom, tag):
+def get_entries(dom, type):
    entries = []
    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)
       for i in range(attrs.length):
          attr = attrs.item(i)
          setattr(entry, attr.name, attr.value)
@@ -221,20 +223,14 @@ def mcobex_rm():
    """Remove a file from the VFS"""
    obexftp_args = setup_transport()
    obex_filename = sys.argv[3]
    """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))
    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]
 
 
 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))
    os.system("%s %s -C '%s' 2>/dev/null" % (obexftp_prog, obexftp_args, obex_dirname))
-   cleanup_tmpdir()
 
 
 mcobex_rmdir = mcobex_rm
 
 
 mcobex_rmdir = mcobex_rm