Last active
June 4, 2018 18:54
-
-
Save rafi/e5b8c3dfb984ac3123be to your computer and use it in GitHub Desktop.
Generate a playlist from a plain text file with songs. Using beets database to query file paths
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
music_path="/mnt/media/music" | |
while read line | |
do | |
song=$(echo $line | sed 's/(.*)//g') | |
artist=$(echo ${song% - *} | sed 's/ *$//') | |
title=$(echo ${song#* - } | sed 's/ *$//') | |
if [ -n "$title" ]; then | |
match=$(beet ls -p artist:"$artist" title:"$title") | |
echo "Artist: $artist Title: $title" | |
if [ -n "$match" ]; then | |
match=${match#${music_path}/} | |
echo $match >> playlist_matched.m3u | |
else | |
echo $line >> playlist_missing.txt | |
fi | |
fi | |
done < $1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The Black Angels - Entrance Song | |
Caribou - Odessa | |
LCD Soundsystem - Dance Yrself Clean | |
Portugal. The Man - Evil Friends | |
Toro Y Moi - Still Sound | |
Yelle - Ce Jeu | |
Young the Giant - My Body | |
Serebro - Mi Mi Mi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment