pithcat: Add support for Archipelago images
authorChrysostomos Nanakos <cnanakos@grnet.gr>
Mon, 18 Nov 2013 16:54:40 +0000 (18:54 +0200)
committerChristos Stavrakakis <cstavr@grnet.gr>
Mon, 18 Nov 2013 17:07:48 +0000 (19:07 +0200)
Make pithcat to be able to work with 'pithosmap://' URLS that contain
the name of an Archipelago map.

snf-image-host/pithcat

index c0a0a60..464a367 100755 (executable)
@@ -92,9 +92,13 @@ def print_data(backend, url):
         size, hashmap = backend.get_object_hashmap(account, account, container,
                                                    object)
     elif type(url) is HashmapURL:
-        hashmap = [hexlify(x)
-                   for x in backend.store.map_get(unhexlify(url.hash))]
         size = int(url.size)
+        try:
+            hashmap = [hexlify(x)
+                       for x in backend.store.map_get(unhexlify(url.hash))]
+        except TypeError:
+            fullhash = "archip:%s" % url.hash
+            hashmap = backend.store.map_get_archipelago(fullhash, size)
     else:
         raise Exception("Invalid URL")