It is currently Sat Nov 25, 2017 10:09 am
All times are UTC + 8 hours

Plex Requests (Now called Ombi) on your NAS

Share your awesome tips and tricks here.

Plex Requests (Now called Ombi) on your NAS

Postby MikeG.6.5 » Sun Jul 02, 2017 12:15 am

For those of you running Plex Media Server, you may have heard about PlexRequests or Ombi. This is an application that ties together Couchpotato, Sonarr and a page your users can use to request movies or TV shows. It allows you to set up an approval process, and gives you a way to send your users notifications of what new things you have in your library.

I struggled a long little while to get this running, and finally figured out how to make it work.

Required to make it all work:

Plex Media Server (This is really a no-brainer, since you wouldn't run this app without PMS...)
Mono (Install from App Central)
WinSCP (https://winscp.net/eng/index.php while you are there get a copy of PuTTY)
PlexRequests (download from here: https://github.com/tidusjar/Ombi)

Don't ask me to set it up as an App Central application, I don't know how to do that. This is the ONLY way I have been able to get this running. The biggest difficult I had when trying to get this working, is Ombi would crash, and then my checking scripts would start a new copy. BUT the old app was still "working" and after a week or so I would have 10-20 processes "running" and the machine would bog down. I needed a way to kill the old process when the curl reported the app was down. That's where the for-do loop comes in on the script below...

Install Mono, if it's not already. (If you are running Sonarr you probably already have it installed.) Open up a WinSCP session to your NAS and navigate to the downloaded zip file from Ombi link above. Unzip this to a folder on your NAS that you use for other misc. things. (PlexPy, the conversion scripts I have already shown people how to use, etc.) I made a PlexRequests folder in my /misc folder and unzipped it there.

Then make a script called CkOmbi.sh in the main misc folder. This file should contain the following code:

Code: Select all
#!/bin/sh
#######################################################################################
#  This script tests to make sure the Ombi application is running on your Asustor NAS.#
#  If it is the script exits and does nothing.  If not it will restart Ombi as a      #
#  daemon so the app is always running.  This app is usefull because you can point    #
#  your users to this so they can request TV shows and movies to view on your Plex    #
#  server.  Ombi is tied to CouchPotato and Sonarr so searching and  downloading can  #
#  be done automatically after the show is approved.  (By you.)                       #
#  ---------------------------------------------------------------------------------  #
#  You can change this to test for remote access by changing the localhost to the     #
#  DNS name of your NAS.  Ex: If you use Asustor's DDNS service it would be something #
#  like http://yourddnsname.myasustor.com:  Remember you HAVE to put the port you     #
#  configure Ombi to run on in these scripts!                                         #
#  ---------------------------------------------------------------------------------  #
#  This can be used to test operation of any app that has a web page for accessing    #
#  the app itself.  If the app is a stand alone app and doesn't use a web page        #
#  this check will not work.  There are other ways to check their operations.         #
#  ---------------------------------------------------------------------------------  #
#  Visit http://forum.asustor.com/index.php and ask MikeG.6.5 for any support issues  #
#######################################################################################
curl -I -m 8 "localhost:port#/userlogin";
if [ "$?" -ne "0" ]

then
   for signal in "-15" "-1" "-9"
      do
        pids=`ps -ef | grep Ombi `
        kill $signal $pids
   done

   /usr/sbin/syslog --log 0 --level 0 --user admin --event "PlexRequests isn't running: Starting it"
   mono /volume1/misc/PlexRequests/Ombi.exe &
fi

exit 0


Put CkOmbi.sh in your cron file to be looked at every 10-15 minutes, or as desired and then the app should start at the next timing cycle. Navigate to your port (Make sure you edit the script above to use the port you set in Ombi's configurations, so it tests the right port.)

To make the application start on boot up, use WinSCP to make a symlink file called S91Ombi in this folder: /volume1/.@plugins/etc/init.d (You can change the number to anything in that file name, but the higher the number, the lower the priority, so 50 starts quicker than 75, than 91...) You want to make sure that the number is higher than Plex's number, as Ombi needs access to Plex's DB, which it can't see if Plex isn't running.

Now, let's look at the script a bit to see what it does... The curl statement looks for a valid http response from the address:port Ombi is running on. If there is a valid response the rest of the script doesn't run. (This is done with the If statement following the curl.) If there isn't a valid http response then the rest of the script runs, killing the old process and starting a new one.

The thing that makes this work is the For-do loop that looks for any instances of Ombi already running, kills the process and then exits out of the loop. Then we start a new process of Ombi and all of the options are set via Ombi's configuration.

The only thing I haven't been able to get working with these scripts is auto-updating Ombi. I have to shut it down completely, then manually unzip an update into the folder (move the PlexRequests.sqlite to a safe place first, then move it back after the update is done. This is your llist of active movies and TV shows, as well as the requests people have made.)

There it is, in a nutshell. (OK, it's a big nutshell, but it's not hard...)

GL and have fun requesting TV shows and movies automatically! :)
MikeG.6.5
 
Posts: 866
Joined: Fri May 15, 2015 1:56 am

Re: Plex Requests (Now called Ombi) on your NAS

Postby MonsMagnus » Mon Jul 03, 2017 9:19 pm

Nice write-up Mike!
MonsMagnus
 
Posts: 48
Joined: Sat Mar 11, 2017 2:17 am

Return to Tips & Tricks

  • You cannot post new topics in this forum
    You cannot reply to topics in this forum
    You cannot edit your posts in this forum
    You cannot delete your posts in this forum
    You cannot post attachments in this forum
  • Who is online

    Users browsing this forum: No registered users and 1 guest