Align to code standards

This commit is contained in:
Matthew Stern 2026-01-25 18:46:57 -05:00 committed by Michel Roegl-Brunner
parent ad48c14cf3
commit d25f48f5be
3 changed files with 53 additions and 25 deletions

View File

@ -1,8 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func)
# Copyright (c) 2021-2026 community-scripts ORG # Copyright (c) 2021-2026 community-scripts ORG
# Author: Matthew Stern # Author: Matthew Stern (sternma)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
# Source: https://github.com/dmunozv04/iSponsorBlockTV # Source: https://github.com/dmunozv04/iSponsorBlockTV
APP="iSponsorBlockTV" APP="iSponsorBlockTV"
@ -11,7 +11,7 @@ var_cpu="${var_cpu:-1}"
var_ram="${var_ram:-1024}" var_ram="${var_ram:-1024}"
var_disk="${var_disk:-4}" var_disk="${var_disk:-4}"
var_os="${var_os:-debian}" var_os="${var_os:-debian}"
var_version="${var_version:-12}" var_version="${var_version:-13}"
var_unprivileged="${var_unprivileged:-1}" var_unprivileged="${var_unprivileged:-1}"
header_info "$APP" header_info "$APP"
@ -23,11 +23,44 @@ function update_script() {
header_info header_info
check_container_storage check_container_storage
check_container_resources check_container_resources
if [[ ! -d /opt/isponsorblocktv ]]; then if [[ ! -d /opt/isponsorblocktv ]]; then
msg_error "No ${APP} Installation Found!" msg_error "No ${APP} Installation Found!"
exit exit
fi fi
msg_error "Currently we don't provide an update function for ${APP}."
if check_for_gh_release "isponsorblocktv" "dmunozv04/iSponsorBlockTV"; then
msg_info "Stopping Service"
systemctl stop isponsorblocktv
msg_ok "Stopped Service"
if [[ -d /var/lib/isponsorblocktv ]]; then
msg_info "Backing up Data"
cp -r /var/lib/isponsorblocktv /var/lib/isponsorblocktv_data_backup
msg_ok "Backed up Data"
fi
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "isponsorblocktv" "dmunozv04/iSponsorBlockTV"
msg_info "Setting up iSponsorBlockTV"
$STD python3 -m venv /opt/isponsorblocktv/venv
$STD /opt/isponsorblocktv/venv/bin/pip install --upgrade pip
$STD /opt/isponsorblocktv/venv/bin/pip install /opt/isponsorblocktv
msg_ok "Set up iSponsorBlockTV"
if [[ -d /var/lib/isponsorblocktv_data_backup ]]; then
msg_info "Restoring Data"
rm -rf /var/lib/isponsorblocktv
cp -r /var/lib/isponsorblocktv_data_backup /var/lib/isponsorblocktv
rm -rf /var/lib/isponsorblocktv_data_backup
msg_ok "Restored Data"
fi
msg_info "Starting Service"
systemctl start isponsorblocktv
msg_ok "Started Service"
msg_ok "Updated successfully!"
fi
exit exit
} }

View File

@ -6,12 +6,12 @@
], ],
"date_created": "2026-01-25", "date_created": "2026-01-25",
"type": "ct", "type": "ct",
"updateable": false, "updateable": true,
"privileged": false, "privileged": false,
"interface_port": null, "interface_port": null,
"documentation": "https://github.com/dmunozv04/iSponsorBlockTV/wiki", "documentation": "https://github.com/dmunozv04/iSponsorBlockTV/wiki",
"website": "https://github.com/dmunozv04/iSponsorBlockTV", "website": "https://github.com/dmunozv04/iSponsorBlockTV",
"logo": null, "logo": "https://raw.githubusercontent.com/ajayyy/SponsorBlock/master/public/icons/IconSponsorBlocker512px.png",
"config_path": "/var/lib/isponsorblocktv/config.json", "config_path": "/var/lib/isponsorblocktv/config.json",
"description": "iSponsorBlockTV connects to YouTube TV clients and automatically skips SponsorBlock segments, mutes ads, and presses the Skip Ad button when available.", "description": "iSponsorBlockTV connects to YouTube TV clients and automatically skips SponsorBlock segments, mutes ads, and presses the Skip Ad button when available.",
"install_methods": [ "install_methods": [
@ -23,7 +23,7 @@
"ram": 1024, "ram": 1024,
"hdd": 4, "hdd": 4,
"os": "debian", "os": "debian",
"version": "12" "version": "13"
} }
} }
], ],

