Custom script - mark entries as seen in flexget

Hey

This is a bit of a how to for a custom script which you can use to mark entries as “seen” in flexget.

You can setup a task with the sonarr flexget integration that purports to get this sort of data from sonarr. But in my early experimentation with sonarr it seems I would need to manually mark stuff as monitored. Also it marks the episode begin number in flexget which is always on the current episode, which would cause it to download again in flexget. Rather than trying to begin from the next episode.

So the script below gets the episode number, series number, series name from sonarr and then builds the two commands to mark an episode as seen and to tell flexget to begin from the next episode.

So using this if sonarr grabs an episode from a source which I can’t use in Flexget it will prevent flexget also downloading it when it happens to show up on an rss.

Eg the flexget commands to mark a download as seen and to begin from the next available episode.

Flexget seen add “iZombie” S03E05
Flexget series begin “iZombie” S03E05

I couldnt figure out how to get these to run without outputting to a script and a text file, if anyone can get it to work without any external files then please post the necessary changes.

#!/bin/bash

echo "#!/bin/bash" > /home/osmc/.flexget/sonarrscript3.sh
#sonarr_series_title=iZombie
#sonarr_release_episodenumbers=5
#sonarr_release_seasonnumber=s

i=`expr $sonarr_release_episodenumbers + 1`

a=$(printf "%02d\n" $sonarr_release_seasonnumber)
b="$(echo \"$sonarr_series_title\" S$a)"
c=$(printf "%02d\n" $i)
d=$(printf "%02d\n" $sonarr_release_episodenumbers)

e=$b"E"$c
f=$b"E"$d

#next episode (begin)
echo "flexget series begin "$e >> /home/osmc/.flexget/sonarrscript3.sh

#current episode (seen add)
echo $f" " > /home/osmc/.flexget/sonarrout.txt

OLDIFS=$IFS
IFS="
"

for F in $(cat /home/osmc/.flexget/sonarrout.txt) ; do
  flexget seen add "$F"

done
IFS=$OLDIFS
/home/osmc/.flexget/sonarrscript3.sh

echo "" > /home/osmc/.flexget/sonarrout.txt

exit

I havent tested this too much, only just got sonarr and jackett setup but I’m hoping this should just download stuff in sonarr and sort in flexget and not require to much manual interaction.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.