cjcodeproj / medialibrary

Python code to read XML media files
MIT License
2 stars 0 forks source link

Output format framework #178

Open cjcodeproj opened 2 months ago

cjcodeproj commented 2 months ago

For the tools that generate output reports, most of the processing is based on loading and sorting the data. The output part is easy, and most of that code is in other modules.

Consider an API framework that abstracted the output even further; so a tool like media.tools.movies.list could handle multiple output formats with very little change to the code base.

cjcodeproj commented 1 month ago

Additional Notes

cjcodeproj commented 1 day ago

More Notes

Code should work something like this.

formatter = FormatterClass.new(Style.TEXT)
formatter.format(Output.LIST)
output = formatter.headers()
output += formatter.format_batch(in_batch)
output += formatter.close()
print(output)

There could be other methods, but the idea is the code could output either plain text or HTML without any code change at the application level. The code should also automatically change it's behavior based on the type of content that is being output.