Skip to content

Commit

Permalink
Fix dtype string
Browse files Browse the repository at this point in the history
  • Loading branch information
will-moore committed Aug 18, 2021
1 parent 4e9e625 commit c4e4d5c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/omero/plugins/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,15 @@ def _configure(self, parser):
def __call__(self, args):
client = self.ctx.conn(args)
obj = args.object
dtype = obj.__class__.name
# e.g. "ImageI" -> "Image"
dtype = obj.__class__.__name__[:-1]
conn = BlitzGateway(client_obj=client)
conn.SERVICE_OPTS.setOmeroGroup(-1)

if dtype == "FilesetI":
if dtype == "Fileset":
fileset = self.get_object(conn, dtype, obj.id.val)
self.download_fileset(conn, fileset, args.filename)
elif dtype == "ImageI":
elif dtype == "Image":
image = self.get_object(conn, dtype, obj.id.val)
self.download_fileset(conn, image.getFileset(), args.filename)
else:
Expand All @@ -87,6 +88,7 @@ def __call__(self, args):
self.download_file(client, orig_file, target_file)

def download_fileset(self, conn, fileset, dir_path):
self.ctx.out(f"Fileset: {fileset.id}")
template_prefix = fileset.getTemplatePrefix()
for orig_file in fileset.listFiles():
file_path = orig_file.path.replace(template_prefix, "")
Expand Down

0 comments on commit c4e4d5c

Please sign in to comment.