Skip to content

Instantly share code, notes, and snippets.

@symm
Created November 12, 2012 11:44
Show Gist options
  • Save symm/4058889 to your computer and use it in GitHub Desktop.
Save symm/4058889 to your computer and use it in GitHub Desktop.
Hack in Zip file support to gromlist (http://mundogeek.net/gromlist/)
--- /usr/lib/gromlist/gromlist.py 2012-11-12 11:36:55.697698407 +0000
+++ gromlist.py 2012-11-12 11:41:32.703071996 +0000
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#:!/usr/bin/env python
# -*- coding: UTF-8 -*-
###
#
@@ -1047,8 +1047,21 @@
# Calculate the CRC of the files in the rom folder
statusbar.push(statusbar.get_context_id("Calculating CRC"), _("Calculating CRC"))
crcs = {}
-for rom_file in os.listdir(rom_folder):
- crcs[get_crc(rom_folder + "/" + rom_file)] = rom_folder + "/" + rom_file
+zfile = ZipFile
+for root,dirs,files in os.walk(rom_folder):
+ for f in files:
+ fullpath = os.path.join(root,f)
+ if os.path.splitext(f)[1] == ".zip":
+ zfile = ZipFile(fullpath)
+ for info in zfile.infolist():
+ if os.path.splitext(info.filename)[1] == ".nds":
+ crcs["%X" % info.CRC] = fullpath
+ zfile.close()
+ elif os.path.splitext(fullpath)[1] == ".nds":
+ crcs[get_crc(fullpath)] = fullpath
+ elif os.path.splitext(fullpath)[1] == ".rar":
+ print "DEBUG: %s rar not supported yet..." % fullpath
+
# Search for the dat to load by default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment