Analyze working for detecting intros, but no longer video preview thumbnails

To everyone in this thread that has been dealing with this issue for far too long, I wrote a quick little bash script to automate disabling/enabling thumbnails(I know this post is technically tagged server-windows, but this issue is pervasive across server-linux and server-freebsd as far as I can tell from the comments.) This is far less disruptive to me & my users than restarting the server. I plan to run this daily right after my Scheduled Task window is over.

Sadly I might still miss media that is added after the Scheduled Tasks are complete, but before the Task window is actually over, but that’s an extreme edge case.

Just enter the host IP address and run the script as a cronjob, etc… Also has Pushover notification support. :smiley: Hope this helps those out there who can’t STAND “seeking in the dark” when their media doesn’t have thumbnails.

#!/bin/bash

#Required Plex Server/Port variables
X_PLEX_HOST=
X_PLEX_PORT=32400 #Default is 32400

#Optional notification variables
PUSHOVER_APP_TOKEN=''
PUSHOVER_USER_KEY=''

#Disable Thumbnails
curl -X PUT http://$X_PLEX_HOST:$X_PLEX_PORT/:/prefs?GenerateBIFBehavior=never
if [ $? -eq 0 ] ; then
  echo "TOGGLE_THUMBNAILS - INFO: Disabled thumbnails."
else
  echo "TOGGLE_THUMBNAILS - CRITICAL: Error disabling thumbnails."
  if [[ ! -z $PUSHOVER_APP_TOKEN && ! -z $PUSHOVER_USER_KEY ]]  ; then
    MESSAGE="CRITICAL: Error disabling thumbnails."
    curl -s \
          --form-string "token=$PUSHOVER_APP_TOKEN" \
          --form-string "user=$PUSHOVER_USER_KEY" \
          --form-string "message=$MESSAGE" \
          https://api.pushover.net/1/messages.json
  else
    echo "TOGGLE_THUMBNAILS - INFO: Pushover variables not set."
  fi
fi

#Enable thumbnails
curl -X PUT http://$X_PLEX_HOST:$X_PLEX_PORT/:/prefs?GenerateBIFBehavior=asap
if [ $? -eq 0 ] ; then
  echo "TOGGLE_THUMBNAILS - INFO: Enabled thumbnails."
else
  echo "TOGGLE_THUMBNAILS - CRITICAL: Error enabling thumbnails."
  if [[ ! -z $PUSHOVER_APP_TOKEN && ! -z $PUSHOVER_USER_KEY ]] ; then
    MESSAGE="CRITICAL: Error enabling thumbnails."
    curl -s \
          --form-string "token=$PUSHOVER_APP_TOKEN" \
          --form-string "user=$PUSHOVER_USER_KEY" \
          --form-string "message=$MESSAGE" \
          https://api.pushover.net/1/messages.json
  else
    echo "TOGGLE_THUMBNAILS - INFO: Pushover variables not set."
  fi
fi

I had a request for a Windows version - here is a Powershell script that should do the same - you may need to explicitly allow Windows to run Powershell scripts - How to enable execution of PowerShell scripts? - Super User

#Required Plex Server/Port variables
$X_PLEX_HOST=''
$X_PLEX_PORT='32400' #Default is 32400

#Optional notification variables
$PUSHOVER_APP_TOKEN=''
$PUSHOVER_USER_KEY=''

#Disable Thumbnails
$PLEX_URL="http://$X_PLEX_HOST`:$X_PLEX_PORT/:/prefs?GenerateBIFBehavior=never"
$PLEX_DISABLE_RESPONSE = Invoke-WebRequest -Method "PUT" -Uri $PLEX_URL

if ( $PLEX_DISABLE_RESPONSE.StatusCode -eq "200") {
	echo "TOGGLE_THUMBNAILS - INFO: Disabled thumbnails."
} else {
	echo "TOGGLE_THUMBNAILS - CRITICAL: Error disabling thumbnails."
	if (! $PUSHOVER_APP_TOKEN -eq "" -And ! $PUSHOVER_USER_KEY -eq "" ) {
		$MESSAGE="CRITICAL: Error disabling thumbnails."
		$PUSHOVER_URL="https://api.pushover.net/1/messages.json"
		$PARAMS = @{
			token = $PUSHOVER_APP_TOKEN
			user = $PUSHOVER_USER_KEY
			message = $MESSAGE
		}
		$PARAMS | Invoke-RestMethod -Method "POST" -Uri $PUSHOVER_URL 
	} else {
		echo "TOGGLE_THUMBNAILS - INFO: Pushover variables not set."
	}
}

#Enable Thumbnails
$PLEX_URL="http://$X_PLEX_HOST`:$X_PLEX_PORT/:/prefs?GenerateBIFBehavior=asap"
$PLEX_ENABLE_RESPONSE = Invoke-WebRequest -Method "PUT" -Uri $PLEX_URL

if ( $PLEX_ENABLE_RESPONSE.StatusCode -eq "200") {
	echo "TOGGLE_THUMBNAILS - INFO: Enabled thumbnails."
} else {
	echo "TOGGLE_THUMBNAILS - CRITICAL: Error enabling thumbnails."
	if (! $PUSHOVER_APP_TOKEN -eq "" -And ! $PUSHOVER_USER_KEY -eq "" ) {
		$MESSAGE="CRITICAL: Error enabling thumbnails."
		$PUSHOVER_URL="https://api.pushover.net/1/messages.json"
		$PARAMS = @{
			token = $PUSHOVER_APP_TOKEN
			user = $PUSHOVER_USER_KEY
			message = $MESSAGE
		}
		$PARAMS | Invoke-RestMethod -Method "POST" -Uri $PUSHOVER_URL 
	} else {
		echo "TOGGLE_THUMBNAILS - INFO: Pushover variables not set."
	}
}
4 Likes