aboutsummaryrefslogtreecommitdiff
path: root/shiv.py
diff options
context:
space:
mode:
Diffstat (limited to 'shiv.py')
-rw-r--r--shiv.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/shiv.py b/shiv.py
index e8cc37d..72569a2 100644
--- a/shiv.py
+++ b/shiv.py
@@ -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()