Skip to content

Commit

Permalink
img: Alow auto-detected formats to be overridden on command line
Browse files Browse the repository at this point in the history
  • Loading branch information
keirf committed Sep 28, 2024
1 parent 6113acf commit dde6654
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/greaseweazle/image/img.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,10 @@ def format_from_file(name: str) -> str:
@classmethod
def from_file(cls, name: str, fmt: Optional[codec.DiskDef],
opts: OptDict) -> Image:
error.check(fmt is None,
f'{cls.__name__}: Format cannot be overridden')
format_str = cls.format_from_file(name)
fmt = codec.get_diskdef(format_str)
print(f'{cls.__name__}: Image format {format_str}')
if fmt is None:
format_str = cls.format_from_file(name)
fmt = codec.get_diskdef(format_str)
print(f'{cls.__name__}: Image format {format_str}')
return super().from_file(name, fmt, opts)

# Local variables:
Expand Down

0 comments on commit dde6654

Please sign in to comment.