= Installation =
[[ https://github.com/SickGear/SickGear/wiki/Installation-Instructions | Official installation instructions are available ]]; here are some more specific ones slimmed down and slightly embellished. These largely follow the [[ https://github.com/SickGear/SickGear/wiki/Install-SickGear-%5B3%5D-Ubuntu#install | manual Ubuntu installation ]] approach.
== Basic Installation ==
# To get the dependencies: `sudo apt update && sudo apt install python-cheetah python-regex unrar-free git`
# Now clone the git repo: `sudo git clone https://github.com/SickGear/SickGear.git /opt/sickgear`
# Give yourself ownership: `sudo chown -R yourusername /opt/sickgear`
# Start your initial run with: `/opt/sickgear/sickgear.py`
## First up, we're gonna be running this as a service, so we //don't// want it to launch the browser when it starts. {nav icon=cogs, name=Settings > icon=cog, name=General > Misc} and uncheck the {nav open the SickGear home page on startup} option at the top. You can always get back to it with your browser at https://localhost:8081 (or whatever you choose as the port, I just used the default).
## A bit further down, you'll probably want to set a root directory for shows.
## {nav Save Changes}
## Under {nav icon=cogs, name=Settings > icon=cog, name=General > Interface > Web Interface}, set a username and password (this application is acting as your user, keep it safe!). Hit the {nav Save Changes} button at the bottom of this section, too, and you should be dumped out to a login screen where you can now log in with your freshly set credentials.
## By default SickGear renames files.
*** This can be disabled under {nav icon=cogs, name=Settings > icon=folder, name=Post Processing > File Handling}.
*** If you leave this enabled, make sure to check out the pattern set in {nav icon=cogs, name=Settings > icon=folder, name=Post Processing > Episode Naming} and change it if you have a different preference (click the {icon list-alt} button to show the naming legend).
**** I use `%S.N.S%0S.%Q.N/%RN`, which ends up along the lines of "Series.Name.S01.1080p.BuRay/Series.Name.S01E01.1080p.Blu-Ray.x264-KEITHZG.mkv" or such.
== Existing Media ==
The easy way is just to use {nav Settings > Import}. If you're fine with how the files are laid out on your disk already, just use that.
If not, ex. if you want to rename or restructure an existing download,
# If the folder already exists in the intended destination folder, rename the existing folder (ex. add an underscore).
** For example if you've got a bunch of haphazard files for the show in a folder called `Abstenia` which you want to use SickGear to tidy up, you need to rename that folder to something like `_Absentia` so that SickGear isn't trying to create a new folder where the existing one is.
# {nav Manage > icon=folder, name=Process Media}, and give it the folder to process and tell it to use Move (or Copy if you're feeling timid and want to make sure it works before removing the originals).
Even if you don't actually use SickGear for downloads, this can be a nice easy way to tidy up all your files.
== Okay it's working, how do I get it to run on startup? ==
In your SickGear installation, there's a folder called {nav icon=folder, name=init-scripts}. You almost certainly want to use `init.systemd` (there are distro-specific init scripts here, but they mostly correspond to older [[https://en.wikipedia.org/wiki/Init | init systems]], and your distro probably uses systemd).
Make a copy of the file. Presuming you're on *buntu 18.04 and your username is `keithzg`, the relevant sections should end up with
```
[Unit]
Description=SickGear Service
[Service]
User=keithzg
Group=keithzg
Environment=PYTHONUNBUFFERED=true
ExecStart=/usr/bin/python2 /opt/sickgear/sickgear.py --systemd --datadir=/opt/sickgear/
KillMode=process
Restart=on-failure
[Install]
WantedBy=multi-user.target
```
You may wish to use another user for convenience or security reasons. Also, if you're on a newer release than Ubuntu 18.04 which has a new enough version of Python 3, you should instead use `/usr/bin/python3` rather than `python2`.
Now, copy this file into the right place, and tell your init system to use it. If using systemd, name the service file accordingly with an `@` and it can then be automatically enabled with the right port. Ex.
```
lang=bash
# First, make sure you aren't running SickGear manually still.
# Then, copy the service file into /etc/systemd/system/, naming it generically
sudo cp init.systemd.cusom /etc/systemd/system/sickgear@.service
# Now, enable it on port 8081
sudo systemctl enable sickgear@8081.service
# It should now autostart on boot, but start it manually this time
sudo systemctl start sickgear@8081.service
```
When you browse to http://localhost:8081 you should now see your SickGear installation running again. And if you reboot your system you should see it running again automatically.
----
= Integrations =
= Integration with Kodi =
In Kodi,
# In {nav name=Settings, icon=cog > name=File Manager, icon=folder}, add a source pointed to your SickGear web interface with `/kodi/` appended to it. For example, `http://localhost:8081/kodi/`. Name it something like "SickGear".
# In {nav name=Settings, icon=cog > System > Add-ons}, enable unknown sources.
# {nav name=Settings, icon=cog > Add-ons}, choose {nav Install from zip file} and choose the source you added, then go into the {nav repository.sickgear} folder, and click {nav OK}. This will add your SickGear instance as a Kodi addon repo.
# In {nav name=Settings, icon=cog > Add-ons}, you should now be able to choose the SickGear repo, and you can add the {nav SickGear Watched State Updater}. Configure it for your instance if you aren't running both Kodi and SickGear on the same machine with default settings.
NOTE: By default, Kodi uses port 9090 for its JSON RPC API. This is the same port SABnzbd+ uses for its web control. You may then need to either change SABnzbd+, or Kodi; the latter [[ https://kodi.wiki/view/Advancedsettings.xml#.3Cjsonrpc.3E | can be set in Kodi's AdvancedSettings.xml config file ]].
== Integration with Transmission ==
Transmission's UI is terrible, so if you're like me you'll just install and configure the daemon. (Skip this of course if you already have Transmission installed and configured.)
## `sudo apt install transmission-daemon`
## `sudo service transmission-daemon stop`
## `sudo nano /etc/transmission-daemon/settings.json` and set at least:
### `"rpc-password"` to your plaintext password (it will be hashed upon the daemon restart)
### `"download-dir"` to a directory as the first location of three they'll go through (it can be anywhere, but must be writeable by Transmission)
### `"script-torrent-done-enabled"` set to `true`
### `"script-torrent-done-filename"` set to `"/opt/sickgear/autoProcessTV/onTxComplete.sh"`
## Permissions might be a bit weird.
### To set the download permissions so that group members can read and write the files too, set `"umask"` to 002 in the Transmission config file
### Then add yourself to the group with `sudo adduser yourusername debian-transmission`
## You can start Transmission again now with `sudo service transmission-daemon start`
NOTE: The official docs seem to lean more towards `/var/lib/transmission-daemon/info/settings.json`, but the `/etc/transmission-daemon` path should work too.
WARNING: Make sure you've stopped the daemon; otherwise, it in fact might overwrite the file upon next stop or restart, obliterating your changes rather than reading them in.
Now for the actual integration.
# Make a config file:
## From the CLI, `cd /opt/sickgear/autoProcessTV/ && cp onTxComplete.sample.cfg onTxComplete.cfg` and then `nano onTxComplete.cfg`, or open the sample file up from your text editor of choice and save it as `onTxComplete.cfg`
## Comment out the Windows param1 line by adding a `;` at the start
## Set param1 to some path //other// than the `"download-dir"` for Transmission (ex. `/home/yourusername/Downloads/sickgear`)
## Set param2 to something unique, like `sickgear2`
# {nav SickGear > icon=cogs, name=Settings > icon=folder, name=Post Processing} and set
## the {nav Completed TV downloads} folder to some path whose folder is the `param1` value specified in the script config above (ex. `/home/yourusername/Downloads/sickgear`).
## checkmark {nav Scan and post process}
## make sure {nav Postpone post processing} is checked
# {nav SickGear > icon=cogs, name=Settings > icon=search, name=Search > Torrent Results} and
## checkmark {nav enable torrent media providers},
## Set {nav Send .torrent files to: } to (surprise surprise) {nav Transmission}
## Set your host:port, username, and password
## Set {nav Downloaded files location} to a path that ends with a folder named the same as `param2` above (ex. `/home/yourusername/Downloads/sickgear2`)
## {nav Test Connection}, and {nav Save Changes}.
# {nav SickGear > icon=cogs, name=Options > icon=book, name=Media Providers > Priorities}, enable your preferred trackers/indexes and order them, {nav Save Changes}, and then go over to the {nav Options } tab to configure them (for each provider you will need to enable options under {nav Options > Perform search tasks} if you want them to actually be used at all).
NOTE: This only copies finished torrents into your library; it does not move them. The original files stay open and seeding wherever you downloaded them to, defined by the `param2` value above.
== Integration with SABnzbd ==
=== SABnzbd to SickGear ===
# `cd /opt/sickgear/autoProcessTV/ && cp autoProcessTV.cfg.sample autoProcessTV.cfg`
# `nano autoProcessTV.cfg` (or your text editor of choice) and change at least the username and password to match your SickBeard setup as above.
# In the SABnzbd web interface, go to {nav Config > Folders} and set {nav Scripts Folder} to `/opt/sickgear/autoProcessTV/`, and {nav Save Changes}.
# Still in SABnzbd, {nav Config > Categories} and add a TV category with the Script set to `sabToSickBeard.py`.
# Leave that window open (don't save changes yet) and now back in SickGear, {nav icon=cogs, name=Settings > icon=folder, name=Post Processing},
## Change {nav Post-Processing > Process episode method} to {nav Move}
## Toggle on {nav Failed Downloads > failed download handling}
## Checkmark {nav delete left over files from a failed download} which should now have appeared.
## Over in SABnzbd, we need to set some stuff so that this orchestration is handled right
### {nav Config > Switches} and at the top checkmark {nav Advanced Settings}.
### {nav Config > Switches > Queue} and disable {nav Abort jobs that cannot be completed}, and {nav Save Changes}.
### {nav Config > Switches > Post processing} and disable {nav Post-Process Only Verified Jobs}, and {nav Save Changes}.
### {nav Config > Special > Switches} and enable {nav empty_postproc}, then {nav Save Changes}
# Now finally save changes in SickGear's {nav Post Processing > Failed Downloads} config section.
=== SickGear to SABnzbd ===
# Get your API key from {nav SABnzbd > Config > General > Security }
# {nav SickGear > icon=cogs, name=Settings > icon=search, name=NZB Results} and
## Enable {nav Search NZBs}, then
## Set {Send .nzb files to} to {nav SABnzbd}
## Set your server URL
## Paste in your API key
## The category should be "tv" by default, but change this if you used something else above
## {nav Test SABnzbd} and {nav Save Changes} if all is well.
# {nav SickGear > icon=cogs, name=Options > icon=book, name=Media Providers > Priorities}, enable your NZB service and {nav Save Settings}.
# {nav SickGear > icon=cogs, name=Options > icon=book, name=Media Providers > Options}, set your credentials for your NZB provider, and {nav Save Settings}.