# cm3us cm3us: m3u file -> cmus playlist Convert playlists from android m3u with hardcoded paths to cmus playlists with different hardcoded paths. So no editing from cmus which I would seldom do anyway 1. On cmus start call cm3us 2. For every playlist in ~/Documents/Playlists/, replace '/storage/emulated/0/Music/' (android library dir) with '/home/molnar/Music/MusicLibrary/' (linux library dir) 3. Save output to ~/.config/cmus/playlists ```bash #!/bin/bash # convert android m3u playlist to cmus playlist # cmus playlists location CMUSDIR="/home/molnar/.config/cmus/playlists/" # m3u playlists location M3UDIR="/home/molnar/Documents/Playlists/" # cmus music library CMUSPATH="/home/molnar/Music/MusicLibrary" # m3u music library on android M3UPATH="/storage/emulated/0/Music" # m3u to cmus playlist for pl in $M3UDIR*; do # sed 's/\/storage\/emulated\/0\/Music/\/home\/molnar\/Music\/MusicLibrary/g' "$pl" > "$cmuspl"; tmp=$(mktemp) plname="${pl##*/}" cmuspl="${CMUSDIR}${plname%.*}" while IFS= read -r s; do s=${s//"$M3UPATH"/"$CMUSPATH"} printf '%s\n' "$s" >> "$tmp" done < "$pl" mv "$tmp" "$cmuspl" done ```