Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion parse_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,8 @@ def __init__(self):
self.cached_name = ""
self.md5_checksum = ""
self.size_in_bytes = 0
self.compressed_size = 0
self.compressed_size = 0
def __hash__(self):
return hash(self.cached_name)
def __eq__(self, other):
return self.cached_name == other.cached_name
33 changes: 26 additions & 7 deletions rescache.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,27 @@
DEFAULT_INDEX_FILENAME = "resfileindex.txt"


def _get_index(filename):
def _get_index(filename, dirs = None):
index = []
try:
index_path = get_index_path(filename)
with open(index_path) as f:
index = parse_index(f)
index += parse_index(f)
except IOError:
print "Couldn't open index file: %s" % index_path
if not dirs:
print "Couldn't open index file: %s" % index_path

if dirs:
for dir in dirs:
try:
index_path = get_index_path(os.path.join(dir, filename))
with open(index_path) as f:
index += parse_index(f)
except IOError:
print "Couldn't open index file: %s" % index_path
index = list(set(index))

if len(index) == 0:
sys.exit(1)
return index

Expand All @@ -43,19 +57,19 @@ def _get_res_folder(args):


def verify_command(args):
verify_cache(_get_index(args.index), _get_res_folder(args))
verify_cache(_get_index(args.index, args.dir), _get_res_folder(args))


def diff_command(args):
diff_cache(_get_index(args.index), _get_res_folder(args))
diff_cache(_get_index(args.index, args.dir), _get_res_folder(args))


def purge_command(args):
purge_cache(_get_index(args.index), _get_res_folder(args))
purge_cache(_get_index(args.index, args.dir), _get_res_folder(args))


def download_command(args):
download_cache(_get_index(args.index), _get_res_folder(args))
download_cache(_get_index(args.index, args.dir), _get_res_folder(args))


def move_command(args):
Expand Down Expand Up @@ -108,6 +122,11 @@ def main():
default=get_shared_cache_folder(),
help="The location of the shared cache to use - defaults to what the EVE client uses"
)
parser.add_argument(
"-d", "--dir",
action='append',
help="Additional directories (EVE installs) to read indexes from"
)
subparsers = parser.add_subparsers()

parser_verify = subparsers.add_parser("verify")
Expand Down