bl791/IFDB / utilities /parse-ifarchive.py
bl791's picture
download
raw
1.1 kB
#!/usr/bin/env python3
# This script parses the Master-Index.xml file, using the ifarchivexml
# module. (ifarchivexml.py must be in the current directory, or in your
# Python path.)
#
# Two handy ways to use this:
#
# python3 -i parse-ifarchive.py Master-Index.xml
#
# Starts Python in interactive mode, with rootdir set to the root directory,
# dirs set to a dictionary of directories, and files set to a dictionary
# of files.
#
# python3 parse-ifarchive.py Master-Index.xml Master-Index.pik
#
# Creates a pickle file containing the pickled tuple (rootdir, dirs, files).
# This can then be loaded with the Python commands:
# import pickle
# fl = open('Master-Index.pik', 'r')
# (rootdir, dirs, files) = pickle.load(fl)
# fl.close()
#
# Dec 2019: Updated to Python 3.
import sys
import pickle
import ifarchivexml
if (len(sys.argv) < 2):
print('usage: parse-ifarchive.py file.xml [file.pik]')
sys.exit()
result = ifarchivexml.parse(sys.argv[1])
(rootdir, dirs, files) = result
if (len(sys.argv) > 2):
fl = open(sys.argv[2], 'wb')
pickle.dump(result, fl)
fl.close()

Xet Storage Details

Size:
1.1 kB
·
Xet hash:
1cc515a95cd8b9ccb16e94b9a3023a78851df4c1ae8801e77bfcad30e8efe69a

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.