diff options
author | Graham Northup <grissess@nexusg.org> | 2019-02-05 00:20:44 -0500 |
---|---|---|
committer | Graham Northup <grissess@nexusg.org> | 2019-02-05 00:20:44 -0500 |
commit | b82bc24308b3c34caf6d9ef3786c9da4ef5fd3af (patch) | |
tree | 9708370b837dbfc003ba346108e6787b602287fe /shiv.py | |
parent | fac3853e5f77fb0eb84c68f58a1adbf804debf73 (diff) |
lotsa stuff
Diffstat (limited to 'shiv.py')
-rw-r--r-- | shiv.py | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -4,6 +4,8 @@ import xml.etree.ElementTree as ET import optparse import sys import math +import gzip +import bz2 parser = optparse.OptionParser() parser.add_option('-n', '--number', dest='number', action='store_true', help='Show number of tracks') @@ -122,7 +124,13 @@ for fname in args: print print 'File :', fname try: - iv = ET.parse(fname).getroot() + if fname.endswith('.ivz'): + ivf = gzip.open(fname, 'rb') + elif fname.endswith('.ivb'): + ivf = bz2.BZ2File(fname, 'r') + else: + ivf = open(fname, 'rb') + iv = ET.parse(ivf).getroot() except Exception: import traceback traceback.print_exc() |