Skip to content

Instantly share code, notes, and snippets.

@chrisanthropic
Created January 25, 2017 23:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisanthropic/60ca50a799a20966d9a315e3f4bf303c to your computer and use it in GitHub Desktop.
Save chrisanthropic/60ca50a799a20966d9a315e3f4bf303c to your computer and use it in GitHub Desktop.
Bash code to create Plex Token
token=$(curl -H "Content-Length: 0" -H "X-Plex-Client-Identifier: PlexInTheCloud" -u "${plexUsername}":"${plexPassword}" -X POST https://my.plexapp.com/users/sign_in.xml | cut -d "\"" -s -f22 | tr -d '\n')
# Grab the Plex Section ID of our new TV show library
tvID=$(curl -H "X-Plex-Token: ${token}" http://127.0.0.1:32400/library/sections | grep "show" | grep "title=" | awk -F = '{print $6" "$7" "$8}' | sed 's/ art//g' | sed 's/title//g' | sed 's/type//g' | awk -F \" '{print "Section=\""$6"\" ID="$2}' | cut -d '"' -f2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment