summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--audioconversion.sh40
-rw-r--r--readme.txt6
2 files changed, 46 insertions, 0 deletions
diff --git a/audioconversion.sh b/audioconversion.sh
new file mode 100644
index 0000000..4b53cd1
--- /dev/null
+++ b/audioconversion.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+if [ -z "$1" ] || [ -z "$2" ]
+then
+echo "Enter an input directory followed by an output directory!"
+else
+echo "Copying Directories..."
+find $1 -mindepth 1 -type d -print0| while read -d '' -r dir;
+do
+#echo $dir;
+d1=${dir#$1}
+#echo "$2$d1"
+&>mkdir -v "$2$d1"
+done
+#Link to all pictures, lyric files, etcetera.
+echo "Creating Links for non-audio files..."
+find $1 -iname '*.png' -o -iname '*.jpg' -o -iname '*html' -o -iname '*.lrc' -o -iname '*.txt' -o -iname '*.cue' -o -iname '*.exe' -o -iname '*.mpg' -o -iname '*.bmp' -o -iname '*.ico' | while read file;
+do
+#echo "$2${file#$1}"
+&>ln -p "$file" "$2${file#$1}"
+done
+echo "Copying pre-existing mp3s and unlinkable files..."
+find $1 -iname '*.mp3' -o -iname '*.log' -o -iname '*.m3u' -o -iname '*.m3u8' -o -iname '*.accurip' -o -iname '*pdf' -o -iname '*.rtf'| while read file;
+do
+&>cp "$file" "$2${file#$1}"
+done
+find $1 -iname 'desktop.ini' -o -iname 'Thumbs.db' -o -iname '*nfo'| while read file;
+do
+rm "$file"
+done
+echo "Converting audio... Please be Patient!"
+find $1 -mindepth 2 -type d -print0| while read -d '' -r dir;
+do
+ if [ $(find "$dir" | wc -l) == $(find "$2${dir#$1}" | wc -l) ]
+ then
+ echo "$2${dir#$1} already contains converted files!"
+ else
+ track2track -t mp3 -j 20 -d "$2${dir#$1}" "$dir"/*.flac "$dir"/*.wav "$dir"/*.mp4 "$dir"/*.m4a "$dir"/*.wv "$dir"/*.ape
+ fi
+done
+fi
diff --git a/readme.txt b/readme.txt
new file mode 100644
index 0000000..d2987f7
--- /dev/null
+++ b/readme.txt
@@ -0,0 +1,6 @@
+This is a bash script for taking a directory and its contents and creating a duplicate structure containing converted mp3 files and links to non-audio files for the purpose of saving space.
+************
+Dependencies:
+1. track2track
+************
+I've never written this kind of script before. Please contact me with advice or suggestions regarding syntax, functionality, etcetera. \ No newline at end of file