ytdl 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. #!/bin/sh
  2. if [ "$1" = "help" ]; then
  3. echo "*** Description ***"
  4. echo "Download a song or album from youtube, stores them in the \`~/Music\` directory"
  5. echo ""
  6. echo "*** Usage ***"
  7. echo "ytdl <song|album> <url> [album name]"
  8. echo ""
  9. echo "*** Parameters ***"
  10. echo "album name: Name of the folder to create when downloading songs, only available if the \`album\` option is enabled"
  11. echo ""
  12. echo "*** Options ***"
  13. echo "song: Download url as song"
  14. echo "album: Download url as album"
  15. echo "url: Url to Youtube video to download"
  16. echo ""
  17. exit 0
  18. fi
  19. echo "TODO: Finish then by finding out how to control where params are passed(ex: all params after 2)"
  20. exit 1
  21. if [ "$1" = "song" ]; then
  22. youtube-dl --extract-audio --embbed-thumbnail --no-playlist --audio-quality 0 --audio-format mp3 -o "$HOME/Music/%(title)s.%(ext)s"
  23. elif [ "$1" = "album" ]; then
  24. mkdir ~/Music/"$2"
  25. youtube-dl --extract-audio --embbed-thumbnail --yes-playlist --audio-quality 0 --audio-format mp3 -o "$HOME/Music/$2/%(title)s.%(ext)s" "$*"
  26. fi