Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/FoxxMD/multi-scrobbler. Scrobble plays from multiple sources to multiple clients docs.multi-scrobbler.app
deezer docker jellyfin koito lastfm listenbrainz maloja mopidy mpris music music-assistant plex scrobble self-hosted spotify subsonic tautulli youtube-music
Something went wrong. Try again.
2.6 kB · 101 lines
Shell
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102#!/bin/bash
OVERWRITE="0"CONFIRM="1"# https://stackoverflow.com/a/14203146POSITIONAL_ARGS=()
while [[ $# -gt 0 ]]; do case $1 in -b|--buildpath) BUILDPATH="$2" shift # past argument shift # past value ;; -o|--overwrite) OVERWRITE="1" shift # past argument ;; -y|--yes) CONFIRM="0" shift # past argument ;; -*|--*) echo "Unknown option $1" exit 1 ;; *) POSITIONAL_ARGS+=("$1") # save positional arg shift # past argument ;; esacdone
set -- "${POSITIONAL_ARGS[@]}"
if [ ! -f "./io.github.foxxmd.multiscrobbler.yml" ]; then echo "Run this script inside the 'flatpak' directory!" exit 1fi
if [ -z "${BUILDPATH}" ]; then printf "\nNo build path set, using ./build\n" BUILDPATH="${PWD##*/}/build"fi
printf '\nBuild Path: %s' "${BUILDPATH}"if [ "$OVERWRITE" = "1" ]; then echo 'Overwrite Sources: True'; else printf 'Overwrite Sources: False\n'; fi
if [ "$CONFIRM" = "1" ]; then read -p "Continue? (Y/N): " confirm && [[ $confirm == [yY] || $confirm == [yY][eE][sS] ]] || exit 1fi
printf '\n'
cd ../
if [ -d ./node_modules ]; then echo 'Project node_modules exists, deleting...' rm -r node_modulesfi
if [ -d ./docsite/node_modules ]; then echo 'Docsite node_modules exists, deleting...' rm -r docsite/node_modulesfi
GENERATE_SOURCES="1"
if [ -f "flatpak/generated-sources.0.json" ] || [ -f "flatpak/generated-sources.1.json" ]; then if [ "$OVERWRITE" = "0" ]; then echo 'Generated sources exist, will not overwrite.'; GENERATE_SOURCES=0 else echo 'Deleting existing sources...'; rm -f flatpak/generated-sources.0.json rm -f flatpak/generated-sources.1.json fifi
if [ "$GENERATE_SOURCES" = "1" ]; then printf '\nGenerating project sources...\n' rm -f generated-sources.json flatpak-node-generator npm package-lock.json mv generated-sources.json flatpak/generated-sources.0.json
printf '\nGenerating docsite sources...\n' flatpak-node-generator npm docsite/package-lock.json mv generated-sources.json flatpak/generated-sources.1.jsonfi
cd flatpak || exit
mkdir -p "$BUILDPATH"
printf '\nBuilding flatpak app...\n'set -xflatpak-builder --repo="$BUILDPATH"/repo --state-dir="$BUILDPATH"/state "$BUILDPATH"/build io.github.foxxmd.multiscrobbler.yml --force-clean --install --user# https://stackoverflow.com/questions/2853803/how-to-echo-shell-commands-as-they-are-executed#comment135696350_13718771{ set +x; } &> /dev/null
echo 'Done!'