Skip to content

[Feature] Create bundled and non-bundled (downloadable dependencies/packages) versions#256

Draft
BobbyESP wants to merge 41 commits intoyausername:masterfrom
BobbyESP:downloadable_packages
Draft

[Feature] Create bundled and non-bundled (downloadable dependencies/packages) versions#256
BobbyESP wants to merge 41 commits intoyausername:masterfrom
BobbyESP:downloadable_packages

Conversation

@BobbyESP
Copy link
Copy Markdown
Contributor

@BobbyESP BobbyESP commented Nov 19, 2023

Pull Request: Move to Downloadable Plugins

Description

This pull request addresses the following changes:

  • Transition from Pre-packaged Libraries: We are moving away from using pre-packaged libraries in favor of downloadable plugins. This change aims to enhance flexibility, maintainability, and customization options for our project.

Changes Made

Benefits

  • Flexibility: Downloadable plugins allow users to choose and update specific components independently (even if Python and FFmpeg are mandatory).
  • Reduced Package Size: This transition helps in minimizing the overall package size (and also apps size that depend on the lib), resulting in faster downloads and reduced resource consumption.
  • Easier Updates: Users can easily update individual plugins without waiting for a complete library update.

Testing

  • Made just manual tests.

Additional Notes

  • None by now

Related Issues

Please review and provide feedback on the proposed changes.

Copy link
Copy Markdown
Contributor Author

@BobbyESP BobbyESP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not yt-dlp but updates of it in commit a71509

@BobbyESP BobbyESP changed the title Move to downloadble plugins instead of pre-packages libraries Move to downloadble plugins instead of pre-packaged libraries Nov 19, 2023
@BobbyESP BobbyESP marked this pull request as ready for review November 20, 2023 22:00
@BobbyESP
Copy link
Copy Markdown
Contributor Author

The plugins support is almost finished; I have to change some things related to the initPython function and even the FFMpeg and Aria2c modules of the lib, but the YoutbeDL module itself can start to be reviewed.

@BobbyESP BobbyESP marked this pull request as draft November 20, 2023 22:03
Comment thread library/src/main/java/com/yausername/youtubedl_android/YoutubeDL.kt Outdated
Comment thread library/src/main/java/com/yausername/youtubedl_android/util/files/FilesUtil.kt Outdated
Comment thread library/src/main/java/com/yausername/youtubedl_android/YoutubeDL.kt Outdated
Comment thread library/src/main/java/com/yausername/youtubedl_android/YoutubeDL.kt Outdated
Comment thread library/src/main/java/com/yausername/youtubedl_android/Constants.kt Outdated
@JunkFood02 JunkFood02 linked an issue Nov 20, 2023 that may be closed by this pull request
@JunkFood02 JunkFood02 self-assigned this Nov 20, 2023
@JunkFood02 JunkFood02 added the enhancement New feature or request label Nov 20, 2023
refactor: Separated the dependencies ensure from the init function
@BobbyESP
Copy link
Copy Markdown
Contributor Author

The initPython function will have to be modified (as well as the other such as the FFmpeg and Aria2c) since the unzip process is already included in the download process. We should probably have to create different functions depending on the flavor

BobbyESP added 2 commits May 31, 2024 17:22
⚠️(WIP): Created product flavors for `:library` module
- nonBundled version not finished and Android doesn't take it as a product variant
@BobbyESP
Copy link
Copy Markdown
Contributor Author

@JunkFood02 Can we talk about how we should handle the libraries downloading? I mean. Should the download function be inside the init one or something like the already implemented in the app demo?

@BobbyESP
Copy link
Copy Markdown
Contributor Author

BobbyESP commented May 31, 2024

EDIT: FIXED

Seems to be an error at build time because of the app, here is the log.

I think that the targetConfiguration isn't correct since I would say that the target should be "bundled" or "nonbundled" but when using those cases Gradle isn't able to find the library:

implementation project(":library") targetConfiguration("bundledDebugRuntimeElements")

@BobbyESP BobbyESP requested a review from JunkFood02 June 3, 2024 08:20
@JunkFood02
Copy link
Copy Markdown
Collaborator

This PR is quite large (4000+ LoC) and hard to review. Could we please split it to smaller and more focused PRs, each addressing a specific topic?

@BobbyESP
Copy link
Copy Markdown
Contributor Author

The changes that are necessary for this functionality require all the work put into this PR since it means almost a rewrite of the library. I will still try to adjust the code to reduce the number of lines and changes, but please keep in mind that this proposed separation requires the changes made.

@BobbyESP
Copy link
Copy Markdown
Contributor Author

