summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlshprung <lshprung@yahoo.com>2021-10-02 16:06:24 -0700
committerlshprung <lshprung@yahoo.com>2021-10-02 16:06:24 -0700
commit011702b518c78f3a8d4635e3c7f3b93780fc585c (patch)
treef98cb73d40dc67db0cb5d1489bbf679e7dafb6cf
parent90c3eba635f31472ca4fb5ebec5910a41221dbbf (diff)
Created README
-rw-r--r--.gitignore2
-rw-r--r--README.md28
-rwxr-xr-xbuild_playlists.plx10
3 files changed, 39 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index 3eef9b1..f56df99 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,5 @@
!build_db.plx
!build_playlists.plx
!shared.pl
+
+!README.md
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..42b67ea
--- /dev/null
+++ b/README.md
@@ -0,0 +1,28 @@
+## Introduction
+
+A set of Perl scripts to help automate the creation of audio playlists. This repository contains two scripts:
+
+- `build_db.plx` - Generate a sqlite3 database for your audio library, including each file's metadata tags
+- `build_playlists.plx` - Generate m3u playlist files based on the sqlite3 database generated by `build_db.plx`
+
+For usage of these scripts, append the `--help` flag
+
+### Example
+
+To build a database of all audio files in your `$HOME/Music` directory, and save the database as `$HOME/Music/library.db`:
+
+```
+./build_db.plx
+```
+
+To create a set of m3u playlists for every album in the database, and output all the m3u files in `$HOME/Music/playlists`:
+
+```
+./build_playlists.plx ALBUM,ALBUMARTIST "$HOME/Music/playlists/{ALBUMARTIST} - {ALBUM}.m3u"
+```
+
+To create an m3u playlist of all files in the database where the 'ARTIST' tag is 'Steely Dan', and save it as `steely_dan.m3u` in the current working directory:
+
+```
+./build_playlists.plx --sql "ARTIST='Steely Dan';" steely_dan.m3u
+```
diff --git a/build_playlists.plx b/build_playlists.plx
index a2e0760..fc5b0f5 100755
--- a/build_playlists.plx
+++ b/build_playlists.plx
@@ -61,7 +61,7 @@ Options:
--sql SQL_STATEMENT generate a single playlist based on output of some SQL statement
Examples:
- $0 ALBUM,ALBUMARTIST /home/john/Music/playlists/{ALBUMARTIST}-{ALBUM}.m3u Generate a playlist for every combination of ALBUM and ALBUMARTIST in the database, with the output file pattern ALBUMARTIST-ALBUM.m3u
+ $0 ALBUM,ALBUMARTIST \"/home/john/Music/playlists/{ALBUMARTIST}-{ALBUM}.m3u\" Generate a playlist for every combination of ALBUM and ALBUMARTIST in the database, with the output file pattern ALBUMARTIST-ALBUM.m3u
$0 --sql \"SELECT PATH FROM LIBRARY WHERE ARTIST='Steely Dan';\" steely_dan.m3u Generate a playlist based on the output of this SQL statement
$0 --sql \"ARTIST='Steely Dan';\" steely_dan.m3u If an incomplete SQL statement is received, the \"SELECT PATH FROM {table_name} WHERE \" part of the SQL statement is assumed to be implied
";
@@ -145,6 +145,14 @@ else {
}
}
+ ## DEBUG TODO remove me
+ #for my $i (keys %tag_hash){
+ # for my $j ($tag_hash{$i}){
+ # print "$j\n";
+ # }
+ #}
+ #die;
+
# TODO break up by semicolon (signifying array of tag values)
# Determine output_file
$output_file = $output_pattern;