View File

@ -1,8 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Copyright (c) 2021-2026 community-scripts ORG # Copyright (c) 2021-2026 community-scripts ORG
# Author: Matthew Stern # Author: Matthew Stern (sternma)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
# Source: https://github.com/dmunozv04/iSponsorBlockTV # Source: https://github.com/dmunozv04/iSponsorBlockTV
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
@ -15,7 +15,6 @@ update_os
INSTALL_DIR="/opt/isponsorblocktv" INSTALL_DIR="/opt/isponsorblocktv"
DATA_DIR="/var/lib/isponsorblocktv" DATA_DIR="/var/lib/isponsorblocktv"
SERVICE_USER="isponsorblocktv"
msg_info "Installing Dependencies" msg_info "Installing Dependencies"
$STD apt-get install -y \ $STD apt-get install -y \
@ -24,23 +23,17 @@ $STD apt-get install -y \
python3-pip python3-pip
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
msg_info "Downloading iSponsorBlockTV" fetch_and_deploy_gh_release "isponsorblocktv" "dmunozv04/iSponsorBlockTV"
fetch_and_deploy_gh_release "isponsorblocktv" "dmunozv04/iSponsorBlockTV" "tarball" "latest" "$INSTALL_DIR"
msg_ok "Downloaded iSponsorBlockTV"
msg_info "Setting up iSponsorBlockTV" msg_info "Setting up iSponsorBlockTV"
python3 -m venv "$INSTALL_DIR/venv" $STD python3 -m venv "$INSTALL_DIR/venv"
$STD "$INSTALL_DIR/venv/bin/pip" install --upgrade pip $STD "$INSTALL_DIR/venv/bin/pip" install --upgrade pip
$STD "$INSTALL_DIR/venv/bin/pip" install "$INSTALL_DIR" $STD "$INSTALL_DIR/venv/bin/pip" install "$INSTALL_DIR"
msg_ok "Set up iSponsorBlockTV" msg_ok "Set up iSponsorBlockTV"
msg_info "Creating service user and data directory" msg_info "Creating data directory"
if ! id "$SERVICE_USER" &>/dev/null; then install -d "$DATA_DIR"
useradd --system --home "$DATA_DIR" --create-home "$SERVICE_USER" msg_ok "Created data directory"
fi
install -d -o "$SERVICE_USER" -g "$SERVICE_USER" "$DATA_DIR"
chown -R "$SERVICE_USER":"$SERVICE_USER" "$INSTALL_DIR"
msg_ok "Created service user and data directory"
msg_info "Creating Service" msg_info "Creating Service"
cat <<EOT >/etc/systemd/system/isponsorblocktv.service cat <<EOT >/etc/systemd/system/isponsorblocktv.service
@ -51,8 +44,8 @@ Wants=network-online.target
[Service] [Service]
Type=simple Type=simple
User=$SERVICE_USER User=root
Group=$SERVICE_USER Group=root
WorkingDirectory=$INSTALL_DIR WorkingDirectory=$INSTALL_DIR
Environment=iSPBTV_data_dir=$DATA_DIR Environment=iSPBTV_data_dir=$DATA_DIR
ExecStart=$INSTALL_DIR/venv/bin/iSponsorBlockTV ExecStart=$INSTALL_DIR/venv/bin/iSponsorBlockTV
@ -93,7 +86,9 @@ cat <<'EOT' >/etc/profile.d/isponsorblocktv.sh
export iSPBTV_data_dir="/var/lib/isponsorblocktv" export iSPBTV_data_dir="/var/lib/isponsorblocktv"
EOT EOT
if ! grep -q '^iSPBTV_data_dir=' /etc/environment 2>/dev/null; then if ! grep -q '^iSPBTV_data_dir=' /etc/environment 2>/dev/null; then
echo 'iSPBTV_data_dir=/var/lib/isponsorblocktv' >>/etc/environment cat <<'EOT' >>/etc/environment
iSPBTV_data_dir=/var/lib/isponsorblocktv
EOT
fi fi
msg_ok "Set default data dir for shells" msg_ok "Set default data dir for shells"