Skip to main content

# Flatpak

## Install Requirements​

### Flatpak and flatpak-builder​

Install Flatpak

Install flatpak-builder

#### flatpak-node-generator​

Requires python 3.7+, pip/pipx

## Update Project source​

Set the `branch` `tag` or `commit` to use for MS in the `source` section of `io.github.foxxmd.multiscrobbler.yml`

## Generate Sources and Build​

### Use Setup Script​

A convenience bash script is provided that automates generating offline sources and building the flatpak app for you. This is the recommend method to use.

Located in the project at `flatpak/setup.sh`, run it from the `flatpak` directory with this syntax:

    ./setup.sh -o -b /path/to/flatpak/build/dir

    Args:

    -o => Delete and overwrite any existing generated sources
    -b => The absolute path to the directory that should be used for flatpak build/artifacts. If not defined will use `CWD/build`
    -y => Proceed without confirming settings

### Manual Setup​

If you cannot use `setup.sh` follow the below to manually generate sources and build the flatpak app:

Instructions

#### Use `flatpak-node-generator` to generate sources​

First, make sure `node_modules` is deleted or empty for both the project and `docsite` directories.

Then, from MS project root:

PROJECT_DIR

    flatpak-node-generator npm package-lock.json

Move `generated-sources.json` into `PROJECT_DIR/flatpak` and rename `generated-sources.0.json`

Then, generate `docsite` sources:

PROJECT_DIR

    flatpak-node-generator npm docsite/package-lock.json

Move `generated-sources.json` into `PROJECT_DIR/flatpak` and rename `generated-sources.1.json`

#### Build flatpak​

In the below command replace `/home/yourUser/multi-scrobbler-flatpak` with a directory to use for storing flatpak build/artifacts.

PROJECT_DIR/flatpak

    flatpak-builder --repo=/home/yourUser/multi-scrobbler-flatpak/repo --state-dir=/home/yourUser/multi-scrobbler-flatpak/state /home/yourUser/multi-scrobbler-flatpak/build io.github.foxxmd.multiscrobbler.yml --force-clean

info

Append `--install --user` to the above command to have the app installed immediately.

# Run App

If built with `--install --user` (default when using `setup.sh`) you can now run MS using the command

    flatpak run -u io.github.foxxmd.multiscrobbler