Giter Site home page Giter Site logo

soundkid's Introduction

soundkid - a spotify music player for kids

soundkid is software that can be used by kids for playing music from Spotify without using a complicated interface like a display. Instead it can be used with a RFID Reader (I'm currently using a Neuftech USB RFID Reader) to interact with the music box.

soundkid is inspired by Phoniebox and Toniebox and uses librespot to interact with Spotify. I started my own project instead of using Phoniebox to learn more about the Rust language.

Overview

soundkid does read a configuration file from ~/.soundkid.conf and waits for input events from the input device (eg. the RFID Reader) and then starts soundkid-player to play something.

Configuration

The configuration must be located at ~/.soundkid.conf and should be YAML. Here's an example:

---
gpio:  # GPIO config is optional
  "/dev/gpiochip0":  # this is the GPIO device path
    5: "VOLUME_DECREASE"  # this is a mapping between the GPIO pin (5 in this case) and the action
    6: "VOLUME_INCREASE"  # another mapping
input:
  "HXGCoLtd Keyboard":
    00000044886655661122: "spotify:playlist:43nVldajDhG1YVwZKxVh"
    00000011559977882233: "https://open.spotify.com/album/7LQhG0xSDjFiKJnziyB3Zj?si=eFQbWbq0Q16q6Go8tjlCvw"
    00000044772255668800: "https://open.spotify.com/album/5N73vwGXol4maS9U6HLp0o?si=oWBQKSpWReuOPnr50ayWSw"
    00000044772255668800: "PAUSE"
    00000011666611330099: "RESUME"
    00000011666611330100: "VOLUME_INCREASE"
    00000011666611330101: "VOLUME_DECREASE"
alsa:
  control: "SoftMaster"
spotify:
  username: "my-spotify-username"
  password: "my-secret-spotify-password"

The gpio map is optional and can be used to map actions to GPIO pins. The gpio map contains another map with the GPIO device name as key. The value is another key/value pair where the key (in the example 5 or 6) is the GPIO pin and the value (in the example "VOLUME_DECREASE" and "VOLUME_INCREASE") is the action.

The input map is similar to the gpio map. "HXGCoLtd Keyboard" is the key (this could also be eg. /dev/input/event15, try sudo evtest to get information about the available devices) and under that key is another map that contains key/value pairs of tags (in this example the values starting with 00000) and actions (in this example spotify uris or other actions like "PAUSE", "RESUME", ...)

The alsa map has currently only control key. That's the ALSA control (try amixer to get a list of controls) to that is used to increase/decrease the volume.

The spotify map must contain username and password.

The following actions (beside the spotify URIs) are currently available:

  • PAUSE: pause the current soundkid-player process
  • RESUME which resume the paused soundkid-player process
  • VOLUME_INCREASE increase the volume by 5%
  • VOLUME_DECREASE decrease the volume by 5%

Debugging

Build the project with:

cargo build

Running soundkid:

RUST_BACKTRACE=full RUST_LOG=debug cargo run --bin soundkid

Building a .deb package

Install cargo deb with cargo install cargo-deb and then build the package with cargo deb.

Contributions

Please use github pull requests for code/doc changes and github issues to report problems or ask questions.

License

The code is licensed under the Apache-2.0 license.

soundkid's People

Contributors

toabctl avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

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.