I will start by removing the Jetpack Compose app

@JunkFood02
Copy link
Copy Markdown
Collaborator

The changes that are necessary for this functionality require all the work put into this PR

We can just make a pull request depending on another, which means a pull request could only be merge after all it's dependencies got merged into the target branch. This allows us to gradually applying the changes and review them in smaller chunks, making the process more manageable.

@BobbyESP
Copy link
Copy Markdown
Contributor Author

The changes that are necessary for this functionality require all the work put into this PR

We can just make a pull request depending on another, which means a pull request could only be merge after all it's dependencies got merged into the target branch. This allows us to gradually applying the changes and review them in smaller chunks, making the process more manageable.

That's interesting and cool. Can we create those chunks in some way or I have to create different branches with manual changes?

@JunkFood02
Copy link
Copy Markdown
Collaborator

I have to create different branches with manual changes

I'm afraid you'll have to do so by hand since github doesn't support such cool pull requests while gitlab is offering this as a paid feature

You can start with building upon an existing branch. Submit a pull request when you're ready for a new, separate feature and create a new branch based of the current branch for further changes. Just make sure each branch(PR) focus on a single modification or topic for clarity.

Also, when developing on parallel branches simultaneously, avoid modifying the same files. You know what would happen 😈

@JunkFood02
Copy link
Copy Markdown
Collaborator

For example: you can start with the update_library branch

  1. migrating to Gradle Kotlin Script
  2. update dependencies
  3. other independent changes that could be working on at the same time
    • a new compose app for testing
    • replace fastxml with kotlinx.serialization
    • ...
  4. decouple executables and dynamic-linked libraries (this PR)

@BobbyESP
Copy link
Copy Markdown
Contributor Author

Hahah okay, thanks for the help! I will do this as it should be done, as you told me. I'll keep this PR open for a while, but when I think the other smaller PRs cover everything done in this one, I'll close it.

@gabefair
Copy link
Copy Markdown

The changes that are necessary for this functionality require all the work put into this PR since it means almost a rewrite of the library. I will still try to adjust the code to reduce the number of lines and changes, but please keep in mind that this proposed separation requires the changes made.

Would it be easier if you slowly mainlined this branch instead of PR'ing into main?

@deniscerri
Copy link
Copy Markdown
Contributor

@BobbyESP would it be possible to just integrate termux's package manager and internally all the app could do is install packages from the package manager? They would be saved into path and execute normally that way 🤔

@BobbyESP
Copy link
Copy Markdown
Contributor Author

@BobbyESP would it be possible to just integrate termux's package manager and internally all the app could do is install packages from the package manager? They would be saved into path and execute normally that way 🤔

You mean to directly download from the app the necessary packages to work from the Termux apt repository? I see what you're aiming for but implementing something like that might be too complex in practice. So while it’s technically possible, doing it cleanly and reliably would require a lot of work — maybe more than what it’s worth, but you can play with it.

I came across a library called Chaquopy that might solve many of the issues we've been facing with Python, dependencies, and integration. I haven't tried it yet, but it looks promising — it allows you to use pip directly to install packages, and it automatically handles downloading and managing Python dependencies within your Android project.

@deniscerri
Copy link
Copy Markdown
Contributor

@BobbyESP The problem with chaquopy is that the packages are managed by them and alot of them are not available. Like curl cffi. Termux is our best bet i guess
Especially when we have to rely on other executables like ffmpeg.

Id love if we could gather up on discord or telegram, talk this through and try to build a system where packages are built through github actions. We code the shell scripts in the repo and the workflows execute them and then the app downloads them.

I introduced the idea to xibr, he mentioned its difficult but i think we can figure it out.

@BobbyESP
Copy link
Copy Markdown
Contributor Author

BobbyESP commented Jan 2, 2026

@BobbyESP The problem with chaquopy is that the packages are managed by them and alot of them are not available. Like curl cffi. Termux is our best bet i guess Especially when we have to rely on other executables like ffmpeg.

Id love if we could gather up on discord or telegram, talk this through and try to build a system where packages are built through github actions. We code the shell scripts in the repo and the workflows execute them and then the app downloads them.

I introduced the idea to xibr, he mentioned its difficult but i think we can figure it out.

Hi mate!

Yeah, you're absolutely right. I personally prefer to discuss things over Telegram first, if that works for you. Thanks a lot for reaching out! I'd be happy to help, even though I’m no longer working on this, but it definitely sounds like an exciting challenge.

@deniscerri
Copy link
Copy Markdown
Contributor

we could make a gc in telegram, invite me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python & FFmpeg as downloadable plugins

4 participants