Commit 3147ff2a authored by echel0n's avatar echel0n

Merge branch 'release/v4.0.0'

Conflicts:
	.travis.yml
	readme.md
parents 1b850b3a d2657612
# SB User Related #
# SR User Related #
######################
cache/*
cache.db*
......@@ -11,11 +11,13 @@ server.crt
server.key
restore/
# SB Test Related #
# SR Test Related #
######################
tests/Logs/*
tests/sickbeard.*
tests/cache.db
tests/cache/*
tests/sickbeard.db*
tests/cache.db*
tests/failed.db
# Compiled source #
######################
......@@ -46,4 +48,4 @@ Thumbs.db
.directory
*~
/.idea/
*.torrent
*.torrent
\ No newline at end of file
......@@ -17,4 +17,4 @@ script:
- ./tests/all_tests.py
notifications:
irc: "irc.freenode.net#sickrage"
irc: "irc.freenode.net#sickrage"
\ No newline at end of file
......@@ -49,7 +49,7 @@
* Add image to be used when Trakt posters are void on Add Show/Add Trending Show page
* Fix growl registration not sending sickrage an update notification registration
* Add an anonymous redirect builder for external links
* Update xbmc link to Kodi at Config Notifications
* Update kodi link to Kodi at Config Notifications
* Fix missing url for kickasstorrents in config_providers
* Fix post processing when using tvrage indexer and mediabrowser metadata generation
* Change reporting failed network_timezones.txt updates from an error to a warning
......
......@@ -33,7 +33,6 @@ if sys.version_info < (2, 6):
try:
import Cheetah
if Cheetah.Version[0] != '2':
raise ValueError
except ValueError:
......@@ -45,7 +44,7 @@ except:
import os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), 'lib')))
sys.path.insert(1, os.path.abspath(os.path.join(os.path.dirname(__file__), 'lib')))
# We only need this for compiling an EXE and I will just always do that on 2.6+
if sys.hexversion >= 0x020600F0:
......@@ -256,36 +255,22 @@ class SickRage(object):
raise SystemExit(
"Config file root dir '" + os.path.dirname(sickbeard.CONFIG_FILE) + "' must be writeable.")
os.chdir(sickbeard.DATA_DIR)
# Check if we need to perform a restore first
restoreDir = os.path.join(sickbeard.DATA_DIR, 'restore')
if os.path.exists(restoreDir):
if self.consoleLogging and os.path.exists(restoreDir):
if self.restore(restoreDir, sickbeard.DATA_DIR):
logger.log(u"Restore successful...")
sys.stdout.write("Restore successful...\n")
else:
logger.log(u"Restore FAILED!", logger.ERROR)
os.chdir(sickbeard.DATA_DIR)
sys.stdout.write("Restore FAILED!\n")
# Load the config and publish it to the sickbeard package
if not os.path.isfile(sickbeard.CONFIG_FILE):
logger.log(u"Unable to find '" + sickbeard.CONFIG_FILE + "' , all settings will be default!", logger.ERROR)
if self.consoleLogging and not os.path.isfile(sickbeard.CONFIG_FILE):
sys.stdout.write("Unable to find '" + sickbeard.CONFIG_FILE + "' , all settings will be default!" + "\n")
sickbeard.CFG = ConfigObj(sickbeard.CONFIG_FILE)
CUR_DB_VERSION = db.DBConnection().checkDBVersion()
if CUR_DB_VERSION > 0:
if CUR_DB_VERSION < MIN_DB_VERSION:
raise SystemExit("Your database version (" + str(
CUR_DB_VERSION) + ") is too old to migrate from with this version of SickRage (" + str(
MIN_DB_VERSION) + ").\n" + \
"Upgrade using a previous version of SB first, or start with no database file to begin fresh.")
if CUR_DB_VERSION > MAX_DB_VERSION:
raise SystemExit("Your database version (" + str(
CUR_DB_VERSION) + ") has been incremented past what this version of SickRage supports (" + str(
MAX_DB_VERSION) + ").\n" + \
"If you have used other forks of SB, your database may be unusable due to their modifications.")
# Initialize the config and our threads
sickbeard.initialize(consoleLogging=self.consoleLogging)
......@@ -343,7 +328,7 @@ class SickRage(object):
logger.ERROR)
if sickbeard.LAUNCH_BROWSER and not self.runAsDaemon:
logger.log(u"Launching browser and exiting", logger.ERROR)
sickbeard.launchBrowser(self.startPort)
sickbeard.launchBrowser('https' if sickbeard.ENABLE_HTTPS else 'http', self.startPort, sickbeard.WEB_ROOT)
os._exit(1)
if self.consoleLogging:
......@@ -368,7 +353,7 @@ class SickRage(object):
# Launch browser
if sickbeard.LAUNCH_BROWSER and not (self.noLaunch or self.runAsDaemon):
sickbeard.launchBrowser(self.startPort)
sickbeard.launchBrowser('https' if sickbeard.ENABLE_HTTPS else 'http', self.startPort, sickbeard.WEB_ROOT)
# main loop
while (True):
......@@ -517,7 +502,6 @@ class SickRage(object):
if '--nolaunch' not in popen_list:
popen_list += ['--nolaunch']
logger.log(u"Restarting SickRage with " + str(popen_list))
logger.close()
subprocess.Popen(popen_list, cwd=os.getcwd())
# system exit
......
......@@ -23,6 +23,12 @@ from __future__ import with_statement
import os.path
import sys
try:
import requests
except ImportError:
print ("You need to install python requests library")
sys.exit(1)
# Try importing Python 2 modules using new names
try:
import ConfigParser as configparser
......@@ -35,20 +41,6 @@ except ImportError:
import urllib.request as urllib2
from urllib.parse import urlencode
# workaround for broken urllib2 in python 2.6.5: wrong credentials lead to an infinite recursion
if sys.version_info >= (2, 6, 5) and sys.version_info < (2, 6, 6):
class HTTPBasicAuthHandler(urllib2.HTTPBasicAuthHandler):
def retry_http_basic_auth(self, host, req, realm):
# don't retry if auth failed
if req.get_header(self.auth_header, None) is not None:
return None
return urllib2.HTTPBasicAuthHandler.retry_http_basic_auth(self, host, req, realm)
else:
HTTPBasicAuthHandler = urllib2.HTTPBasicAuthHandler
def processEpisode(dir_to_process, org_NZB_name=None, status=None):
# Default values
host = "localhost"
......@@ -125,20 +117,17 @@ def processEpisode(dir_to_process, org_NZB_name=None, status=None):
else:
protocol = "http://"
url = protocol + host + ":" + port + web_root + "home/postprocess/processEpisode?" + urlencode(params)
url = protocol + host + ":" + port + web_root + "home/postprocess/processEpisode"
login_url = protocol + host + ":" + port + web_root + "login"
print ("Opening URL: " + url)
try:
password_mgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
password_mgr.add_password(None, url, username, password)
handler = HTTPBasicAuthHandler(password_mgr)
opener = urllib2.build_opener(handler)
urllib2.install_opener(opener)
result = opener.open(url).readlines()
sess = requests.Session()
sess.post(login_url, data={'username': username, 'password': password}, stream=True, verify=False)
result = sess.get(url, params=params, stream=True, verify=False)
for line in result:
for line in result.iter_lines():
if line:
print (line.strip())
......
......@@ -190,18 +190,21 @@ def main():
host = 'localhost'
url = protocol + host + ":" + port + web_root + "/home/postprocess/processEpisode"
login_url = protocol + host + ":" + port + web_root + "/login"
scriptlogger.debug("Opening URL: " + url + ' with params=' + str(params))
print "Opening URL: " + url + ' with params=' + str(params)
try:
response = requests.get(url, auth=(username, password), params=params, verify=False)
sess = requests.Session()
sess.post(login_url, data={'username': username, 'password': password}, stream=True, verify=False)
response = sess.get(url, auth=(username, password), params=params, verify=False, allow_redirects=False)
except Exception, e:
scriptlogger.error(u': Unknown exception raised when opening url: ' + str(e))
time.sleep(3)
sys.exit()
if response.status_code == 401:
if response.status_code == 302:
scriptlogger.error(u'Invalid Sickbeard Username or Password, check your config')
print 'Invalid Sickbeard Username or Password, check your config'
time.sleep(3)
......
from distutils.core import setup
import py2exe, sys, shutil
from setuptools import setup
sys.argv.append('py2exe')
setup(
options = {'py2exe': {'bundle_files': 1}},
# windows = [{'console': "sabToSickbeard.py"}],
zipfile = None,
console = ['sabToSickbeard.py'],
)
shutil.copy('dist/sabToSickbeard.exe', '.')
setup(name='sickrage',
version='3.3.2',
description='Automated Video File Manager',
url='http://github.com/SiCKRAGETV/SickRage',
author='echel0n',
author_email='[email protected]ail.com',
license='MIT',
packages=['funniest'],
install_requires=[
'requests',
],
zip_safe=False,
)
\ No newline at end of file
### Questions about SickRage?
To get your questions answered, please ask in the [SickRage Forum], on IRC \#sickrage pn freenode.net, or webchat.
To get your questions answered, please ask on the [SickRage Forum](http://sickrage.tv/), or [#sickrage](http://webchat.freenode.net/?channels=sickrage) IRC channel on irc.freenode.net
# Contributing to SickRage
......@@ -34,7 +34,7 @@ If you are new to SickRage, it is usually a much better idea to ask for help fir
### Try the latest version of SickRage
Bugs in old versions of SickRage may have already been fixed. In order to avoid reporting known issues, make sure you are always testing against the latest build/source. Also, we put new code in the `dev` branch first before pushing down to the `master` branch (which is what the binary builds are built off of).
Bugs in old versions of SickRage may have already been fixed. In order to avoid reporting known issues, make sure you are always testing against the latest build/source. Also, we put new code in the `develop` branch first before pushing down to the `master` branch (which is what the binary builds are built off of).
## Tips For Submitting Code
......@@ -49,7 +49,7 @@ Bugs in old versions of SickRage may have already been fixed. In order to avoid
Please follow these guidelines before reporting a bug:
1. **Update to the latest version** &mdash; Check if you can reproduce the issue with the latest version from the `dev` branch.
1. **Update to the latest version** &mdash; Check if you can reproduce the issue with the latest version from the `develop` branch.
2. **Use the SickRage Forums search** &mdash; check if the issue has already been reported. If it has been, please comment on the existing issue.
......@@ -58,7 +58,7 @@ Please follow these guidelines before reporting a bug:
### Feature requests
Please follow the bug guidelines above for feature requests, i.e. update to the latest version and search for existing issues before posting a new request. You can submit Feature Requests in the [SickRage Forum] as well.
Please follow the bug guidelines above for feature requests, i.e. update to the latest version and search for existing issues before posting a new request. You can submit Feature Requests in the [SickRage Forum](http://sickrage.tv/) as well.
### Pull requests
......@@ -68,7 +68,7 @@ Please follow these guidelines before sending a pull request:
1. Update your fork to the latest upstream version.
2. Use the `dev` branch to base your code off of. Create a topic-branch for your work. We will not merge your 'dev' branch, or your 'master' branch, only topic branches, coming from dev are merged.
2. Use the `develop` branch to base your code off of. Create a topic-branch for your work. We will not merge your 'dev' branch, or your 'master' branch, only topic branches, coming from dev are merged.
3. Follow the coding conventions of the original repository. Do not change line endings of the existing file, as this will rewrite the file and loses history.
......@@ -106,7 +106,7 @@ Please follow this process; it's the best way to get your work included in the p
- Create a new topic branch to contain your feature, change, or fix:
```bash
git checkout -b <topic-branch-name> dev
git checkout -b <topic-branch-name> develop
```
- Commit your changes in logical chunks. or your pull request is unlikely
......
......@@ -452,7 +452,7 @@ inc_top.tmpl
background-position: -357px 0px;
}
.menu-icon-xbmc {
.menu-icon-kodi {
background-position: -378px 0px;
}
......@@ -486,7 +486,7 @@ inc_top.tmpl
background-position: -294px 0px;
}
.submenu-icon-xbmc {
.submenu-icon-kodi {
background-position: -378px 0px;
}
......
......@@ -1108,7 +1108,7 @@ p {
font-weight: 300;
line-height: 1.4;
}
@media (min-width: 768px) {
@media (min-width: 1010px) {
.lead {
font-size: 21px;
}
......@@ -1257,7 +1257,7 @@ dt {
dd {
margin-left: 0;
}
@media (min-width: 768px) {
@media (min-width: 1010px) {
.dl-horizontal dt {
float: left;
width: 160px;
......@@ -1396,12 +1396,12 @@ pre code {
margin-right: auto;
margin-left: auto;
}
@media (min-width: 768px) {
@media (min-width: 1010px) {
.container {
width: 750px;
}
}
@media (min-width: 992px) {
@media (min-width: 1011px) {
.container {
width: 970px;
}
......@@ -1583,7 +1583,7 @@ pre code {
.col-xs-offset-0 {
margin-left: 0;
}
@media (min-width: 768px) {
@media (min-width: 1010px) {
.col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 {
float: left;
}
......@@ -1741,7 +1741,7 @@ pre code {
margin-left: 0;
}
}
@media (min-width: 992px) {
@media (min-width: 1011px) {
.col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12 {
float: left;
}
......@@ -2636,7 +2636,7 @@ select[multiple].input-lg {
margin-bottom: 10px;
color: #737373;
}
@media (min-width: 768px) {
@media (min-width: 1010px) {
.form-inline .form-group {
display: inline-block;
margin-bottom: 0;
......@@ -2699,7 +2699,7 @@ select[multiple].input-lg {
margin-right: -15px;
margin-left: -15px;
}
@media (min-width: 768px) {
@media (min-width: 1010px) {
.form-horizontal .control-label {
padding-top: 7px;
margin-bottom: 0;
......@@ -2710,12 +2710,12 @@ select[multiple].input-lg {
top: 0;
right: 15px;
}
@media (min-width: 768px) {
@media (min-width: 1010px) {
.form-horizontal .form-group-lg .control-label {
padding-top: 14.3px;
}
}
@media (min-width: 768px) {
@media (min-width: 1010px) {
.form-horizontal .form-group-sm .control-label {
padding-top: 6px;
}
......@@ -3239,7 +3239,7 @@ tbody.collapse.in {
bottom: 100%;
margin-bottom: 1px;
}
@media (min-width: 768px) {
@media (min-width: 1010px) {
.navbar-right .dropdown-menu {
right: 0;
left: auto;
......@@ -3658,7 +3658,7 @@ select[multiple].input-group-sm > .input-group-btn > .btn {
top: auto;
left: auto;
}
@media (min-width: 768px) {
@media (min-width: 1010px) {
.nav-tabs.nav-justified > li {
display: table-cell;
width: 1%;
......@@ -3676,7 +3676,7 @@ select[multiple].input-group-sm > .input-group-btn > .btn {
.nav-tabs.nav-justified > .active > a:focus {
border: 1px solid #ddd;
}
@media (min-width: 768px) {
@media (min-width: 1010px) {
.nav-tabs.nav-justified > li > a {
border-bottom: 1px solid #ddd;
border-radius: 4px 4px 0 0;
......@@ -3723,7 +3723,7 @@ select[multiple].input-group-sm > .input-group-btn > .btn {
top: auto;
left: auto;
}
@media (min-width: 768px) {
@media (min-width: 1010px) {
.nav-justified > li {
display: table-cell;
width: 1%;
......@@ -3744,7 +3744,7 @@ select[multiple].input-group-sm > .input-group-btn > .btn {
.nav-tabs-justified > .active > a:focus {
border: 1px solid #ddd;
}
@media (min-width: 768px) {
@media (min-width: 1010px) {
.nav-tabs-justified > li > a {
border-bottom: 1px solid #ddd;
border-radius: 4px 4px 0 0;
......@@ -3772,12 +3772,12 @@ select[multiple].input-group-sm > .input-group-btn > .btn {
margin-bottom: 20px;
border: 1px solid transparent;
}
@media (min-width: 768px) {
@media (min-width: 1010px) {
.navbar {
border-radius: 4px;
}
}
@media (min-width: 768px) {
@media (min-width: 1010px) {
.navbar-header {
float: left;
}
......@@ -3794,7 +3794,7 @@ select[multiple].input-group-sm > .input-group-btn > .btn {
.navbar-collapse.in {
overflow-y: auto;
}
@media (min-width: 768px) {
@media (min-width: 1010px) {
.navbar-collapse {
width: auto;
border-top: 0;
......@@ -3834,7 +3834,7 @@ select[multiple].input-group-sm > .input-group-btn > .btn {
margin-right: -15px;
margin-left: -15px;
}
@media (min-width: 768px) {
@media (min-width: 1010px) {
.container > .navbar-header,
.container-fluid > .navbar-header,
.container > .navbar-collapse,
......@@ -3847,7 +3847,7 @@ select[multiple].input-group-sm > .input-group-btn > .btn {
z-index: 1000;
border-width: 0 0 1px;
}
@media (min-width: 768px) {
@media (min-width: 1010px) {
.navbar-static-top {
border-radius: 0;
}
......@@ -3859,7 +3859,7 @@ select[multiple].input-group-sm > .input-group-btn > .btn {
left: 0;
z-index: 1030;
}
@media (min-width: 768px) {
@media (min-width: 1010px) {
.navbar-fixed-top,
.navbar-fixed-bottom {
border-radius: 0;
......@@ -3885,7 +3885,7 @@ select[multiple].input-group-sm > .input-group-btn > .btn {
.navbar-brand:focus {
text-decoration: none;
}
@media (min-width: 768px) {
@media (min-width: 1010px) {
.navbar > .container .navbar-brand,
.navbar > .container-fluid .navbar-brand {
margin-left: -15px;
......@@ -3915,7 +3915,7 @@ select[multiple].input-group-sm > .input-group-btn > .btn {
.navbar-toggle .icon-bar + .icon-bar {
margin-top: 4px;
}
@media (min-width: 768px) {
@media (min-width: 1010px) {
.navbar-toggle {
display: none;
}
......@@ -3951,7 +3951,7 @@ select[multiple].input-group-sm > .input-group-btn > .btn {
background-image: none;
}
}
@media (min-width: 768px) {
@media (min-width: 1010px) {
.navbar-nav {
float: left;
margin: 0;
......@@ -3967,7 +3967,7 @@ select[multiple].input-group-sm > .input-group-btn > .btn {
margin-right: -15px;
}
}
@media (min-width: 768px) {
@media (min-width: 1010px) {
.navbar-left {
float: left !important;
}
......@@ -3986,7 +3986,7 @@ select[multiple].input-group-sm > .input-group-btn > .btn {
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 1px 0 rgba(255, 255, 255, .1);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 1px 0 rgba(255, 255, 255, .1);
}
@media (min-width: 768px) {
@media (min-width: 1010px) {
.navbar-form .form-group {
display: inline-block;
margin-bottom: 0;
......@@ -4038,7 +4038,7 @@ select[multiple].input-group-sm > .input-group-btn > .btn {
margin-bottom: 5px;
}
}
@media (min-width: 768px) {
@media (min-width: 1010px) {
.navbar-form {
width: auto;
padding-top: 0;
......@@ -4078,7 +4078,7 @@ select[multiple].input-group-sm > .input-group-btn > .btn {
margin-top: 15px;
margin-bottom: 15px;
}
@media (min-width: 768px) {
@media (min-width: 1010px) {
.navbar-text {
float: left;
margin-right: 15px;
......@@ -4565,7 +4565,7 @@ a.list-group-item.active > .badge,
.jumbotron .container {
max-width: 100%;
}
@media screen and (min-width: 768px) {
@media screen and (min-width: 1010px) {
.jumbotron {
padding-top: 48px;
padding-bottom: 48px;
......@@ -5473,7 +5473,7 @@ button.close {
height: 50px;
overflow: scroll;
}
@media (min-width: 768px) {
@media (min-width: 1010px) {
.modal-dialog {
width: 600px;
margin: 30px auto;
......@@ -5486,7 +5486,7 @@ button.close {
width: 300px;
}
}
@media (min-width: 992px) {