cmus-create-playlist.sh 437 B

123456789101112131415
  1. #!/usr/bin/env bash
  2. set -euo pipefail # bash strict mode
  3. # adds current playing song in cmus to newly created playlist
  4. [[ ! $(pidof cmus) ]] && echo 'cmus not running...'
  5. [[ $# -ne 1 ]] && echo 'only one argument is possible!!!'
  6. path="/mnt/seagate/multimedia/music"
  7. song=$(cmus-remote -Q | grep "^file" | cut -d' ' -f2-)
  8. playlists="${path}/playlists/${1}"
  9. mkdir -p "$playlists"
  10. cp -vu "$song" "${playlists}/" || echo 'already there'