Skip to content

Instantly share code, notes, and snippets.

View gravelld's full-sized avatar

Dan Gravell gravelld

View GitHub Profile
@gravelld
gravelld / Fantastic Mr Fox.cue
Last active January 28, 2021 13:09
A CUE sheet for Fantastic Mr Fox generated using Vosk speech to text converter. As discussed at https://www.blisshq.com/music-library-management-blog/2021/01/22/splitting-audiobooks-chapters-ai/
PERFORMER "Roald Dahl"
TITLE "Fantastic Mr Fox"
FILE "Fantastic Mr Fox.mp3" MP3
TRACK 01 AUDIO
PERFORMER "Roald Dahl"
TITLE "the three farmers"
INDEX 01 00:00:00
TRACK 02 AUDIO
PERFORMER "Roald Dahl"
TITLE "mr fox"
@gravelld
gravelld / Fantastic Mr Fox-chapters.srt
Last active January 28, 2021 13:09
An .srt file which has been grepped for all instances of "chapter" do we can find the start points of each chapter in one monolithic audiobook file. As discussed at https://www.blisshq.com/music-library-management-blog/2021/01/22/splitting-audiobooks-chapters-ai/
00:00:33,150 --> 00:00:35,490
chapter one the three farmers
4
00:00:37,770 --> 00:00:39,120
down in the valley there were three
--
00:02:30,600 --> 00:02:32,910
chapter two mr fox
@gravelld
gravelld / find-and-replace_html-encoding.regexrule
Last active March 20, 2019 09:37
A custom regex rule to find and replace common HTML character entities
# Find HTML encoding and replace with the decoded value
rule find_replace_html_encoding with label "Find and replace HTML encoding" has alternatives
HTML_DECODED {
find /"/ replace with "\""
find /#/ replace with "#"
find /$/ replace with "$"
find /%/ replace with "%"
find /&/ replace with "&"
find /&lt;/ replace with "<"
find /&gt;/ replace with ">"
@gravelld
gravelld / find-and-replace_template.regexrule
Created January 30, 2019 11:38
A template for find and replace rules
# [Describe the find/replace rule here]
rule find_replace_[rulename] with label "Find and replace [detail]" has alternatives
[RESULT] {
find /[find regex, may include groups]/ replace with "[Substitution string, may include group references]"
}
applies to [tag names, e.g. album_artist, album_name]
[Unit]
Description=bliss
After=network.target
[Service]
Type=simple
# Another Type option: forking
User=music
WorkingDirectory=/opt/bliss
ExecStart=/opt/bliss/bin/bliss.sh
@gravelld
gravelld / debracket.regexrule
Created November 16, 2017 09:35
A custom rule to remove leading and trailing square brackets from genres. Easily adapted to apply to other tags.
rule trim_brackets with label "Trim square brackets" has alternatives
DEBRACKET {
find /^\[*([^\]]*)\]*$/ replace with "$1"
}
applies to genre
@gravelld
gravelld / variousartists.regexrule
Created October 25, 2017 09:25
A custom rule that replaces all "Various" artists with "Various Artists".
# Replace 'Various' with 'Various Artists'
rule force_va with label "Force Various Artists" has alternatives
VARIOUS_ARTISTS {
find /^Various$/ replace with "Various Artists"
}
applies to album_artist, artist
@gravelld
gravelld / rescan-tags.scpt
Created August 15, 2017 10:35
An AppleScript that refresh's iTunes' stored metadata from the selected music files.
tell application "iTunes"
set sel to selection
if sel is {} then return
repeat with aTrack in sel
if class of aTrack is file track then refresh aTrack
end repeat
end tell
#!/bin/bash
ROOT_SOURCE_DIR=$1
ROOT_DEST_DIR=$2
TARGET_FORMAT=$3
# ensure the destination directory structure exists
mkdir -p $ROOT_DEST_DIR
# loop through all files in the source directory
@gravelld
gravelld / suffix-the.regexrule
Last active July 4, 2017 10:20
A custom regex rule for bliss which moves "The" to the end of an artist name. As documented at https://www.blisshq.com/music-library-management-blog/2017/07/04/reordering-the-artist-name/
# Looks for artist names starting with "The" and moves it to the end of the artist name string
rule sortorderthe with label "Move 'The' to end of artist names" has alternatives
SUFFIX {
find /^(?i)(The)\s(.*)$/ replace with "$2, $1"
}
applies to artist, album_artist