Skip to content

Spotweb als Newznab Provider

Northguy edited this page Jul 17, 2018 · 9 revisions

Spotweb as a newznab provider

It is possible to use Spotweb as a Newznab Provider in scripts like Sickbeard, SickGear and CouchPotato, so that these scripts can search in Spotweb. The found results can automatically be parsed by the scripts, without needing to interact with the user. For this scenario, some preparations are needed, depending on the used web server.

Installatie

Apache

Make sure that mod_rewrite is enabled and AllowOverride is set (more info). Create a file called .htaccess and enter the following:

RewriteEngine on  
RewriteCond %{REQUEST_URI} !api/  
RewriteRule api/?$ index.php?page=newznabapi [QSA]
RewriteRule details/([^/]+) index.php?page=getspot&messageid=$1 [L]

If your spotweb installation is not in your www-root dir, but in a subfolder, you should add a line with the RewriteBase in your .htaccess.. It should look like the following (change the third line for your situation):

    RewriteEngine on  
    RewriteCond %{REQUEST_URI} !api/  
    RewriteBase /spotweb/
    RewriteRule api/?$ index.php?page=newznabapi [QSA]
    RewriteRule details/([^/]+) index.php?page=getspot&messageid=$1 [L]

If you made the installation with apt-get, the last line needs to look like this:

RewriteRule api/?$ /spotweb/index.php?page=newznabapi [QSA]  
RewriteRule details/([^/]+) /spotweb/index.php?page=getspot&messageid=$1 [L]  

If you already have a .htaccess file for other reasons, you can generally add the code at the top.

Then make the Apache server to load the RewriteEngine every server start: sudo a2enmod rewrite && sudo /etc/init.d/apache2 restart

Then check your data in your site that is enabled:

<Directory /var/www/spotweb/>
	Options FollowSymLinks
	AllowOverride All
	Order deny,allow
	Allow from all
	Satisfy all
</Directory>

Microsoft IIS

Install the URL Rewrite function in Microsoft IIS (for example by using the web platform installer) and double-click the introduction page of your spotweb site on 'URL Rewrite'. You can now convert the above apache rules to IIS rules by clicking on "import rules" on the right side of the screen. In the 'Rewrite rules' box, you paste the following:

    RewriteCond %{REQUEST_URI} !api/
    RewriteRule api/?$ index.php?page=newznabapi [QSA,L]

These apache rules will now automatically be rewritten to Microsoft IIS rules. Now click on top right of apply and the rule has been added. The URL rewrite function is now active.

NGINX Synology dsm 6.x

Create a file : www.spotweb.conf aanmaken in /etc/nginx/conf.d Content of that file :

 rewrite /spotweb/api/?$ /spotweb/index.php?page=newznabapi break;

(this assumes you have a standard installation of spotweb in the web/spotweb folder)

Reload Nginx with sudo nginx -s reload before testing the XML script!

NGINX (old)

Voor nginx hoef je geen modules aan te zetten. Zet in bijvoorbeeld /etc/nginx/sites-enabled/default het volgende:

location /spotweb {
   if ($uri !~ "api/"){
      rewrite api/?$ /spotweb/index.php?page=newznabapi last;
   }
}

Lighttpd

in /etc/lighttpd/lighttpd.conf zorgen dat de module mod_url.rewrite aanstaat:

server.modules  = ( 
        "mod_access",
        "mod_alias",
        "mod_accesslog",
        "mod_compress",
        "mod_redirect",
        "mod_rewrite"
)

En vervolgens de volgende regel toevoegen:

url.rewrite-once = ( "^/spotweb/api\?(.*)" => "/spotweb/index.php?page=newznabapi&$1" )

###Hiawatha### pas de Hiawatha config file /etc/hiawatha/hiawatha.config aan door het toevoegen van:

    UrlToolkit {
            ToolkitID = spotweb
            Match ^/spotweb/api\?(.*) Rewrite /index.php?page=newznabapi&$1
    }

en voeg de regel

    UseToolkit = spotweb

toe aan de configuratie van de default website of de juiste VirtualHost.

##Testen## Om te testen of bovenstaande stappen zijn gelukt, kun je browsen naar http://server/spotweb/api?t=c. Indien je dan een XML-pagina te zien krijgt is de installatie gelukt. De gegevens in deze XML heb je verder niet nodig.

Gebruiken

SickBeard / SickGear

Op de pagina http://url.naar.sickbeard/config/providers/ staat onderaan het onderdeel Configure Custom Newznab Providers. Hier dien je een naam, een URL en een API-key op te geven.

  1. Bij Provider Name kun je zelf bepalen hoe je het wilt noemen, bijvoorbeeld Spotweb.
  2. Bij Site URL vul je http://server/spotweb/ in (uiteraard na aanpassing aan de eigen omgeving).
  3. Bij API Key vul je de API-key van Spotweb in. Deze is in Spotweb te vinden onder Gebruiker wijzigen

CouchPotato

Op de pagina http://url.naar.couchpotato/config/ en klik op Providers. Op die pagina staat het onderdeel Newznab. Hier dien je een host en een API-key op te geven.

  1. Bij Host vul je server/spotweb in (uiteraard na aanpassing aan de eigen omgeving).
  2. Bij Apikey vul je de API-key van Spotweb in. Deze is in Spotweb te vinden onder Gebruiker wijzigen

Headphones

Op de pagina http://url.naar.headphones/config staat Newznab onder Providers.

  1. Vink Newznab aan.
  2. Bij Newznabhost vul je server/spotweb in.
  3. Bij API Key vul je de API-key van Spotweb in. Deze is in Spotweb te vinden onder Gebruiker wijzigen