Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate file formats from Hachior project (in python) #75

Open
tonyqus opened this issue Dec 15, 2024 · 10 comments
Open

Migrate file formats from Hachior project (in python) #75

tonyqus opened this issue Dec 15, 2024 · 10 comments

Comments

@tonyqus
Copy link
Contributor

tonyqus commented Dec 15, 2024

I found that there is a long file format parser list from Hachior project. I have thought of migrating the whole Hachoir to .NET with the project name NHachoir. But it looks like your project works well. I'm considering directly migrating some file format parsers to your project.

Let me know your thoughts on this.

@neilharvey
Copy link
Owner

Sure, feel free to send some PRs for formats if you like. It's probably only worth focusing on ones which are likely to be commonly used though. The original intent with this library was that I wanted the list of formats to be easily extensible and customisable to fit the use case so that people can plug in the formats they want to use rather than it being a comprehensive 'catch all' solution.

@tonyqus
Copy link
Contributor Author

tonyqus commented Dec 15, 2024

Ok. I chose a few commonly used file formats from the Hachior file format list.

TODO List

  • rar: Roshal archive (RAR)
  • tar: TAR archive
  • swf: Macromedia Flash data
  • flv: Macromedia Flash video
  • wmf: Microsoft Windows Metafile (WMF)
  • targa: Truevision Targa Graphic (TGA)
  • midi: MIDI audio
  • mod: Uncompressed amiga module
  • flac: FLAC audio
  • psd: Photoshop (PSD) picture

@neilharvey
Copy link
Owner

Sure, that looks like a reasonable list - thanks.

Although you don't need to worry about Quicktime and Ogg as we already have those covered. I think the rest are all new :)

@tonyqus
Copy link
Contributor Author

tonyqus commented Dec 15, 2024

Can you merge #79 first? Since I need to use the newly added FileFormat constructor.

@neilharvey
Copy link
Owner

Sorry, but could you write the signature headers in hex instead please? It is much easier to debug issues because we are just comparing like-for-like rather than converting between text and hex.

@tonyqus
Copy link
Contributor Author

tonyqus commented Dec 16, 2024

I don't think string signature may hurt your debugging capacity. It still converts string to hex byte array. There is nothing different.

And Hachior also uses string signature
https://github.com/vstinner/hachoir/blob/e4b13af02e19cae27231b8466a1949125786c88b/hachoir/parser/audio/flac.py#L150

@neilharvey
Copy link
Owner

I disagree, sorry. I prefer to compare hex to hex than have to translate from the string representation.

I also have a concern that Convert.ToByte to parse the string could have some unexpected runtime behaviour as it is based on the consumer's current culture.

@tonyqus
Copy link
Contributor Author

tonyqus commented Dec 17, 2024

Since it's your project, I'd like to follow your rule. The code in #79 is revoked. No string signature anymore.

@neilharvey
Copy link
Owner

Thanks, I've merged in the latest round of PRs. I've also implemented swf from the todo list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants