Skip to content
TheRedCyclops edited this page Sep 25, 2024 · 11 revisions

Documentation

Musicbox is a program writen in bash that will play audio either provided by the user or downloaded from youtube at the specified time

Index

Instalation

Installing musicbox is as simple as following these 8 simple steps

Local

  1. Create Google API credentials, see: Create Google API credentials in 50 easy steps
  2. Setup gdrive on a local system, a web browser is required
  3. Export the account to a file and move it to the system you will be running musicbox on

Remote

  1. Install docker and docker compose and enable the docker daemon service (not the socket!)
  2. Clone this repository git clone https://github.com/TheRedCyclops/musicbox
  3. Change your working directory to the newly cloned repository cd musicbox
  4. Open docker-compose.yml with your favorite text editor and set MUSICBOX_GDRIVE_TAR to the full path to the file you exported previously set MUSICBOX_AUDIO_SERVER to the audio server running on the host, currently the valid values are: alsa, pipewire and pulseaudio
    • if using alsa uncomment the lines 6 and 7
    • if using pipewire run the command on line 13 (remember to remove the # at the start!), uncomment the next line (14) and copy the output of the command output after the dash, an example is provided
    • if using pulseaudio run the command on line 17 (remember to remove the # at the start!) uncomment the lines 18,23 and 24
  5. execute the following command to start musicbox, it will also restart automatically on boot docker compose up -d

To stop musicbox run the following while in the the folder of the directory: docker compose down

Usage

To use musicbox start by loging in into either the account that was setup with musicbox or an account with access to the files created by musicbox, if this is the first time seting up musicbox you'll likely want to log in into the account that was setup with musicbox and possibly share the files with anyone who should have access to the system. Once that is done There are two main files to worry about:

Schedule: This is where you can set the time when the music or audio will be played this can either be done based on when it should start or when it should end, here is an example:

# In this example alarm.mp3 will be played at 7:25 AM
start  07:25  alarm.mp3
# if the file field is set to 'random' it will select the first unscheduled song in the Song List 
start  08:20  random
# lets say that piano.mp3 has a lengh of 2mins, it will be played at 8:28 so that it stops exactly at 8:30
stop   08:30  piano.mp3
# You may place a comment by prefixing it with a '#', inline comments are not currently supported

Song List: A list of urls leading to the the audio to download, they may be from any provider supported by yt-dlp, full list,full line comments are supported, inline comments are not supported

Extra Songs: A folder where you can upload your own audio files that you can then play in the schedule

Configuration: The configuration file for the program, currently there are only two options

# At what time should the program attempt to update the files from the drive
reload-time=07:00
# Currently this only normalizes the volume
post-proccessing=true

Developer Information

Roadmap

  • Add usage instructions
  • Add troubleshooting instructions
  • Add developer information
  • Automatically create all needed files in google drive
  • Add a run test to the precommit unit tests (currently manually run)
  • Delay cleanup until all downloaded files are validated
  • Move all parts of the build script to the docker file
  • Support architectures other than amd64
  • Add option to create a fallback audio file
  • Support running in a subfolder
  • Add env var for selecting between pulseaudio and wireplumber on the host

Legal

DISCLAIMER

This software project ("Software") and any accompanying documentation ("Documentation") are not affiliated with, sponsored by, nor endorsed by Alphabet Inc., its subsidiaries (including but not limited to Google LLC), or any of their affiliates. The Software and Documentation are the result of independent development efforts.

NOTICE TO USERS

The names "Google" and "Alphabet" are trademarks of Alphabet Inc. This Software project is in no way related to, nor does it endorse or support, any products or services provided by Google or its parent company, Alphabet Inc.

Clone this wiki locally