Skip to content

Media management#625

Open
dormieriancitizen wants to merge 18 commits into
Ballsdex-Team:v3from
dormieriancitizen:media-management
Open

Media management#625
dormieriancitizen wants to merge 18 commits into
Ballsdex-Team:v3from
dormieriancitizen:media-management

Conversation

@dormieriancitizen

Copy link
Copy Markdown
Member

Description of the changes

Basics of the media management asked for—this PR is just the unused files, not conversion yet.

It's a draft because I hate the way boolean_input works—I'm pretty sure it blocks, default doesn't work, etc etc. Literally anything else would be better but I'm not sure what that anything else is (in the past I've used asyncclick but I didn't want to add another dependency). Also, it's kind of slow, even for small DBs, and I'm not quite sure why (it could be overhead from docker exec).

Were the changes in this PR tested?

Yes

@dormieriancitizen dormieriancitizen marked this pull request as ready for review June 4, 2025 02:49
@dormieriancitizen

Copy link
Copy Markdown
Member Author

OK, I'm much more happy with how this looks now. I've used ffmpeg instead of imagemagick like the issue suggested, since I'm more familiar with it, but it seems to work equally well.

I've tested the changes with a mix of PNGs, JPEGs, and gifs, and they all seem to convert properly, though it would be good to check on more things.

If there are any usability changes for the commands you think would be good, I'm happy to implement them.

@laggron42 laggron42 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

So far I checked the conversion media tool, works good! Lot of nitpicks regarding style but most of that is just applying suggestions in raw.

I would also appreciate having a flag for changing the output format like avif

Comment thread admin_panel/media_management/management/commands/remove_unused_media.py Outdated
Comment thread admin_panel/media_management/management/commands/convert_media.py Outdated
Comment thread admin_panel/media_management/management/commands/_media_manager.py Outdated
Comment thread admin_panel/media_management/management/commands/_media_manager.py Outdated
Comment thread admin_panel/media_management/management/commands/convert_media.py Outdated
Comment thread admin_panel/media_management/management/commands/convert_media.py Outdated
Comment thread admin_panel/media_management/management/commands/convert_media.py Outdated
Comment thread admin_panel/media_management/management/commands/convert_media.py Outdated
Comment thread admin_panel/media_management/management/commands/convert_media.py Outdated
Comment thread admin_panel/media_management/management/commands/convert_media.py Outdated
@dormieriancitizen

Copy link
Copy Markdown
Member Author

Pre-commit is failing because of a line

  /home/runner/work/BallsDex-DiscordBot/BallsDex-DiscordBot/admin_panel/bd_models/models.py:260:29 - error: Expected 0 positional arguments (reportCallIssue)

I don't think I changed anything there, so I'm not sure why checks are failing. I've added the target format argument and it seems to work.

@laggron42

Copy link
Copy Markdown
Member

It's also failing on master and I'm not sure why. You don't have to worry about it, I'll look into it

@dormieriancitizen

Copy link
Copy Markdown
Member Author

I was using this on my own dex and I fixed a couple little things that annoyed me

@dormieriancitizen

Copy link
Copy Markdown
Member Author

Realizing now that conversion probably won't work on pure windows (WSL / docker should be fine) because the shell won't be the same. I don't have a windows device to test on so not sure if that's actually true or just a incorrect assumption.

@dormieriancitizen

Copy link
Copy Markdown
Member Author

Ok, made the changes suggested on discord.

  • Ffmpeg output to tmp dir and then copy into the media folder so junk doesn't get produced on error
  • Skip non-image formats (right now the list of image formats is hard coded, but let me know if you can think of a better way to do it)

@dormieriancitizen dormieriancitizen force-pushed the media-management branch 2 times, most recently from 8fd9f47 to e3a5e63 Compare November 26, 2025 20:29
@dormieriancitizen dormieriancitizen changed the base branch from master to v3 January 2, 2026 21:51
@dormieriancitizen

Copy link
Copy Markdown
Member Author

Changed base branch to v3, is probably broken rn, will test later

@dormieriancitizen dormieriancitizen marked this pull request as draft January 2, 2026 21:52
@dormieriancitizen

Copy link
Copy Markdown
Member Author

Updated and tested for v3, all seems to be working. Also added a docs page.

@dormieriancitizen dormieriancitizen marked this pull request as ready for review January 27, 2026 02:28

@laggron42 laggron42 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Wooo we're almost there (sorry for the insane delay)

Comment thread admin_panel/media_management/management/commands/convert_media.py
Comment thread admin_panel/media_management/management/commands/convert_media.py Outdated
Comment thread admin_panel/media_management/management/commands/convert_media.py Outdated
Comment thread admin_panel/media_management/management/commands/convert_media.py Outdated
Comment thread admin_panel/media_management/management/commands/convert_media.py Outdated
Comment thread admin_panel/media_management/management/commands/_media_manager.py Outdated
Comment thread docs/selfhosting/misc/managing-media.md
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.

2 participants