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

Conversion support #103

Merged
merged 20 commits into from
Nov 27, 2023
Merged

Conversion support #103

merged 20 commits into from
Nov 27, 2023

Conversation

Casvt
Copy link
Owner

@Casvt Casvt commented Nov 6, 2023

No description provided.

@Casvt Casvt mentioned this pull request Nov 6, 2023
@Casvt
Copy link
Owner Author

Casvt commented Nov 6, 2023

The setting values can be found at GET /settings and then the keys convert (post-download convert; bool) and format_preference (format preference; List[str]).

The available formats can be acquired by fetching GET /settings/availableformats. The value of format_preference when doing POST /settings should be a list where all values are a string and should be found in the output of GET /settings/availableformats.

The conversion proposal can be fetched from GET /volumes/<int:id>/convert and GET /issues/<int:id>/convert. It is not implemented in the backend yet, so I have made the function return an example for now with which you can work. Both the example output (current) and the actual output in the future are in the following format:

[
    {
        'before': '/folder/file.zip'
        'after': '/folder/file.cbz'
    },
    {
        'before': '/folder/file_2.zip'
        'after': '/folder/file_2.cbz'
    }
]

Applying the conversion can be done via POST /volumes/<int:id>/convert and POST /issues/<int:id>/convert. The body should be a List[str] where each str is a filepath from the before key in the proposal. E.g. ['/folder/file.zip', '/folder/file_2.zip'].

As far as I know, this is all you need to build the frontend, but let me know if you're missing something or have a question :)

@Casvt
Copy link
Owner Author

Casvt commented Nov 7, 2023

All the backend is written now. Only thing left is the frontend and adding more conversion classes. The only conversion available currently is ZIP to CBZ (because it's purely renaming the extension, so easy to add and test with). But now we can start adding conversions like RAR to CBR, RAR to CBZ, RAR to ZIP, etc.

Maybe we should also add conversion methods for turning an archive file (CBZ, ZIP, RAR, CBR, EPUB, etc.) in to raw files on the disk? Something like: extract files in to sub-folder -> filter extracted files for relevance -> delete irrelevant files -> move and rename relevant files. That is exactly what the unzipping feature is doing currently.

Then we can merge unzipping with converting, because then unzipping is just the same as converting a ZIP to files. I think that, whatever way we do it, we should combine unzipping and conversion into one feature.

@Casvt
Copy link
Owner Author

Casvt commented Nov 13, 2023

Added UI for conversion, so only the only thing left is the conversion settings in the UI and merging unzipping with converting.

@Casvt Casvt linked an issue Nov 23, 2023 that may be closed by this pull request
@Casvt Casvt marked this pull request as draft November 27, 2023 12:37
@Casvt Casvt marked this pull request as ready for review November 27, 2023 17:38
@Casvt Casvt merged commit 28539fc into development Nov 27, 2023
@Casvt Casvt deleted the conversion_support branch November 27, 2023 17:40
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

Successfully merging this pull request may close these issues.

(Automatic) File conversion
2 participants