jeanslack / Videomass

Videomass is a free, open source and cross-platform GUI for FFmpeg and yt-dlp
https://jeanslack.github.io/Videomass/
GNU General Public License v3.0
1.12k stars 51 forks source link

appimage downloader update removal #152

Closed jeanslack closed 1 year ago

jeanslack commented 1 year ago

Closes #142

From now it will no longer be possible to update the yt_dlp and youtube_dl downloaders using the Videomass update tool within the Videomass.AppImage itself. I made this decision after some trouble with Linux distributions.

The only way to update the downloaders within the AppImage is to use the tools provided by the AppImage itself, see https://docs.appimage.org/index.html (see also comments below); Or request/wait for a new updated appimage to be released by the developer when it is ready.

MartinVonReichenberg commented 1 year ago

So does this mean that program via AppImage will be relying more on system libraries and y-dlp / yt-dl ? Or you update those along with the app itself?

jeanslack commented 1 year ago

@MartinVonReichenberg Since it will no longer be possible to update yt-dlp/youtube-dl directly from Videomass, an inexperienced user will have to request or wait for a new updated appimage to be released by the developer when it is ready. If you don't have difficulty using the command line you can still update the Python libraries inside the Videomass appimage. Just extract the appimage, export the path, install the updates with the pip tool and then rebuild the appimage and you will have yt-dlp/youtube-dl updated to the latest release. Example:

$ Videomass-4.0.1-x86_64.AppImage --appimage-extract $ export PATH="$(pwd)/squashfs-root/usr/bin:$PATH" $ SITEPKG="squashfs-root/opt/python3.9/lib/python3.9/site-packages" $ ./squashfs-root/opt/python3.9/bin/python3.9 -m pip install -U --target=$SITEPKG yt_dlp $ export VERSION=$(cat $SITEPKG/videomass-*.dist-info/METADATA | grep "^Version:.*" | cut -d " " -f 2) $ wget -c https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage $ chmod +x appimagetool-x86_64.AppImage $ ./appimagetool-x86_64.AppImage squashfs-root/

jeanslack commented 1 year ago

@MartinVonReichenberg The following script might be handy for that purpose:

#!/usr/bin/env bash
#
# Description:
# ------------
#   Updates pip, certifi, yt-dlp and youtube-dl packages inside 
#   Videomass*.AppImage.
#
# Usage:
# ------
#   - Place this script in your preferred location with execute permissions.
#   - Call this script from a terminal window (not root!) 
#   - Make sure you give it the Videomass AppImage location as argument.
#   - Then run it and wait for the task to finish.
#
#   EXAMPLE:
#         ~$ ./VideomassAppImage_updater.sh /some/other/dir/Videomass*.AppImage
#
# Author: Gianluca Pernigotto <jeanlucperni@gmail.com>
# Copyright: (c) 2020-2022 Gianluca Pernigotto <jeanlucperni@gmail.com>
# Update: Nov.27.2022
#
# please visit <https://misc.flogisoft.com/bash/tip_colors_and_formatting>
# for colors code.

set -e  # stop if error

# check for $1
if [ -z "$1" ] ; then
    echo "ERROR: missing argument: provide a valid pathname to Videomass*.AppImage"
    exit 1
fi

SITEPKG="squashfs-root/opt/python3.9/lib/python3.9/site-packages"
APPIMAGE=$(readlink -f $1)  # selected videomass appimage pathname (absolute path)
BASENAME="$(basename $APPIMAGE)"  # videomass name
DIRNAME="$(dirname $APPIMAGE)"  # videomass directory

# check for proper filename
if [[ "${BASENAME}" != Videomass-*-x86_64.AppImage ]] ; then
    echo "ERROR: requires a Videomass AppImage"
    exit 1
fi

# building in temporary directory to keep system clean.
# Don't use /dev/shm as on some Linux distributions it may have noexec set
TEMP_BASE=/tmp

BUILD_DIR=$(mktemp -d -p "$TEMP_BASE" videomass-AppImage-update-XXXXXX)

# make sure to clean up build dir, even if errors occur
cleanup () {
    if [ -d "$BUILD_DIR" ]; then
    rm -rf "$BUILD_DIR"
    fi
    }
trap cleanup EXIT

# switch to build dir
pushd "$BUILD_DIR"

# extract appimage inside BUILD_DIR/
$APPIMAGE --appimage-extract

# export squashfs-root
export PATH="$(pwd)/squashfs-root/usr/bin:$PATH"

# update pip
./squashfs-root/opt/python3.9/bin/python3.9 -m pip install -U --target=$SITEPKG pip
# update certifi
./squashfs-root/opt/python3.9/bin/python3.9 -m pip install -U --target=$SITEPKG certifi
# update youtube_dl package
./squashfs-root/opt/python3.9/bin/python3.9 -m pip install -U --target=$SITEPKG youtube_dl
# update youtube_dl package
./squashfs-root/opt/python3.9/bin/python3.9 -m pip install -U --target=$SITEPKG yt_dlp

# retrieve the Videomass version from the package metadata
export VERSION=$(cat $SITEPKG/videomass-*.dist-info/METADATA | \
    grep "^Version:.*" | cut -d " " -f 2)

# Download appimagetool for re-building AppImage
wget -c https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage
chmod +x appimagetool-x86_64.AppImage

# Convert back into an AppImage
./appimagetool-x86_64.AppImage squashfs-root/

# move built AppImage back into original DIRNAME
mv -f Videomass*x86_64.AppImage "$DIRNAME/"  # overwrites existent appimage
echo
echo -e '\e[5m\e[92m**Successfully updated**\e[25m\e[39m'  # keyword for a successful exit status
echo -e '\e[1m\e[92m...To apply the update, restart Videomass AppImage now.\e[21m\e[39m'