update music scripts
This commit is contained in:
19
private_dot_local/bin/executable_music_convert
Normal file
19
private_dot_local/bin/executable_music_convert
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
target="$1"
|
||||
shift
|
||||
|
||||
set -e
|
||||
|
||||
while [[ ! -z "$1" ]]
|
||||
do
|
||||
path="$1"
|
||||
shift
|
||||
|
||||
out="$(dirname "$path")/$(basename "$path" | sed -e 's/\.[^\.]*$//').$target"
|
||||
if [[ -z "$(echo "$out" | grep "\.$target\$")" ]]
|
||||
then
|
||||
out="$path.$target"
|
||||
fi
|
||||
ffmpeg -i "$path" "$out"
|
||||
done
|
||||
@@ -1,160 +1,201 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
echo "[playlist]" >Playlists/all.pls
|
||||
echo "[playlist]" >Playlists/le.pls
|
||||
echo "[playlist]" >Playlists/lme.pls
|
||||
echo "[playlist]" >Playlists/me.pls
|
||||
echo "[playlist]" >Playlists/mhe.pls
|
||||
echo "[playlist]" >Playlists/he.pls
|
||||
echo "[playlist]" >Playlists/lofi.pls
|
||||
echo "[playlist]" >Playlists/le_lofi.pls
|
||||
echo "[playlist]" >Playlists/unkown.pls
|
||||
echo "[playlist]" >Playlists/dnp.pls
|
||||
set -e
|
||||
|
||||
. "$HOME/.local/share/music/common.sh"
|
||||
|
||||
function generate_pls() {
|
||||
local name="$1"
|
||||
local songs="$2"
|
||||
|
||||
echo "$songs" >"$MUSIC_DIR/Playlists/$name.json"
|
||||
|
||||
local pls="$MUSIC_DIR/Playlists/$name.pls"
|
||||
|
||||
echo "[playlist]" >"$pls"
|
||||
local song_count="$(echo "$songs" | jq -c '. | length' || error_here)"
|
||||
echo -e "Version=2\nNumberOfEntries=$song_count\n" >>"$pls"
|
||||
|
||||
local count=1
|
||||
for bliep in $(echo "$songs" | jq -c 'map(.) | .[]' | sed -e 's/ /%20;/g')
|
||||
do
|
||||
bliep="$(echo "$bliep" | sed -e 's/%20;/ /g')"
|
||||
|
||||
echo "file$count=../$(echo "$bliep" | jq -rc '.path.mpd' || error_here)" >>"$pls"
|
||||
count=$(( $count + 1 ))
|
||||
done
|
||||
}
|
||||
|
||||
function generate_mucke_pls() {
|
||||
local name="$1"
|
||||
local id="$2"
|
||||
local songs="$3"
|
||||
|
||||
paths="[]"
|
||||
local count=1
|
||||
for song in $(echo "$songs" | jq -c '.[]' | sed -e 's/ /%20;/g')
|
||||
do
|
||||
song="$(echo "$song" | sed -e 's/%20;/ /g')"
|
||||
|
||||
path="/storage/emulated/0/Music/$(echo $song | jq -rc '.path.mpd' || error_here)"
|
||||
paths="$(echo "$paths [\"$path\"]" | jq -c -s add || error_here)"
|
||||
done
|
||||
|
||||
echo "{\
|
||||
\"id\": $id,\
|
||||
\"name\": \"$name\",\
|
||||
\"iconString\": \"alarm_rounded\",\
|
||||
\"gradientString\": \"purplelake\",\
|
||||
\"timeCreated\": $(date +%s000),\
|
||||
\"timeChanged\": $(date +%s000),\
|
||||
\"timeLastPlayed\": $(date +%s000),\
|
||||
\"shuffleMode\": null,\
|
||||
\"SONGS\": $paths\
|
||||
}"
|
||||
}
|
||||
|
||||
. ~/.local/python-venv/bin/activate
|
||||
|
||||
files="$(find . -type f -name '*.mp3' -o -name '*.flac' | sed -e 's/ /%20/g')"
|
||||
files="$(find $MUSIC_DIR -type f -iname '*.mp3' -o -iname '*.flac' | sed -e 's/ /%20;/g')"
|
||||
|
||||
list_artist=""
|
||||
list_artist_i=1
|
||||
list_album=""
|
||||
list_album_i=1
|
||||
list_artist="{}"
|
||||
list_album="{}"
|
||||
|
||||
list_songs=""
|
||||
|
||||
for file in $(echo $files)
|
||||
pls_all="[]"
|
||||
pls_he="[]"
|
||||
pls_mhe="[]"
|
||||
pls_me="[]"
|
||||
pls_lme="[]"
|
||||
pls_le="[]"
|
||||
pls_lofi="[]"
|
||||
pls_le_lofi="[]"
|
||||
pls_lofi="[]"
|
||||
pls_dnp="[]"
|
||||
pls_unkown="[]"
|
||||
|
||||
for file in $files
|
||||
do
|
||||
path="$(echo $file | sed -e 's/%20/ /g')"
|
||||
metadata="flac"
|
||||
genre="$(ffmpeg -i "${path}" 2>&1 | grep GENRE | sed -e 's/^.*: //')"
|
||||
artist="$(ffmpeg -i "${path}" 2>&1 | grep ARTIST | sed -e 's/^.*: //')"
|
||||
album="$(ffmpeg -i "${path}" 2>&1 | grep ALBUM | sed -e 's/^.*: //')"
|
||||
title="$(ffmpeg -i "${path}" 2>&1 | grep TITLE | sed -e 's/^.*: //')"
|
||||
blockLevel="0"
|
||||
likeLevel="3"
|
||||
if [[ "$(echo "${path}" | sed -e 's/^.*\.\([^\.]*\)$/\1/')" == "mp3" ]]
|
||||
path="$(echo $file | sed -e 's/%20;/ /g')"
|
||||
song="$(music_get_song_info_from_file "$path")"
|
||||
song="$(music_process_genre "$song")"
|
||||
|
||||
# echo "$song"
|
||||
|
||||
case "$(echo "$song" | jq -rc '.playlist' || error_here)" in
|
||||
'he')
|
||||
pls_all="$(echo "$pls_all [$song]" | jq -c -s add || error_here)"
|
||||
pls_he="$(echo "$pls_he [$song]" | jq -c -s add || error_here)"
|
||||
pls_mhe="$(echo "$pls_mhe [$song]" | jq -c -s add || error_here)"
|
||||
;;
|
||||
'me')
|
||||
pls_all="$(echo "$pls_all [$song]" | jq -c -s add || error_here)"
|
||||
pls_mhe="$(echo "$pls_mhe [$song]" | jq -c -s add || error_here)"
|
||||
pls_me="$(echo "$pls_me [$song]" | jq -c -s add || error_here)"
|
||||
pls_lme="$(echo "$pls_lme [$song]" | jq -c -s add || error_here)"
|
||||
;;
|
||||
'le')
|
||||
pls_all="$(echo "$pls_all [$song]" | jq -c -s add || error_here)"
|
||||
pls_me="$(echo "$pls_me [$song]" | jq -c -s add || error_here)"
|
||||
pls_lme="$(echo "$pls_lme [$song]" | jq -c -s add || error_here)"
|
||||
pls_le="$(echo "$pls_le [$song]" | jq -c -s add || error_here)"
|
||||
pls_le_lofi="$(echo "$pls_le_lofi [$song]" | jq -c -s add || error_here)"
|
||||
;;
|
||||
'lofi')
|
||||
pls_lofi="$(echo "$pls_lofi [$song]" | jq -c -s add || error_here)"
|
||||
pls_le_lofi="$(echo "$pls_le_lofi [$song]" | jq -c -s add || error_here)"
|
||||
;;
|
||||
'dnp')
|
||||
pls_dnp="$(echo "$pls_dnp [$song]" | jq -c -s add || error_here)"
|
||||
;;
|
||||
*)
|
||||
pls_all="$(echo "$pls_all [$song]" | jq -c -s add || error_here)"
|
||||
pls_unkown="$(echo "$pls_unkown [$song]" | jq -c -s add || error_here)"
|
||||
;;
|
||||
esac
|
||||
|
||||
echo -n "$(echo "$list_songs" | jq -c '. | length') "
|
||||
|
||||
artist_name=$(echo "$song" | jq -c '.artist' || error_here)
|
||||
if [[ "$(echo "$list_artist" | jq ". | has($artist_name)" || error_here)" == "false" ]]
|
||||
then
|
||||
metadata="mp3"
|
||||
genre="$(id3v2 -l "${path}" | grep '^TCON' | sed -e 's/^.*: //')"
|
||||
artist="$(id3v2 -l "${path}" | grep '^TPE2' | sed -e 's/^.*: //')"
|
||||
album="$(id3v2 -l "${path}" | grep '^TALB' | sed -e 's/^.*: //')"
|
||||
title="$(id3v2 -l "${path}" | grep '^TIT2' | sed -e 's/^.*: //')"
|
||||
fi
|
||||
if [[ "$genre" == "" ]]
|
||||
then
|
||||
genre="Unkown"
|
||||
fi
|
||||
echo "$genre: ${path}"
|
||||
if [[ "${genre,,}" == "lofi" ]]
|
||||
then
|
||||
echo "file$(cat Playlists/lofi.pls | wc -l)=.${path}" >>Playlists/lofi.pls
|
||||
echo "file$(cat Playlists/le_lofi.pls | wc -l)=.${path}" >>Playlists/le_lofi.pls
|
||||
elif [[ "$(echo ${genre} | grep --no-ignore-case LE)" != "" ]]
|
||||
then
|
||||
echo "file$(cat Playlists/all.pls | wc -l)=.${path}" >>Playlists/all.pls
|
||||
echo "file$(cat Playlists/le.pls | wc -l)=.${path}" >>Playlists/le.pls
|
||||
echo "file$(cat Playlists/lme.pls | wc -l)=.${path}" >>Playlists/lme.pls
|
||||
echo "file$(cat Playlists/le_lofi.pls | wc -l)=.${path}" >>Playlists/le_lofi.pls
|
||||
elif [[ "$(echo ${genre} | grep --no-ignore-case ME)" != "" ]]
|
||||
then
|
||||
echo "file$(cat Playlists/all.pls | wc -l)=.${path}" >>Playlists/all.pls
|
||||
echo "file$(cat Playlists/me.pls | wc -l)=.${path}" >>Playlists/me.pls
|
||||
echo "file$(cat Playlists/lme.pls | wc -l)=.${path}" >>Playlists/lme.pls
|
||||
echo "file$(cat Playlists/mhe.pls | wc -l)=.${path}" >>Playlists/mhe.pls
|
||||
elif [[ "$(echo ${genre} | grep --no-ignore-case HE)" != "" ]]
|
||||
then
|
||||
echo "file$(cat Playlists/all.pls | wc -l)=.${path}" >>Playlists/all.pls
|
||||
echo "file$(cat Playlists/he.pls | wc -l)=.${path}" >>Playlists/he.pls
|
||||
echo "file$(cat Playlists/mhe.pls | wc -l)=.${path}" >>Playlists/mhe.pls
|
||||
elif [[ "$(echo ${genre} | grep --no-ignore-case DNP)" == "" ]]
|
||||
then
|
||||
echo "file$(cat Playlists/all.pls | wc -l)=.${path}" >>Playlists/all.pls
|
||||
echo "file$(cat Playlists/unkown.pls | wc -l)=.${path}" >>Playlists/unkown.pls
|
||||
else
|
||||
echo "file$(cat Playlists/dnp.pls | wc -l)=.${path}" >>Playlists/dnp.pls
|
||||
blockLevel="1"
|
||||
artist_count=$(echo "$list_artist" | jq -c '. | length' || error_here)
|
||||
list_artist="$(echo "$list_artist {$artist_name:{\"artist\":$artist_name,\"index\":$artist_count}}" | jq -c -s add || error_here)"
|
||||
fi
|
||||
|
||||
if [[ "$(echo ${genre} | grep --no-ignore-case 'L[0-3]')" != "" ]]
|
||||
album_name=$(echo "$song" | jq -c '.album' || error_here)
|
||||
if [[ "$(echo "$list_album" | jq ". | has($album_name)" || error_here)" == "false" ]]
|
||||
then
|
||||
likeLevel="$(echo ${genre} | grep --no-ignore-case -o 'L[0-3]' | grep -o '[0-3]')"
|
||||
fi
|
||||
if [[ "$(echo ${genre} | grep --no-ignore-case 'B[0-3]')" != "" ]]
|
||||
then
|
||||
blockLevel="$(echo ${genre} | grep --no-ignore-case -o 'B[0-3]' | grep -o '[0-3]')"
|
||||
album_count=$(echo "$list_album" | jq -c '. | length' || error_here)
|
||||
list_album="$(echo "$list_album {$album_name:{\"album\":$album_name,\"artist\":$artist_name,\"index\":$album_count}}" | jq -c -s add || error_here)"
|
||||
fi
|
||||
|
||||
if [[ "$(echo $list_artist | grep ":$artist")" = "" ]]
|
||||
then
|
||||
list_artist="${list_artist};${list_artist_i}:$artist"
|
||||
list_artist_i=$(( $list_artist_i + 1 ))
|
||||
fi
|
||||
|
||||
if [[ "$(echo $list_album | grep ":${album}:")" = "" ]]
|
||||
then
|
||||
list_album="${list_album};${list_album_i}:$album:$artist"
|
||||
list_album_i=$(( $list_album_i + 1 ))
|
||||
fi
|
||||
|
||||
list_songs="$list_songs\
|
||||
\"/storage/emulated/0/Music/$(echo $path | sed -e 's/^..//')\": {\
|
||||
\"title\": \"$title\",\
|
||||
\"album\": \"$album\",\
|
||||
\"artist\": \"$artist\",\
|
||||
\"albumId\": $(echo $list_album | tr ';' '\n' | grep ":${album}:" | sed -e 's/^\([0-9]*\).*$/\1/'),\
|
||||
\"blockLevel\": $blockLevel,\
|
||||
list_songs="$list_songs {\
|
||||
\"/storage/emulated/0/Music/$(echo "$song" | jq -rc '.path.mpd' || error_here)\": {\
|
||||
\"title\": $(echo "$song" | jq -c '.title' || error_here),\
|
||||
\"album\": $(echo "$song" | jq -c '.album' || error_here),\
|
||||
\"artist\": $(echo "$song" | jq -c '.artist' || error_here),\
|
||||
\"albumId\": $(echo "$list_album" | jq -c ".$(echo "$song" | jq -c '.album' || error_here).index" || error_there),\
|
||||
\"blockLevel\": $(echo "$song" | jq -c '.blockLevel' || error_here),\
|
||||
\"next\": false,\
|
||||
\"previous\": false,\
|
||||
\"likeCount\": $likeLevel,\
|
||||
\"likeCount\": $(echo "$song" | jq -c '.likeLevel' || error_here),\
|
||||
\"playCount\": 0,\
|
||||
\"timeAdded\": $(date +%s)000\
|
||||
},"
|
||||
}\
|
||||
}"
|
||||
list_songs="$(echo "$list_songs" | jq -c -s add || error_here)"
|
||||
done
|
||||
|
||||
echo -e "NumberOfEntries=$(($(cat Playlists/all.pls | wc -l) - 1))\nVersion=2" >>Playlists/all.pls
|
||||
echo -e "NumberOfEntries=$(($(cat Playlists/le.pls | wc -l) - 1))\nVersion=2" >>Playlists/le.pls
|
||||
echo -e "NumberOfEntries=$(($(cat Playlists/lme.pls | wc -l) - 1))\nVersion=2" >>Playlists/lme.pls
|
||||
echo -e "NumberOfEntries=$(($(cat Playlists/me.pls | wc -l) - 1))\nVersion=2" >>Playlists/me.pls
|
||||
echo -e "NumberOfEntries=$(($(cat Playlists/mhe.pls | wc -l) - 1))\nVersion=2" >>Playlists/mhe.pls
|
||||
echo -e "NumberOfEntries=$(($(cat Playlists/he.pls | wc -l) - 1))\nVersion=2" >>Playlists/he.pls
|
||||
echo -e "NumberOfEntries=$(($(cat Playlists/le_lofi.pls | wc -l) - 1))\nVersion=2" >>Playlists/le_lofi.pls
|
||||
echo -e "NumberOfEntries=$(($(cat Playlists/lofi.pls | wc -l) - 1))\nVersion=2" >>Playlists/lofi.pls
|
||||
echo -e "NumberOfEntries=$(($(cat Playlists/unkown.pls | wc -l) - 1))\nVersion=2" >>Playlists/unkown.pls
|
||||
echo -e "NumberOfEntries=$(($(cat Playlists/dnp.pls | wc -l) - 1))\nVersion=2" >>Playlists/dnp.pls
|
||||
echo
|
||||
|
||||
generate_pls "all" "$pls_all"
|
||||
generate_pls "he" "$pls_he"
|
||||
generate_pls "mhe" "$pls_mhe"
|
||||
generate_pls "me" "$pls_me"
|
||||
generate_pls "lme" "$pls_lme"
|
||||
generate_pls "le" "$pls_le"
|
||||
generate_pls "lofi" "$pls_lofi"
|
||||
generate_pls "le_lofi" "$pls_le_lofi"
|
||||
generate_pls "lofi" "$pls_lofi"
|
||||
generate_pls "unkown" "$pls_unkown"
|
||||
generate_pls "dnp" "$pls_dnp"
|
||||
|
||||
pls_all="{\"id\": 1, \"name\":\"all\", \"songs\":[$(grep '^file[0-9]' 'Playlists/all.pls' | sed -e 's/^.*=..\(.*\)$/"\/storage\/emulated\/0\/Music\1",/' | tr -d '\n\r' | sed -e 's/,$//')]}"
|
||||
pls_le="{\"id\": 2, \"name\":\"le\", \"songs\":[$(grep '^file[0-9]' 'Playlists/le.pls' | sed -e 's/^.*=..\(.*\)$/"\/storage\/emulated\/0\/Music\1",/' | tr -d '\n\r' | sed -e 's/,$//')]}"
|
||||
pls_lme="{\"id\": 3, \"name\":\"lme\", \"songs\":[$(grep '^file[0-9]' 'Playlists/lme.pls' | sed -e 's/^.*=..\(.*\)$/"\/storage\/emulated\/0\/Music\1",/' | tr -d '\n\r' | sed -e 's/,$//')]}"
|
||||
pls_me="{\"id\": 4, \"name\":\"me\", \"songs\":[$(grep '^file[0-9]' 'Playlists/me.pls' | sed -e 's/^.*=..\(.*\)$/"\/storage\/emulated\/0\/Music\1",/' | tr -d '\n\r' | sed -e 's/,$//')]}"
|
||||
pls_mhe="{\"id\": 5, \"name\":\"mhe\", \"songs\":[$(grep '^file[0-9]' 'Playlists/mhe.pls' | sed -e 's/^.*=..\(.*\)$/"\/storage\/emulated\/0\/Music\1",/' | tr -d '\n\r' | sed -e 's/,$//')]}"
|
||||
pls_he="{\"id\": 6, \"name\":\"he\", \"songs\":[$(grep '^file[0-9]' 'Playlists/he.pls' | sed -e 's/^.*=..\(.*\)$/"\/storage\/emulated\/0\/Music\1",/' | tr -d '\n\r' | sed -e 's/,$//')]}"
|
||||
pls_le_lofi="{\"id\": 7, \"name\":\"le_lofi\",\"songs\":[$(grep '^file[0-9]' 'Playlists/le_lofi.pls' | sed -e 's/^.*=..\(.*\)$/"\/storage\/emulated\/0\/Music\1",/' | tr -d '\n\r' | sed -e 's/,$//')]}"
|
||||
pls_lofi="{\"id\": 8, \"name\":\"lofi\", \"songs\":[$(grep '^file[0-9]' 'Playlists/lofi.pls' | sed -e 's/^.*=..\(.*\)$/"\/storage\/emulated\/0\/Music\1",/' | tr -d '\n\r' | sed -e 's/,$//')]}"
|
||||
pls_unkown="{\"id\": 9, \"name\":\"unkown\", \"songs\":[$(grep '^file[0-9]' 'Playlists/unkown.pls' | sed -e 's/^.*=..\(.*\)$/"\/storage\/emulated\/0\/Music\1",/' | tr -d '\n\r' | sed -e 's/,$//')]}"
|
||||
pls_dnp="{\"id\": 10,\"name\":\"dnp\", \"songs\":[$(grep '^file[0-9]' 'Playlists/dnp.pls' | sed -e 's/^.*=..\(.*\)$/"\/storage\/emulated\/0\/Music\1",/' | tr -d '\n\r' | sed -e 's/,$//')]}"
|
||||
pls_all="$(generate_mucke_pls "all" 1 "$pls_all")"
|
||||
pls_he="$(generate_mucke_pls "he" 6 "$pls_he")"
|
||||
pls_mhe="$(generate_mucke_pls "mhe" 5 "$pls_mhe")"
|
||||
pls_me="$(generate_mucke_pls "me" 4 "$pls_me")"
|
||||
pls_lme="$(generate_mucke_pls "lme" 3 "$pls_lme")"
|
||||
pls_le="$(generate_mucke_pls "le" 2 "$pls_le")"
|
||||
pls_le_lofi="$(generate_mucke_pls "le_lofi" 7 "$pls_le_lofi")"
|
||||
pls_lofi="$(generate_mucke_pls "lofi" 8 "$pls_lofi")"
|
||||
pls_unkown="$(generate_mucke_pls "unkown" 9 "$pls_unkown")"
|
||||
pls_dnp="$(generate_mucke_pls "dnp" 10 "$pls_dnp")"
|
||||
|
||||
all_pls="[$pls_all,$pls_le,$pls_lme,$pls_me,$pls_mhe,$pls_he,$pls_le_lofi,$pls_lofi,$pls_unkown,$pls_dnp]"
|
||||
|
||||
echo "{\"epoch\":$(date +%s000),\"playlists\":$all_pls}" \
|
||||
>Playlists/mucke.json.jinja2.data
|
||||
>"$HOME/.local/share/music/mucke.json.jinja2.data"
|
||||
|
||||
# echo $list_album
|
||||
albums="$(echo $list_album | tr ';' '\n' | sed -e 's/^\(.*\):\(.*\):\(.*\)$/\\"\1\\":{\\"title\\":\\"\2\\",\\"artist\\":\\"\3\\"},/' | tr -d '\n' | sed -e 's/,$//')"
|
||||
artists="$(echo $list_artist | tr ';' '\n' | sed -e 's/^\(.*\):\(.*\)$/\\"\1\\":{\\"name\\":\\"\2\\"},/' | tr -d '\n' | sed -e 's/,$//')"
|
||||
list_album="$(echo "$list_album" | jq -c '. | with_entries(.key = (.value.index | tostring)) | map_values(del(.index))' || error_here)"
|
||||
list_artist="$(echo "$list_artist" | jq -c '. | with_entries(.key = (.value.index | tostring)) | map_values(del(.index))' || error_here)"
|
||||
|
||||
echo "{\"epoch\":$(date +%s000),\"songs\":\"$(echo $list_songs | sed -e 's/,$//' -e 's/"/\\"/g')\",\"albums\":\"$albums\",\"artists\":\"$artists\",\"playlists\":$all_pls}" \
|
||||
>Playlists/mucke2.json.jinja2.data
|
||||
|
||||
jinja \
|
||||
--data Playlists/mucke.json.jinja2.data \
|
||||
--format json \
|
||||
--output Playlists/mucke.json \
|
||||
Playlists/mucke.json.jinja2
|
||||
|
||||
jinja \
|
||||
--data Playlists/mucke2.json.jinja2.data \
|
||||
--format json \
|
||||
--output Playlists/mucke2.json \
|
||||
Playlists/mucke2.json.jinja2
|
||||
echo "{\
|
||||
\"APP_VERSION\": \"1.5.1\",\
|
||||
\"BUILD_NUMBER\": \"123\",\
|
||||
\"DB_VERSION\": 18,\
|
||||
\"SETTING_ALLOWED_EXTENSIONS\": \"mp3,flac,wav,ogg,opus\",\
|
||||
\"BLOCKED_FILES\": [],\
|
||||
\"LIBRARY_FOLDERS\": [\
|
||||
\"/storage/emulated/0/Music\"\
|
||||
],\
|
||||
\"SONGS\": $list_songs,\
|
||||
\"ALBUMS\": $list_album,\
|
||||
\"ARTISTS\": $list_artist,\
|
||||
\"SMARTLISTS\": [],\
|
||||
\"PLAYLISTS\": $all_pls\
|
||||
}" >"$MUSIC_DIR/Playlists/mucke.json"
|
||||
|
||||
# cat "$MUSIC_DIR/Playlists/mucke.json" | jq >"$MUSIC_DIR/Playlists/mucke.json" || error_here
|
||||
|
||||
@@ -14,13 +14,12 @@ function get_songs_from_playlists() {
|
||||
do
|
||||
playlist="$(echo "$playlist" | sed -e 's/%20;/ /g')"
|
||||
|
||||
for song_path in $(echo "$playlist" | jq -c '.SONGS[]' | sed -e 's/ /%20;/g')
|
||||
for song_path in $(echo "$playlist" | jq -rc '.SONGS[]' | sed -e 's/ /%20;/g')
|
||||
do
|
||||
local song_path="$(echo "$song_path" | sed -e 's/%20;/ /g' -e 's/^"//' -e 's/"$//' )"
|
||||
local song_path="$(echo "$song_path" | sed -e 's/%20;/ /g' )"
|
||||
if [[ -f "$song_path" ]]
|
||||
then
|
||||
song_paths="$song_paths
|
||||
$song_path"
|
||||
song_paths="$(echo -e "$song_paths\n$song_path")"
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user