Skip to content

Simple scripts that I'm using to automate the boring things.

License

Notifications You must be signed in to change notification settings

inputsh/automation-scripts

Repository files navigation

automation-scripts

This is a list of scripts that I use to automate my home. It currently contains the following scripts:

The ideas I have in my head are listed in the ideas.md file and may or may not be created.

diplo_and_friends.py

Automatically download the latest Diplo & Friends BBC radio show by setting up a cronjob to run this script every Sunday morning. Can easily be modified to automatically download any of the BBC shows. The script tries to download every episode available from the show, but get_iplayer is smart enough not to download those that have already been downloaded, therefore avoiding the duplicate downloads.

Bonus points: this script is executed on my Nextcloud server, so there's a php occ files:scan command that re-scans the files in the directory the .mp3 files are placed in. This script is also integrated with Simplepush, so that I would get an Android notification that the new episode is currently being downloaded on my server.

goodreads_to_md_list.py

This script works with the Goodreads API. It fetches the list of books from a public Goodreads shelf, and then outputs the list as a Markdown file. The point of this list is to have it synced in some external file, which could later be backed up (by using Git, as you can see here).

Note that each book in your year needs to have a valid read_at field filled out for the lines 53-65 to work. I could have added a small try/except to fix this, but I specifically wanted it to make sure that every book has a read_at field filled out before continuing.

  • Scripting language: Python 3
  • Prerequisites: pip install requests

hn500-to-simplepush.py

Send a Simplepush notification to your Android device every time a story gets over 500 votes on Hacker News. To use this script, copy it to a device that's constantly online, create a short cronjob for it (something like every five minutes) and modify the script with your Simplepush six-character ID. This script is my re-creation of Pushbullet's Hacker News 500.

This script assumes that you have a file called .hn500-to-simplepush.history in the same folder as this script. What this file does is it acts like a history of every HN ID that Simplepush sent a notification about. If the HN ID that the script finds is already in the history file, it won't trigger a notification.

  • Scripting language: Python3
  • Prerequsites: pip install requests && Simplepush.

music-to-subfolders.sh

This script only gets executed if I'm connected to my home WiFi network. It is meant to be executed every X minutes, and what it does is it moves all the music files from my Downloads folder to a specific subfolder in my Music folder. The subfolder gets named using the <YEAR>-<MONTH> format, and the script automatically creates that folder in case it no longer exists.

This script helps me out to keep my Downloads folder cleaner, and makes sure that the Music files are automatically imported to my music player's library. Later on, I can sync these files to an external location, either by using Nextcloud desktop client, or by using music-to-external-hdd.sh.

  • Scripting language: bash
  • Prerequisites: N/A

music-to-external-hdd.sh

This script is similar to the one above. It only gets executed when I'm on my home WiFi network, and what it does is it automatically copies just edited subfolders from music-to-subfolders.sh into an external hard drive by simply scp-ing them to a Raspberry Pi (to which the external hard drive is connected).

Basically the only reason this script exists and is not a part of the previous one is that I don't want to run the Nextcloud client on my Raspberry Pi, but I am leaving that as an option later on.

  • Scripting language: bash
  • Prerequisites: N/A

About

Simple scripts that I'm using to automate the boring things.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published