dotfiles

regexghost dotfiles and scripts
git clone https://git.regexghost.com/dotfiles.git
Log | Files | Refs | README

am-extract.sh (836B)


      1 #!/bin/sh
      2 
      3 read -p "Enter artist name: " artist
      4 
      5 results="$(curl -s "https://itunes.apple.com/search?term=${artist}&entity=musicArtist" | jq -r '.results[] | "\(.artistName) - \(.artistId)"' | nl)"
      6 
      7 echo "$results"
      8 
      9 read -p "Which one?: " selection
     10 
     11 selectedArtistID="$(echo "$results" | sed -n "${selection}p" | sed 's/.* - //g')"
     12 
     13 albums="$(curl -s "https://itunes.apple.com/lookup?id=${selectedArtistID}&entity=album" | jq -r '.results[] | "\(.collectionName) - \(.collectionId)"' | nl)"
     14 
     15 echo "$albums"
     16 
     17 read -p "Which album?: " selection
     18 
     19 selectedAlbumID="$(echo "$albums" | sed -n "${selection}p" | sed 's/.* - //g')"
     20 
     21 echo "$selectedAlbumID"
     22 
     23 albumInfo="$(curl -s "https://itunes.apple.com/lookup?id=${selectedAlbumID}&entity=song" | jq -r '.results[] | "\(.trackName) - \(.artistName) - \(.collectionName)"')"
     24 echo "$albumInfo"