diff --git a/README.md b/README.md index 84316a2..d2ed348 100644 --- a/README.md +++ b/README.md @@ -51,22 +51,18 @@ Linux: Docker: * You can use [linuxserver.io](https://github.com/linuxserver/docker-couchpotato) or [razorgirl's](https://github.com/razorgirl/docker-couchpotato) to quickly build your own isolated app container. It's based on the Linux instructions above. For more info about Docker check out the [official website](https://www.docker.com). -FreeBSD : +FreeBSD: -* Update your ports tree `sudo portsnap fetch update` -* Install Python 2.6+ [lang/python](http://www.freshports.org/lang/python) with `cd /usr/ports/lang/python; sudo make install clean` -* Install port [databases/py-sqlite3](http://www.freshports.org/databases/py-sqlite3) with `cd /usr/ports/databases/py-sqlite3; sudo make install clean` -* Add a symlink to 'python2' `sudo ln -s /usr/local/bin/python /usr/local/bin/python2` -* Install port [ftp/libcurl](http://www.freshports.org/ftp/libcurl) with `cd /usr/ports/ftp/fpc-libcurl; sudo make install clean` -* Install port [ftp/curl](http://www.freshports.org/ftp/bcurl), deselect 'Asynchronous DNS resolution via c-ares' when prompted as part of config `cd /usr/ports/ftp/fpc-libcurl; sudo make install clean` -* Install port [textproc/docbook-xml-450](http://www.freshports.org/textproc/docbook-xml-450) with `cd /usr/ports/textproc/docbook-xml-450; sudo make install clean` -* Install port [GIT](http://git-scm.com/) with `cd /usr/ports/devel/git; sudo make install clean` -* Install [LXML](http://lxml.de/installation.html) for better/faster website scraping -* 'cd' to the folder of your choosing. +* Become root with `su` +* Update your repo catalog `pkg update` +* Install required tools `pkg install python py27-sqlite3 fpc-libcurl docbook-xml git-lite` +* For default install location and running as root `cd /usr/local` +* If running as root, expects python here `ln -s /usr/local/bin/python /usr/bin/python` * Run `git clone https://github.com/RuudBurger/CouchPotatoServer.git` -* Then run `sudo python CouchPotatoServer/CouchPotato.py` to start for the first time -* To run on boot copy the init script. `sudo cp CouchPotatoServer/init/freebsd /etc/rc.d/couchpotato` -* Change the paths inside the init script. `sudo vim /etc/rc.d/couchpotato` -* Make init script executable. `sudo chmod +x /etc/rc.d/couchpotato` -* Add init to startup. `sudo echo 'couchpotato_enable="YES"' >> /etc/rc.conf` +* Copy the startup script `cp CouchPotatoServer/init/freebsd /usr/local/etc/rc.d/couchpotato` +* Make startup script executable `chmod 555 /usr/local/etc/rc.d/couchpotato` +* Add startup to boot `echo 'couchpotato_enable="YES"' >> /etc/rc.conf` +* Read the options at the top of `more /usr/local/etc/rc.d/couchpotato` +* If not default install, specify options with startup flags in `ee /etc/rc.conf` +* Finally, `service couchpotato start` * Open your browser and go to: `http://server:5050/` diff --git a/couchpotato/core/notifications/emby.py b/couchpotato/core/notifications/emby.py new file mode 100644 index 0000000..15bd64d --- /dev/null +++ b/couchpotato/core/notifications/emby.py @@ -0,0 +1,89 @@ +import json +import urllib, urllib2 + +from couchpotato.core.helpers.variable import cleanHost +from couchpotato.core.logger import CPLog +from couchpotato.core.notifications.base import Notification + + +log = CPLog(__name__) + +autoload = 'Emby' + + +class Emby(Notification): + + def notify(self, message = '', data = None, listener = None): + host = self.conf('host') + apikey = self.conf('apikey') + + host = cleanHost(host) + url = '%semby/Library/Series/Updated' % (host) + values = {} + data = urllib.urlencode(values) + + try: + req = urllib2.Request(url, data) + req.add_header('X-MediaBrowser-Token', apikey) + + response = urllib2.urlopen(req) + result = response.read() + response.close() + return True + + except (urllib2.URLError, IOError), e: + return False + + def test(self, **kwargs): + host = self.conf('host') + apikey = self.conf('apikey') + message = self.test_message + + host = cleanHost(host) + url = '%semby/Notifications/Admin' % (host) + values = {'Name': 'CouchPotato', 'Description': message, 'ImageUrl': 'https://raw.githubusercontent.com/RuudBurger/CouchPotatoServer/master/couchpotato/static/images/notify.couch.small.png'} + data = json.dumps(values) + + try: + req = urllib2.Request(url, data) + req.add_header('X-MediaBrowser-Token', apikey) + req.add_header('Content-Type', 'application/json') + + response = urllib2.urlopen(req) + result = response.read() + response.close() + return { + 'success': True + } + + except (urllib2.URLError, IOError), e: + return False + + +config = [{ + 'name': 'emby', + 'groups': [ + { + 'tab': 'notifications', + 'list': 'notification_providers', + 'name': 'emby', + 'options': [ + { + 'name': 'enabled', + 'default': 0, + 'type': 'enabler', + }, + { + 'name': 'host', + 'default': 'localhost:8096', + 'description': 'IP:Port, default localhost:8096' + }, + { + 'name': 'apikey', + 'label': 'API Key', + 'default': '', + }, + ], + } + ], +}]