From 65f8495a121b7c43c02658902459f41c5af01722 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Slavi=C5=A1a=20Are=C5=BEina?= <58952836+tremor021@users.noreply.github.com> Date: Wed, 12 Feb 2025 20:07:32 +0100 Subject: [PATCH] New Script: Kometa (#2281) * add kometa script * scale up LXC a bit * fixes * Update kometa.json --------- Co-authored-by: CanbiZ <47820557+MickLesk@users.noreply.github.com> --- ct/kometa.sh | 80 +++++++++++++++++++++++++++++++++++++++ install/kometa-install.sh | 74 ++++++++++++++++++++++++++++++++++++ json/kometa.json | 39 +++++++++++++++++++ 3 files changed, 193 insertions(+) create mode 100644 ct/kometa.sh create mode 100644 install/kometa-install.sh create mode 100644 json/kometa.json diff --git a/ct/kometa.sh b/ct/kometa.sh new file mode 100644 index 000000000..bd1c86b29 --- /dev/null +++ b/ct/kometa.sh @@ -0,0 +1,80 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +# Copyright (c) 2021-2025 community-scripts ORG +# Author: Slaviša Arežina (tremor021) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/Snawoot/kometa + +# App Default Values +APP="Kometa" +TAGS="media;streaming" +var_cpu="1" +var_ram="1024" +var_disk="4" +var_os="debian" +var_version="12" +var_unprivileged="1" + +header_info "$APP" +base_settings + +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + if [[ ! -f "/opt/kometa/kometa.py" ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + RELEASE=$(curl -s https://api.github.com/repos/Kometa-Team/Kometa/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') + if [[ "${RELEASE}" != "$(cat /opt/kometa_version.txt)" ]] || [[ ! -f /opt/kometa_version.txt ]]; then + msg_info "Updating $APP" + msg_info "Stopping $APP" + systemctl stop kometa + msg_ok "Stopped $APP" + + msg_info "Updating $APP to ${RELEASE}" + cd /tmp + temp_file=$(mktemp) + RELEASE=$(curl -s https://api.github.com/repos/Kometa-Team/Kometa/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') + wget -q "https://github.com/Kometa-Team/Kometa/archive/refs/tags/v${RELEASE}.tar.gz" -O "$temp_file" + tar -xzf "$temp_file" + cp /opt/kometa/config/config.yml /opt + rm -rf /opt/kometa + mv Kometa-${RELEASE} /opt/kometa + cd /opt/kometa + rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED + pip install -r requirements.txt --ignore-installed &> /dev/null + mkdir -p config/assets + cp /opt/config.yml config/config.yml + echo "${RELEASE}" >/opt/kometa_version.txt + msg_ok "Updated $APP to ${RELEASE}" + + msg_info "Starting $APP" + systemctl start kometa + msg_ok "Started $APP" + + msg_info "Cleaning Up" + rm -f $temp_file + msg_ok "Cleanup Completed" + + msg_ok "Update Successful" + else + msg_ok "No update required. ${APP} is already at ${RELEASE}" + fi + exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" +echo -e "${INFO}${YW} Access it using the following URL:${CL}" +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}" \ No newline at end of file diff --git a/install/kometa-install.sh b/install/kometa-install.sh new file mode 100644 index 000000000..524759568 --- /dev/null +++ b/install/kometa-install.sh @@ -0,0 +1,74 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 community-scripts ORG +# Author: Slaviša Arežina (tremor021) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/Snawoot/kometa + +source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +$STD apt-get install -y \ + curl \ + mc \ + sudo +msg_ok "Installed Dependencies" + +msg_info "Setup Python 3" +$STD apt-get install python3-pip -y +rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED +msg_ok "Setup Python 3" + +msg_info "Setup Kometa" +temp_file=$(mktemp) +RELEASE=$(curl -s https://api.github.com/repos/Kometa-Team/Kometa/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') +wget -q "https://github.com/Kometa-Team/Kometa/archive/refs/tags/v${RELEASE}.tar.gz" -O "$temp_file" +tar -xzf "$temp_file" +mv Kometa-${RELEASE} /opt/kometa +cd /opt/kometa +$STD pip install -r requirements.txt --ignore-installed +mkdir -p config/assets +cp config/config.yml.template config/config.yml +echo "${RELEASE}" >/opt/kometa_version.txt +msg_ok "Setup Kometa" + +read -p "Enter your TMDb API key: " TMDBKEY +read -p "Enter your Plex URL: " PLEXURL +read -p "Enter your Plex token: " PLEXTOKEN +sed -i -e "s#url: http://192.168.1.12:32400#url: $PLEXURL#g" /opt/kometa/config/config.yml +sed -i -e "s/token: ####################/token: $PLEXTOKEN/g" /opt/kometa/config/config.yml +sed -i -e "s/apikey: ################################/apikey: $TMDBKEY/g" /opt/kometa/config/config.yml + +msg_info "Creating Service" +cat </etc/systemd/system/kometa.service +[Unit] +Description=Kometa Service +After=network-online.target + +[Service] +Type=simple +WorkingDirectory=/opt/kometa +ExecStart=/usr/bin/python3 kometa.py +Restart=always +RestartSec=30 + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable --now -q kometa +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +rm -f $temp_file +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/json/kometa.json b/json/kometa.json new file mode 100644 index 000000000..715437ecd --- /dev/null +++ b/json/kometa.json @@ -0,0 +1,39 @@ +{ + "name": "Kometa", + "slug": "kometa", + "categories": [ + 13 + ], + "date_created": "2025-02-12", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": null, + "documentation": "https://kometa.wiki/en/latest/", + "website": "https://github.com/Snawoot/Kometa", + "logo": "https://kometa.wiki/en/latest/assets/icon.png", + "description": "Kometa (formerly known as Plex Meta Manager) is a powerful tool designed to give you complete control over your media libraries", + "install_methods": [ + { + "type": "default", + "script": "ct/kometa.sh", + "resources": { + "cpu": 1, + "ram": 1024, + "hdd": 4, + "os": "debian", + "version": "12" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [ + { + "text": "During installation you will be prompted to input your TMDb key, Plex URL and Plex token. Make sure you have them ready.", + "type": "info" + } + ] + }