You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 25, 2022. It is now read-only.
Right now the program just loops through all possible format readers and tries to unpack with each one of them. Exception happened? Try another reader.
This causes ugly anomalies. For example:
I see XP3, and I know for sure it's XP3 thanks to XP3\r\nWhatever magic number inside. But I haven't supplied --plugin, which causes me to throw an exception. The file is mistakenly delivered to next reader.
I see ANM archive, and it's nice. It correctly unpacks 0 files. But in reality it was a NWA sound file all along, I just didn't happen to know this because ANM was earlier on my check list.
This should be fixed. I could add new exception, say, RecognitionError and catch only that, but this won't make any good to detecting false positives (example from second point).
Before calling unpack, loop through all Transformers
See how many of them recognize the file
If it's just 1 - great! Call unpack on it, and then call it a day.
The unpacker now throws an exception urging you to provide --plugin parameter. Everything goes well, because the file is no longer passed to the next transformer.
If it's more than 1 - this is good, too. I can tell it to the user and advise him to select the --fmt manually.
If it's 0, tough luck. File is not recognized.
Cons of this solution are limited and, in my opinion, negligible:
no account for situation when is_recognized needs --plugin to be able to recognize the file perfectly. In these cases we can try looking at file extensions, their names, etc.
I need to implement is_recognized for every support format. This is going to be tough!
The text was updated successfully, but these errors were encountered:
rr-
pushed a commit
that referenced
this issue
Apr 4, 2015
Right now the program just loops through all possible format readers and tries to unpack with each one of them. Exception happened? Try another reader.
This causes ugly anomalies. For example:
XP3\r\nWhatever
magic number inside. But I haven't supplied--plugin
, which causes me to throw an exception. The file is mistakenly delivered to next reader.This should be fixed. I could add new exception, say,
RecognitionError
and catch only that, but this won't make any good to detecting false positives (example from second point).What should be done instead:
Transformer
(Add common interface for archive and converter #14) a new method,is_recognized
unpack
, loop through allTransformer
sunpack
on it, and then call it a day.--plugin
parameter. Everything goes well, because the file is no longer passed to the next transformer.--fmt
manually.Cons of this solution are limited and, in my opinion, negligible:
is_recognized
needs--plugin
to be able to recognize the file perfectly. In these cases we can try looking at file extensions, their names, etc.is_recognized
for every support format. This is going to be tough!The text was updated successfully, but these errors were encountered: