Skip to content

Add folder transcoding#5799

Open
spaceXrace wants to merge 1 commit into
basecamp:devfrom
spaceXrace:add-folder-transcoding
Open

Add folder transcoding#5799
spaceXrace wants to merge 1 commit into
basecamp:devfrom
spaceXrace:add-folder-transcoding

Conversation

@spaceXrace
Copy link
Copy Markdown

Summary

This pull request aims to make transcoding multiple files faster and more convenient:

  1. Adding directory support to the transcode functions like img2jpg. For example, img2jpg folder/ transcodes all images in folder/.

  2. Changing the Nautilus integration to only ask about the output format once when multiple files are selected.

Changes

  • bin/omarchy-transcode

    • Directory input now works for all supported output formats: jpg, png, mp4, gif.
    • Only direct child files are transcoded.
    • Subdirectories are ignored.
    • Files with mismatched media type are skipped, e.g. folder jpg low skips videos.
  • default/nautilus-python/extensions/transcode.py

    • Multi-select now prompts once per media type.
    • Multiple images: one format prompt, one resolution prompt, applied to all images.
    • Multiple videos: one format prompt, one resolution prompt, applied to all videos.
    • Mixed image/video selection prompts once for images and once for videos.
  • migrations/1778424449.sh

    • Refreshes the Nautilus context menu extension on update.
    • Uses the existing install/config/nautilus-python.sh.

Testing

I tested the following scenarios:

  • Transcoding a folder containing images, videos and documents with img2jpg and transcode-video-1080p.
  • Converting a mix of videos and images using the Nautilus context menu option.
  • Transcoding a single image and video.

🤖 Generated with GPT-5.5 low

Copilot AI review requested due to automatic review settings May 13, 2026 10:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds directory input support to the omarchy-transcode script (transcoding all matching direct children with a single format/resolution prompt) and reworks the Nautilus context-menu integration so multi-file selections prompt only once per media type. A migration is added to refresh the Nautilus extension on update.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

Changes:

  • bin/omarchy-transcode: factor out transcode_file / transcode_directory, add media_type_for_format, accept directory input and skip files whose media type doesn't match the chosen output format.
  • default/nautilus-python/extensions/transcode.py: track (media_type, path) per selected file, add _batch_command that prompts once per media type and runs the chosen format/resolution against all matching paths.
  • migrations/1778424449.sh: re-run install/config/nautilus-python.sh so existing installs pick up the updated extension.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

File Description
bin/omarchy-transcode Adds directory mode, helper functions, format/resolution prompts for directories
default/nautilus-python/extensions/transcode.py Switches selection model to per-media-type batches with single format/resolution prompt
migrations/1778424449.sh Migration that re-sources the Nautilus python install script

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +67 to +69
commands.append(self._batch_command(binary, "picture", picture_paths))
if video_paths:
commands.append(self._batch_command(binary, "video", video_paths))
Comment on lines +33 to +52
def _batch_command(self, binary, media_type, paths):
if media_type == "picture":
format_options = "jpg png"
resolution_options = "high medium low"
else:
format_options = "mp4 gif"
resolution_options = "4k 1080p 720p"

commands = [
f"format=$(omarchy-menu-select 'Select {media_type} format' {format_options}) || exit 1",
f"resolution=$(omarchy-menu-select 'Select {media_type} resolution' {resolution_options}) || exit 1",
]

for path in paths:
commands.append(
f"echo {shlex.quote(f'Transcoding {path}')} && "
f"{shlex.join([binary, path])} \"$format\" \"$resolution\" || true"
)

return "; ".join(commands)
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