Giter Site home page Giter Site logo

giof71 / yams-docker Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 22 KB

Docker image per YAMS, Yet Another MPD Scrobbler, also on Moode Audio

License: MIT License

Dockerfile 26.77% Shell 73.23%
docker arm64 arm music-player-daemon lastfm scrobbler mpd daily-build moode moodeaudio

yams-docker's Introduction

yams-docker

A Docker image for yams.

Available Archs on Docker Hub

  • linux/amd64
  • linux/arm/v7
  • linux/arm64/v8

References

First and foremost, the reference to the projects:

Yams Music Player Daemon
Current version of yams if 0.7.3.

Links

Source: GitHub
Images: DockerHub

Why

I just wanted to be able to run yams using a docker container.
I wanted to be able to use it on Moode Audio also.

Prerequisites

See this page.
The page also covers docker installation on Moode Audio.

Get the image

Here is the repository on DockerHub.

Getting the image from DockerHub is as simple as typing:

docker pull giof71/yams

Usage

Volumes

The following tables lists the volumes:

VOLUME DESCRIPTION
/data Application data. It is recommended to setup this volume.

Environment Variables

VARIABLE DESCRIPTION
USER_MODE Defaults to YES
PUID User id, defaults to 1000
PGID Group id, defaults to 1000
MPD_HOST Host for Music Player daemon, defaults to localhost, which is generally correct when the container is run in host mode.
MPD_PORT Defaults to 6600

First run

The first run should be interactive, because you will receive the link to be opened in order to authorize yams to access your Last.FM account.
After this initial configuration, if you have setup the volume correctly, you will be able to run the container non interactively.

Example configuration

Please see the following docker-compose file:

---
version: "3"

networks:
  mpd-pulse:
    external: true

services:
  yams:
    image: giof71/yams:latest
    container_name: yams-pulse
    networks:
      - mpd-pulse
    environment:
      - TZ=Europe/Rome
      - PUID=1000
      - PGID=1000
      - MPD_HOST=mpd-pulse
    volumes:
      - ./data:/data

This container runs in the same docker network named mpd-pulse, so we can refer to mpd using its container name, assuming mpd is running in a docker container (see my repo here).
Another example, using host networking:

---
version: "3"

services:
  yams:
    image: giof71/yams:latest
    container_name: yams-pulse
    network_mode: host
    environment:
      - TZ=Europe/Rome
      - PUID=1000
      - PGID=1000
      - MPD_HOST=mpd-hostname.home.lan
      - MPD_PORT=6601
    volumes:
      - ./data:/data

This time we don't have a docker network, and if mpd is not running on localhost, we can specify hostname and port using MPD_HOST and MPD_PORT. Both can be omitted if the values are respectively localhost and 6600.
In both cases, for the first interactive run, execute the following:

docker-compose run yams

Please note that yams here is the name of the service in the docker-compose file.
Follow the instructions on the console, so open the link and authorized the application on Last.FM. Press enter on the console as requested.
After this step, you can simply stop the container (CTRL-C, maybe twice to trigger a kill), then restart it as usual with:

docker-compose up -d

Changes

See the following table.

Date Description
2023-04-19 Routine build after updates to the upstream project
2023-03-09 Support for API_KEY and API_SECRET (#13)
2023-03-04 Add apt proxy support (#4)
2023-03-04 Removing existing pid before restart (#5)
2023-03-04 Fixed volume in Dockerfile (#1)
2023-03-03 Initial release

yams-docker's People

Contributors

giof71 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

yams-docker's Issues

Exits before authentication is complete?

[tune@muckle mpd]$ podman run --pod=upmpd --privileged --replace --name=yams --env MPD_HOST=localhost --volume ~/mpd/yams:/data giof71/yams:latest
CMD_LINE=[yams --keep-alive --no-daemon -m localhost]
User mode enabled
Setting default value for PUID: [1000]
Setting default value for PGID: [1000]
group yams-group does not exist, creating...
user yams-user does not exist, creating...
uid=1000(yams-user) gid=1000(yams-group) groups=1000(yams-group)
user yams-user created.
Created yams-user (group: yams-group)
yams-user:x:1000:1000::/home/yams-user:/bin/bash
Creating home directory ...
Setting ownership ...
Setting home directory ...
yams-user:x:1000:1000::/data:/bin/bash
Executing [yams --keep-alive --no-daemon -m localhost --session-file-path /data/.config/yams/.lastfm_session]...
2024-04-18 15:30:57,461 - yams - INFO - Config found, reading from config at /data/.config/yams/yams.yml...
2024-04-18 15:30:57,461 - yams - INFO - Writing log to file: /data/.config/yams/yams.log
2024-04-18 15:30:57,461 - yams - INFO - Starting up YAMS v0.7.3
2024-04-18 15:30:57,461 - yams - ERROR - Couldn't read session file: [Errno 2] No such file or directory: '/data/.config/yams/.lastfm_session'
2024-04-18 15:30:57,461 - yams - INFO - Attempting new authentication...
2024-04-18 15:30:57,501 - yams - INFO - Token received, navigate to http://www.last.fm/api/auth/?api_key=293ef0836603c5c8023ba86eb413794b&token=tvb5OUdkzxyHasnO5hB6gPt7nY6EM1lE to authenticate...
Press Enter after you've granted scrobble.py permission to access your account...Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/yams/scrobble.py", line 941, in find_session
    with open(session_file_path) as session_f_stream:
         ^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/data/.config/yams/.lastfm_session'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/yams", line 5, in <module>
    from yams.__main__ import main
  File "/usr/local/lib/python3.11/site-packages/yams/__main__.py", line 3, in <module>
    cli_run()
  File "/usr/local/lib/python3.11/site-packages/yams/scrobble.py", line 1062, in cli_run
    user_name, session = find_session(
                         ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/yams/scrobble.py", line 966, in find_session
    session_info = authenticate(token, base_url, api_key, api_secret)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/yams/scrobble.py", line 214, in authenticate
    input(
EOFError: EOF when reading a line

Do I need to pass an argument to tell it to wait until I click the link?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.