Files
HS-Rename/build_appimage.sh
T
Bulk RenamerandCursor 085d6dc296 Add TheTVDB episode title matching and release v1.0.3.
Match filenames to TheTVDB episode order (default, aired, DVD, etc.) to fix chaotic SxxExx numbering while preserving titles.

Co-authored-by: Cursor <[email protected]>
2026-07-03 16:47:37 -05:00

70 lines
2.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# Build HSRename as an AppImage.
# Requires: pip install -r requirements.txt -r requirements-build.txt
# Optional: appimagetool from https://github.com/AppImage/appimagetool/releases (for building the final .AppImage)
# Uses HSRename.png in the project folder as the app icon.
set -e
cd "$(dirname "$0")"
APP_NAME="HSRename"
APPDIR="${APP_NAME}.AppDir"
EXE_NAME="$APP_NAME"
echo "=== Installing build deps ==="
pip install -q -r requirements.txt -r requirements-build.txt
echo "=== Running PyInstaller ==="
pyinstaller --noconfirm --onedir --windowed \
-n "$EXE_NAME" \
--hidden-import=engine \
--hidden-import=engine.rules \
--hidden-import=engine.pipeline \
--hidden-import=engine.tvdb_client \
--hidden-import=engine.episode_match \
--hidden-import=gui \
--hidden-import=gui.main_window \
--hidden-import=gui.rule_widgets \
main.py
echo "=== Creating AppDir ==="
rm -rf "$APPDIR"
mkdir -p "$APPDIR/usr/bin"
cp -a "dist/$EXE_NAME" "$APPDIR/usr/bin/"
cat > "$APPDIR/AppRun" << EOF
#!/bin/sh
SELF=\$(readlink -f "\$0")
HERE=\${SELF%/*}
exec "\$HERE/usr/bin/$EXE_NAME/$EXE_NAME" "\$@"
EOF
chmod +x "$APPDIR/AppRun"
cat > "$APPDIR/hsrename.desktop" << 'EOF'
[Desktop Entry]
Name=HSRename
Comment=Mass rename files with preview and flexible rules
Exec=HSRename
Icon=HSRename
Type=Application
Categories=Utility;FileTools;
EOF
# Use project icon as app icon and logo
if [[ -f HSRename.png ]]; then
cp HSRename.png "$APPDIR/HSRename.png"
else
echo "Warning: HSRename.png not found; appimagetool may fail or use no icon."
fi
echo "=== Building AppImage (requires appimagetool) ==="
# Note: appimagetool does not accept plain https URLs for -u; use zsync/gh-releases-zsync per AppImage docs.
if command -v appimagetool &>/dev/null; then
OUT="${APP_NAME}.AppImage"
appimagetool "$APPDIR" "$OUT"
echo "Done: $OUT"
else
echo "AppDir is ready at $APPDIR/"
echo "To create the .AppImage, install appimagetool and run:"
echo " appimagetool $APPDIR ${APP_NAME}.AppImage"
echo " # Get it from: https://github.com/AppImage/appimagetool/releases"
fi