2 Commits
1.0 ... 1.1

Author SHA1 Message Date
ffb99d6515 Moved common attributes to extfslib, uadf now will complain on nodos or
corrupted images.
2013-05-16 22:25:28 +02:00
c8407ff57b Reformated README 2013-05-12 18:23:49 +02:00
4 changed files with 40 additions and 16 deletions

View File

@@ -6,7 +6,8 @@ Those are Midnight Commander extfs plugins for handling several archive types.
Installation
============
See individual installation plugins below. Basically it come down to:
See individual installation plugins below. Basically it comes down to:
* copying ``extfslib.py`` and plugin files to ``~/.local/share/mc/extfs/``
* installing binary handlers (lha, unlzx, xdms and unadf)
@@ -18,16 +19,19 @@ See individual installation plugins below. Basically it come down to:
ULha
====
ULha is an extfs plugin which can be used with lha/lzh/lharc archives.
Personally, I've use it almost exclusively for archives created long time ago
on my Amiga. Both reading and writing into archive was implemented.
on my Amiga. Both reading from and writing into archive was implemented.
Requirements
------------
ULha requires `free lha <http://lha.sourceforge.jp>`_ implementation to work.
Installation
------------
* copy ``extfslib.py`` and ``ulha`` to ``~/.local/share/mc/extfs/``
* add or change entry for files handle in ``~/.config/mc/mc.ext``::
@@ -38,24 +42,27 @@ Installation
ULzx
====
ULzx is an extfs plugin which can be used to browse and extract lzx archives,
which are known almost exclusively from Amiga.
Due to limitations of
`unlzx <ftp://us.aminet.net/pub/aminet/misc/unix/unlzx.c.gz.readme>`_ tools,
only reading is supported. Also be aware, that
`unlzx <ftp://us.aminet.net/pub/aminet/misc/unix/unlzx.c.gz.readme>`_ tool
cannot extract files individually, so copying entire archive content is not
recommended, since on every file a full archive extract would be performed,
which in the end would have impact on performance.
`unlzx <ftp://us.aminet.net/pub/aminet/misc/unix/unlzx.c.gz.readme>`_ cannot
extract files individually, so copying entire archive content is not
recommended, since on every single file a full archive extract would be
performed, which in the end would have impact on performance.
Requirements
------------
ULzx requires
`unlzx <ftp://us.aminet.net/pub/aminet/misc/unix/unlzx.c.gz.readme>`_ tool.
Installation
------------
* copy ``extfslib.py`` and ``ulzx`` to ``~/.local/share/mc/extfs/``
* add or change entry for files handle in ``~/.config/mc/mc.ext``::
@@ -66,12 +73,13 @@ Installation
UAdf
====
UAdf is an extfs plugin suitable for reading .adf, .adz and .dms Amiga floppy
disk images. Due to limitations of the
`unadf <http://freecode.com/projects/unadf>`_, file access inside disk image is
read only.
Note, that in case of no-dos images, directory listing will be empty.
In case of corrupted or no-dos images, message will be shown.
Requirements
------------
@@ -112,6 +120,7 @@ needed.
Installation
------------
* copy ``extfslib.py`` and ``uadf`` to ``~/.local/share/mc/extfs/``
* add or change entry for files handle in ``~/.config/mc/mc.ext``::

View File

@@ -5,11 +5,12 @@ plugins for Midnight Commander.
Tested against python 2.7 and mc 4.8.7
Changelog:
1.1 Added item pattern, and common git/uid attrs
1.0 Initial release
Author: Roman 'gryf' Dobosz <gryf73@gmail.com>
Date: 2013-05-12
Version: 1.0
Version: 1.1
Licence: BSD
"""
import os
@@ -32,11 +33,15 @@ class Archive(object):
"read": "r",
"write": "w",
"delete": "d"}
ITEM = ("%(perms)s 1 %(uid)-8s %(gid)-8s %(size)8s %(datetime)s "
"%(display_name)s\n")
def __init__(self, fname):
"""Prepare archive content for operations"""
if not os.path.exists(fname):
raise OSError("No such file or directory `%s'" % fname)
self._uid = os.getuid()
self._gid = os.getgid()
self._arch = fname
self._contents = self._get_dir()

17
uadf
View File

@@ -18,12 +18,13 @@ if comment or filename already contains any comma.
It also requires xdms utility, for optional dms support.
Changelog:
1.2 Added failsafe for filenames in archive with spaces and nodos message.
1.1 Moved common code into extfslib library
1.0 Initial release
Author: Roman 'gryf' Dobosz <gryf73@gmail.com>
Date: 2013-05-12
Version: 1.1
Date: 2013-05-16
Version: 1.2
Licence: BSD
"""
@@ -53,8 +54,6 @@ class UAdf(Archive):
"write": "w",
"delete": "d"}
DATETIME = "%s-%s-%s %02d:%s"
ITEM = ("%(perms)s 1 %(uid)-8s %(gid)-8s %(size)8s %(datetime)s "
"%(display_name)s\n")
def __init__(self, fname):
"""Prepare archive content for operations"""
@@ -141,6 +140,10 @@ class UAdf(Archive):
Convert filenames to be Unix filesystem friendly
Add suffix to show user what kind of file do he dealing with.
"""
if not self._contents:
sys.stderr.write("Nodos or archive error\n")
return 1
for entry in self._contents:
sys.stdout.write(self.ITEM % entry)
return 0
@@ -151,6 +154,12 @@ class UAdf(Archive):
if not real_src:
raise IOError("No such file or directory")
if " " in real_src:
sys.stderr.write("unadf is unable to operate on filepath with "
"space inside.\nUse affs to mount image and than"
" extract desired files.\n")
return 1
extract_dir = mkdtemp()
cmd = ["unadf", self._arch, real_src, "-d", extract_dir]
if check_call(cmd, stdout=open(os.devnull, 'wb'),

9
ulha
View File

@@ -7,12 +7,13 @@ Tested against python 2.7, lha[1] 1.14 and mc 4.8.7
[1] http://lha.sourceforge.jp
Changelog:
1.2 Moved item pattern to extfslib module
1.1 Moved common code into extfslib library
1.0 Initial release
Author: Roman 'gryf' Dobosz <gryf73@gmail.com>
Date: 2013-05-12
Version: 1.1
Date: 2013-05-16
Version: 1.2
Licence: BSD
"""
import os
@@ -43,8 +44,7 @@ class ULha(Archive):
"read": "pq",
"write": "aq",
"delete": "dq"}
ITEM = ("%(perms)s 1 %(uid)-8s %(gid)-8s %(size)8s %(month)s %(day)s "
"%(yh)s %(display_name)s\n")
DATETIME = "%(month)s %(day)s %(yh)s"
def _get_dir(self):
"""Prepare archive file listing"""
@@ -72,6 +72,7 @@ class ULha(Archive):
# really care about real user/group
entry['uid'] = self._uid
entry['gid'] = self._gid
entry['datetime'] = self.DATETIME % entry
if not entry['perms']:
entry['perms'] = perms