music alarm with Linux, nodeJS, Yandex music

Motivation

My sleep and wake up routine consists of:

  1. Calculate when I should wake up, usually, it is time now plus 8 hours(not easy calculations)
  2. Set alarm
  3. Sleep
  4. Turn off alarm
  5. Go to a computer and turn on Yandex music
  6. Do morning staff
  7. After some time turn off the music

At one point in time, I realized that the number of steps can be reduced to:

  1. Set alarm
  2. Sleep
  3. Do morning staff
  4. After some time turn off the music

Script implementation

I decided to write a simple nodeJS script which will enter a system sleep state until a specified wake-up time and after that open up the browser and play the specified playlist.

run the script

There are two basic ways to manage browser from application code: selenium and the Chromium over DevTools protocol. If you want to run selenium you need to download WebDriver first and it seems like a redundant step. So I grab puppeteer since it will download Chrome automatically.

Possible improvements

This script has some flows — it is not cross-platform and relies on the markup. If you want to add support to other operating systems or implement some sort of default alarm in the case of changed markup you can contribute with the code:)

Resources

Repository

Puppeteer

Reach the next level of focus and productivity with increaser.org.

Increaser

--

--

--

Indie hacker behind increaser.org. More at radzion.com

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

🎁XDrake Airdrop

MCQ APPS Flutter with REST API

Serverless Ruby on AWS Lambda with the Jets framework

Customizing Websites With Bookmarklets: How We Improved Our Kanban Board

Popular Flutter Packages in 2021

Development of application without coding –

How does the SQL Server Query Optimizer Works

Modular Health System Pt.02- Game Dev Series 126

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Radzion Chachura

Radzion Chachura

Indie hacker behind increaser.org. More at radzion.com

More from Medium

Headfull Puppeter running in docker without GUI

How to Push a Dockerized Node.js App to a Container Registry

Preventing clickjacking exploits using AWS Cloudfront

Two way SSL encryption using nodejs