mirror of
				https://github.com/community-scripts/ProxmoxVE.git
				synced 2025-11-04 02:12:49 +00:00 
			
		
		
		
	MeTube: Various fixes (#7936)
This commit is contained in:
		
							
								
								
									
										41
									
								
								ct/metube.sh
									
									
									
									
									
								
							
							
						
						
									
										41
									
								
								ct/metube.sh
									
									
									
									
									
								
							@@ -29,6 +29,18 @@ function update_script() {
 | 
			
		||||
    exit
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  if [[ $(echo ":$PATH:" != *":/usr/local/bin:"*) ]]; then
 | 
			
		||||
    echo 'export PATH="/usr/local/bin:$PATH"' >>~/.bashrc
 | 
			
		||||
    source ~/.bashrc
 | 
			
		||||
    if ! command -v deno &>/dev/null; then
 | 
			
		||||
      export DENO_INSTALL="/usr/local"
 | 
			
		||||
      curl -fsSL https://deno.land/install.sh | $STD sh -s -- -y
 | 
			
		||||
    else
 | 
			
		||||
      $STD deno upgrade
 | 
			
		||||
    fi
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  if check_for_gh_release "metube" "alexta69/metube"; then
 | 
			
		||||
    msg_info "Stopping ${APP} Service"
 | 
			
		||||
    systemctl stop metube
 | 
			
		||||
    msg_ok "Stopped ${APP} Service"
 | 
			
		||||
@@ -40,9 +52,7 @@ function update_script() {
 | 
			
		||||
    mv /opt/metube /opt/metube_bak
 | 
			
		||||
    msg_ok "Backup created"
 | 
			
		||||
 | 
			
		||||
  msg_info "Cloning Latest ${APP} Release"
 | 
			
		||||
  $STD git clone https://github.com/alexta69/metube /opt/metube
 | 
			
		||||
  msg_ok "Cloned ${APP}"
 | 
			
		||||
    fetch_and_deploy_gh_release "metube" "alexta69/metube" "tarball" "latest"
 | 
			
		||||
 | 
			
		||||
    msg_info "Building Frontend"
 | 
			
		||||
    cd /opt/metube/ui
 | 
			
		||||
@@ -52,16 +62,9 @@ function update_script() {
 | 
			
		||||
 | 
			
		||||
    PYTHON_VERSION="3.13" setup_uv
 | 
			
		||||
 | 
			
		||||
  msg_info "Setting up Python Environment (uv)"
 | 
			
		||||
  $STD uv venv /opt/metube/.venv
 | 
			
		||||
  $STD /opt/metube/.venv/bin/python -m ensurepip --upgrade
 | 
			
		||||
  $STD /opt/metube/.venv/bin/python -m pip install --upgrade pip
 | 
			
		||||
  $STD /opt/metube/.venv/bin/python -m pip install pipenv
 | 
			
		||||
  msg_ok "Python Environment Ready"
 | 
			
		||||
 | 
			
		||||
    msg_info "Installing Backend Requirements"
 | 
			
		||||
    cd /opt/metube
 | 
			
		||||
  $STD /opt/metube/.venv/bin/pipenv install
 | 
			
		||||
    $STD uv sync --frozen --no-dev
 | 
			
		||||
    msg_ok "Installed Backend"
 | 
			
		||||
 | 
			
		||||
    msg_info "Restoring Environment File"
 | 
			
		||||
@@ -70,16 +73,7 @@ function update_script() {
 | 
			
		||||
    fi
 | 
			
		||||
    msg_ok "Restored .env"
 | 
			
		||||
 | 
			
		||||
  if [[ ! -d /opt/metube/.venv ]]; then
 | 
			
		||||
    msg_info "Migrating to uv-based environment"
 | 
			
		||||
    PYTHON_VERSION="3.13" setup_uv
 | 
			
		||||
    $STD uv venv /opt/metube/.venv
 | 
			
		||||
    $STD /opt/metube/.venv/bin/python -m ensurepip --upgrade
 | 
			
		||||
    $STD /opt/metube/.venv/bin/python -m pip install --upgrade pip
 | 
			
		||||
    $STD /opt/metube/.venv/bin/python -m pip install pipenv
 | 
			
		||||
    $STD /opt/metube/.venv/bin/pipenv install
 | 
			
		||||
    $STD /opt/metube/.venv/bin/pipenv update yt-dlp
 | 
			
		||||
 | 
			
		||||
    if grep -q 'pipenv' /etc/systemd/system/metube.service; then
 | 
			
		||||
      msg_info "Patching systemd Service"
 | 
			
		||||
      cat <<EOF >/etc/systemd/system/metube.service
 | 
			
		||||
[Unit]
 | 
			
		||||
@@ -90,7 +84,7 @@ After=network.target
 | 
			
		||||
Type=simple
 | 
			
		||||
WorkingDirectory=/opt/metube
 | 
			
		||||
EnvironmentFile=/opt/metube/.env
 | 
			
		||||
ExecStart=/opt/metube/.venv/bin/pipenv run python3 app/main.py
 | 
			
		||||
ExecStart=/opt/metube/.venv/bin/python3 app/main.py
 | 
			
		||||
Restart=always
 | 
			
		||||
User=root
 | 
			
		||||
 | 
			
		||||
@@ -109,11 +103,12 @@ EOF
 | 
			
		||||
    msg_ok "Cleaned Up"
 | 
			
		||||
 | 
			
		||||
    msg_info "Starting ${APP} Service"
 | 
			
		||||
  systemctl enable -q --now metube
 | 
			
		||||
    systemctl start metube
 | 
			
		||||
    sleep 1
 | 
			
		||||
    msg_ok "Started ${APP} Service"
 | 
			
		||||
 | 
			
		||||
    msg_ok "Updated Successfully!"
 | 
			
		||||
  fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
start
 | 
			
		||||
 
 | 
			
		||||
@@ -22,7 +22,6 @@ $STD apt-get install -y --no-install-recommends \
 | 
			
		||||
  g++ \
 | 
			
		||||
  musl-dev \
 | 
			
		||||
  ffmpeg \
 | 
			
		||||
  git \
 | 
			
		||||
  make \
 | 
			
		||||
  ca-certificates
 | 
			
		||||
msg_ok "Installed Dependencies"
 | 
			
		||||
@@ -30,25 +29,29 @@ msg_ok "Installed Dependencies"
 | 
			
		||||
PYTHON_VERSION="3.13" setup_uv
 | 
			
		||||
NODE_VERSION="22" setup_nodejs
 | 
			
		||||
 | 
			
		||||
msg_info "Installing Deno"
 | 
			
		||||
export DENO_INSTALL="/usr/local"
 | 
			
		||||
curl -fsSL https://deno.land/install.sh | $STD sh -s -- -y
 | 
			
		||||
[[ ":$PATH:" != *":/usr/local/bin:"* ]] &&
 | 
			
		||||
  echo 'export PATH="/usr/local/bin:$PATH"' >>~/.bashrc &&
 | 
			
		||||
  source ~/.bashrc
 | 
			
		||||
msg_ok "Installed Deno"
 | 
			
		||||
 | 
			
		||||
fetch_and_deploy_gh_release "metube" "alexta69/metube" "tarball" "latest"
 | 
			
		||||
 | 
			
		||||
msg_info "Installing MeTube"
 | 
			
		||||
$STD git clone https://github.com/alexta69/metube /opt/metube
 | 
			
		||||
cd /opt/metube/ui
 | 
			
		||||
$STD npm install
 | 
			
		||||
$STD node_modules/.bin/ng build
 | 
			
		||||
cd /opt/metube
 | 
			
		||||
$STD uv venv /opt/metube/.venv
 | 
			
		||||
$STD /opt/metube/.venv/bin/python -m ensurepip --upgrade
 | 
			
		||||
$STD /opt/metube/.venv/bin/python -m pip install --upgrade pip
 | 
			
		||||
$STD /opt/metube/.venv/bin/python -m pip install pipenv
 | 
			
		||||
$STD /opt/metube/.venv/bin/pipenv install
 | 
			
		||||
$STD /opt/metube/.venv/bin/pipenv update yt-dlp
 | 
			
		||||
$STD uv sync --frozen --no-dev
 | 
			
		||||
 | 
			
		||||
mkdir -p /opt/metube_downloads /opt/metube_downloads/.metube /opt/metube_downloads/music /opt/metube_downloads/videos
 | 
			
		||||
cat <<EOF >/opt/metube/.env
 | 
			
		||||
DOWNLOAD_DIR=/opt/metube_downloads
 | 
			
		||||
STATE_DIR=/opt/metube_downloads/.metube
 | 
			
		||||
TEMP_DIR=/opt/metube_downloads
 | 
			
		||||
YTDL_OPTIONS={"trim_file_name":10}
 | 
			
		||||
YTDL_OPTIONS={"trim_file_name":10,"extractor_args":{"youtube":{"player_client":["default","-tv_simply"]}}}
 | 
			
		||||
EOF
 | 
			
		||||
msg_ok "Installed MeTube"
 | 
			
		||||
 | 
			
		||||
@@ -62,7 +65,7 @@ After=network.target
 | 
			
		||||
Type=simple
 | 
			
		||||
WorkingDirectory=/opt/metube
 | 
			
		||||
EnvironmentFile=/opt/metube/.env
 | 
			
		||||
ExecStart=/opt/metube/.venv/bin/pipenv run python3 app/main.py
 | 
			
		||||
ExecStart=/opt/metube/.venv/bin/python3 app/main.py
 | 
			
		||||
Restart=always
 | 
			
		||||
User=root
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user