From 0a90b09a0fe00ab6bb948727650b42931db80bd2 Mon Sep 17 00:00:00 2001 From: Pierre Neidhardt Date: Fri, 17 Jan 2014 12:16:56 +0100 Subject: [PATCH] Musish: xray script --- .config/musish/config.sh | 3 +++ .config/musish/scripts/xray.sh | 44 ++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 .config/musish/scripts/xray.sh diff --git a/.config/musish/config.sh b/.config/musish/config.sh index 8512a5d6..ee051372 100644 --- a/.config/musish/config.sh +++ b/.config/musish/config.sh @@ -9,6 +9,9 @@ library_ext="/media/backup2/Musics" use_colors=true use_formatting=true +## Replace chars +tagsed="s/[’´]/'/g; s/]/)/g; s/\[/(/g; s| *[/|\\:] *| - |g" + ## French constants="$constants un une de du le la les et mais pour ni ou à a où contre entre chez dans sur que qui " ## German diff --git a/.config/musish/scripts/xray.sh b/.config/musish/scripts/xray.sh new file mode 100644 index 00000000..65b6cea8 --- /dev/null +++ b/.config/musish/scripts/xray.sh @@ -0,0 +1,44 @@ +#!/bin/sh + +## X-Ray Dog. + +## Albums actually have years, but is it relevent since they have a code? +date="" +## Genre could be Soundtrack, or Trailer Music. We choose "" for now. +genre="" + +## Extract album code, assuming parent folder is "XRCD## - $album". +XRCD="${FILENAME%/*}" +XRCD="${XRCD##*/}" +XRCD="${XRCD%% - *}" + +## Append the album code to the constants array, other it will be capitalized. +constants="$constants $XRCD " + +if [ -z "${album%%XRCD *}" ]; then + ## Change "XRCD - ## - ..." -> "XRCD## - " + album="${album#XRCD}" + album="${album##*[0-9] }" + album="${album#-}" + album="$XRCD - $album" +elif [ -n "${album%%XRCD*}" ]; then + album="$XRCD - $album" +fi + +if [ -z "${title}" ]; then + title="${FILENAME##*/}" + title="${title%.*}" + # title="$(echo "$title" | sed 's/X-Ray Dog//')" + title="$(echo "$title" | sed 's/X-Ray Dog\( \?- \?\)\?//')" +fi +if [ -z "${track}" ]; then + track="${title% *}" + title="${title#* }" +fi + +subscript="$(findscript vorbis)" +if [ ! -f "$subscript" ]; then + _error "Subscript '$subscript' not found." +else + . "$subscript" +fi