Merge branch 'refs/heads/develop' into desktop

This commit is contained in:
Ruud
2013-01-23 22:55:09 +01:00
32 changed files with 59 additions and 34 deletions
+1 -2
View File
@@ -62,7 +62,6 @@ class Loader(object):
self.log.logger.addHandler(hdlr) self.log.logger.addHandler(hdlr)
def addSignals(self): def addSignals(self):
signal.signal(signal.SIGINT, self.onExit) signal.signal(signal.SIGINT, self.onExit)
signal.signal(signal.SIGTERM, lambda signum, stack_frame: sys.exit(1)) signal.signal(signal.SIGTERM, lambda signum, stack_frame: sys.exit(1))
@@ -74,7 +73,7 @@ class Loader(object):
def onExit(self, signal, frame): def onExit(self, signal, frame):
from couchpotato.core.event import fireEvent from couchpotato.core.event import fireEvent
fireEvent('app.crappy_shutdown', single = True) fireEvent('app.shutdown', single = True)
def run(self): def run(self):
+4 -3
View File
@@ -5,9 +5,10 @@
* Search through the existing (and closed) issues first. See if you can get your answer there. * Search through the existing (and closed) issues first. See if you can get your answer there.
* Double check the result manually, because it could be an external issue. * Double check the result manually, because it could be an external issue.
* Post logs! Without seeing what is going on, I can't reproduce the error. * Post logs! Without seeing what is going on, I can't reproduce the error.
* What are you settings for the specific problem * What is the movie + quality you are searching for.
* What providers are you using. (While your logs include these, scanning through hundred of lines of log isn't my hobby) * What are you settings for the specific problem.
* Give me a short step by step of how to reproduce * What providers are you using. (While your logs include these, scanning through hundred of lines of log isn't my hobby).
* Give me a short step by step of how to reproduce.
* What hardware / OS are you using and what are the limits? NAS can be slow and maybe have a different python installed then when you use CP on OSX or Windows for example. * What hardware / OS are you using and what are the limits? NAS can be slow and maybe have a different python installed then when you use CP on OSX or Windows for example.
* I will mark issues with the "can't reproduce" tag. Don't go asking me "why closed" if it clearly says the issue in the tag ;) * I will mark issues with the "can't reproduce" tag. Don't go asking me "why closed" if it clearly says the issue in the tag ;)
+3 -1
View File
@@ -10,6 +10,7 @@ from uuid import uuid4
import os import os
import platform import platform
import signal import signal
import sys
import time import time
import traceback import traceback
import webbrowser import webbrowser
@@ -178,6 +179,7 @@ class Core(Plugin):
def signalHandler(self): def signalHandler(self):
def signal_handler(signal, frame): def signal_handler(signal, frame):
fireEvent('app.do_shutdown') fireEvent('app.shutdown')
signal.signal(signal.SIGINT, signal_handler) signal.signal(signal.SIGINT, signal_handler)
signal.signal(signal.SIGTERM, signal_handler)
-1
View File
@@ -2,7 +2,6 @@ from apscheduler.scheduler import Scheduler as Sched
from couchpotato.core.event import addEvent from couchpotato.core.event import addEvent
from couchpotato.core.logger import CPLog from couchpotato.core.logger import CPLog
from couchpotato.core.plugins.base import Plugin from couchpotato.core.plugins.base import Plugin
import logging
log = CPLog(__name__) log = CPLog(__name__)
@@ -38,10 +38,11 @@ class Transmission(Downloader):
'download-dir': folder_path 'download-dir': folder_path
} }
torrent_params = { if self.conf('ratio'):
'seedRatioLimit': self.conf('ratio'), torrent_params = {
'seedRatioMode': (0 if self.conf('ratio') else 1) 'seedRatioLimit': self.conf('ratio'),
} 'seedRatioMode': self.conf('ratio')
}
if not filedata and data.get('type') == 'torrent': if not filedata and data.get('type') == 'torrent':
log.error('Failed sending torrent, no data') log.error('Failed sending torrent, no data')
+10 -5
View File
@@ -15,9 +15,9 @@ class Email(Notification):
# Extract all the settings from settings # Extract all the settings from settings
from_address = self.conf('from') from_address = self.conf('from')
to = self.conf('to') to_address = self.conf('to')
smtp_server = self.conf('smtp_server')
ssl = self.conf('ssl') ssl = self.conf('ssl')
smtp_server = self.conf('smtp_server')
smtp_user = self.conf('smtp_user') smtp_user = self.conf('smtp_user')
smtp_pass = self.conf('smtp_pass') smtp_pass = self.conf('smtp_pass')
@@ -25,22 +25,27 @@ class Email(Notification):
message = MIMEText(toUnicode(message)) message = MIMEText(toUnicode(message))
message['Subject'] = self.default_title message['Subject'] = self.default_title
message['From'] = from_address message['From'] = from_address
message['To'] = to message['To'] = to_address
try: try:
# Open the SMTP connection, via SSL if requested # Open the SMTP connection, via SSL if requested
log.debug("SMTP over SSL %s", ("enabled" if ssl == 1 else "disabled"))
mailserver = smtplib.SMTP_SSL(smtp_server) if ssl == 1 else smtplib.SMTP(smtp_server) mailserver = smtplib.SMTP_SSL(smtp_server) if ssl == 1 else smtplib.SMTP(smtp_server)
# Check too see if an login attempt should be attempted # Check too see if an login attempt should be attempted
if len(smtp_user) > 0: if len(smtp_user) > 0:
log.debug("Logging on to SMTP server using username \'%s\'%s", (smtp_user, " and a password" if len(smtp_pass) > 0 else ""))
mailserver.login(smtp_user, smtp_pass) mailserver.login(smtp_user, smtp_pass)
# Send the e-mail # Send the e-mail
mailserver.sendmail(from_address, to, message.as_string()) log.debug("Sending the email")
mailserver.sendmail(from_address, to_address, message.as_string())
# Close the SMTP connection # Close the SMTP connection
mailserver.quit() mailserver.quit()
log.info('Email notifications sent.')
log.info('Email notification sent')
return True return True
except: except:
log.error('E-mail failed: %s', traceback.format_exc()) log.error('E-mail failed: %s', traceback.format_exc())
@@ -10,7 +10,7 @@ config = [{
'tab': 'notifications', 'tab': 'notifications',
'list': 'notification_providers', 'list': 'notification_providers',
'name': 'notifymywp', 'name': 'notifymywp',
'label': 'Notify My Windows Phone', 'label': 'Windows Phone',
'options': [ 'options': [
{ {
'name': 'enabled', 'name': 'enabled',
+1 -1
View File
@@ -12,7 +12,7 @@ class Automation(Plugin):
fireEvent('schedule.interval', 'automation.add_movies', self.addMovies, hours = self.conf('hour', default = 12)) fireEvent('schedule.interval', 'automation.add_movies', self.addMovies, hours = self.conf('hour', default = 12))
if Env.get('dev'): if not Env.get('dev'):
addEvent('app.load', self.addMovies) addEvent('app.load', self.addMovies)
def addMovies(self): def addMovies(self):
+1 -1
View File
@@ -78,7 +78,7 @@ class Plugin(object):
self.makeDir(os.path.dirname(path)) self.makeDir(os.path.dirname(path))
try: try:
f = open(path, 'w' if not binary else 'wb') f = open(path, 'w+' if not binary else 'w+b')
f.write(content) f.write(content)
f.close() f.close()
os.chmod(path, Env.getPermission('file')) os.chmod(path, Env.getPermission('file'))
+1 -1
View File
@@ -251,7 +251,7 @@ class Searcher(Plugin):
# Remove releases that aren't found anymore # Remove releases that aren't found anymore
for release in movie.get('releases', []): for release in movie.get('releases', []):
if release.get('identifier') not in found_releases: if release.get('status_id') == available_status.get('id') and release.get('identifier') not in found_releases:
fireEvent('release.delete', release.get('id'), single = True) fireEvent('release.delete', release.get('id'), single = True)
else: else:
@@ -1,8 +1,13 @@
.page.wizard .uniForm {
width: 80%;
margin: 0 auto 30px;
}
.page.wizard h1 { .page.wizard h1 {
padding: 10px 30px; padding: 10px 30px;
margin: 0; margin: 0;
display: block; display: block;
font-size: 40px; font-size: 30px;
margin-top: 80px; margin-top: 80px;
} }
@@ -41,8 +41,7 @@ Page.Wizard = new Class({
}, },
'providers': { 'providers': {
'title': 'Are you registered at any of these sites?', 'title': 'Are you registered at any of these sites?',
'description': 'CP uses these sites to search for movies. A few free are enabled by default, but it\'s always better to have a few more. Check settings for the full list of available providers.', 'description': 'CP uses these sites to search for movies. A few free are enabled by default, but it\'s always better to have a few more. Check settings for the full list of available providers.'
'include': ['nzb_providers', 'torrent_providers']
}, },
'renamer': { 'renamer': {
'title': 'Move & rename the movies after downloading?', 'title': 'Move & rename the movies after downloading?',
@@ -213,8 +212,6 @@ Page.Wizard = new Class({
// Hide retention // Hide retention
self.el.getElement('.tab_searcher').hide(); self.el.getElement('.tab_searcher').hide();
self.el.getElement('.t_searcher').hide(); self.el.getElement('.t_searcher').hide();
self.el.getElement('.t_nzb_providers').hide();
self.el.getElement('.t_torrent_providers').hide();
// Add pointer // Add pointer
new Element('.tab_wrapper').wraps(tabs).adopt( new Element('.tab_wrapper').wraps(tabs).adopt(
@@ -27,7 +27,7 @@ class IMDB(Automation, RSS):
try: try:
rss_data = self.getHTMLData(url) rss_data = self.getHTMLData(url)
imdbs = getImdb(rss_data, multiple = True) imdbs = getImdb(rss_data, multiple = True) if rss_data else []
for imdb in imdbs: for imdb in imdbs:
movies.append(imdb) movies.append(imdb)
@@ -4,6 +4,7 @@ config = {
{ {
'label': 'Usenet', 'label': 'Usenet',
'description': 'Providers searching usenet for new releases', 'description': 'Providers searching usenet for new releases',
'wizard': True,
'type': 'list', 'type': 'list',
'name': 'nzb_providers', 'name': 'nzb_providers',
'tab': 'searcher', 'tab': 'searcher',
@@ -12,6 +12,7 @@ config = [{
'list': 'nzb_providers', 'list': 'nzb_providers',
'name': 'binsearch', 'name': 'binsearch',
'description': 'Free provider, less accurate. See <a href="https://www.binsearch.info/">BinSearch</a>', 'description': 'Free provider, less accurate. See <a href="https://www.binsearch.info/">BinSearch</a>',
'wizard': True,
'options': [ 'options': [
{ {
'name': 'enabled', 'name': 'enabled',
@@ -12,6 +12,7 @@ config = [{
'list': 'nzb_providers', 'list': 'nzb_providers',
'name': 'FTDWorld', 'name': 'FTDWorld',
'description': 'Free provider, less accurate. See <a href="http://ftdworld.net">FTDWorld</a>', 'description': 'Free provider, less accurate. See <a href="http://ftdworld.net">FTDWorld</a>',
'wizard': True,
'options': [ 'options': [
{ {
'name': 'enabled', 'name': 'enabled',
@@ -12,6 +12,7 @@ config = [{
'list': 'nzb_providers', 'list': 'nzb_providers',
'name': 'NZBClub', 'name': 'NZBClub',
'description': 'Free provider, less accurate. See <a href="https://www.nzbclub.com/">NZBClub</a>', 'description': 'Free provider, less accurate. See <a href="https://www.nzbclub.com/">NZBClub</a>',
'wizard': True,
'options': [ 'options': [
{ {
'name': 'enabled', 'name': 'enabled',
@@ -12,6 +12,7 @@ config = [{
'list': 'nzb_providers', 'list': 'nzb_providers',
'name': 'nzbindex', 'name': 'nzbindex',
'description': 'Free provider, less accurate. See <a href="https://www.nzbindex.com/">NZBIndex</a>', 'description': 'Free provider, less accurate. See <a href="https://www.nzbindex.com/">NZBIndex</a>',
'wizard': True,
'options': [ 'options': [
{ {
'name': 'enabled', 'name': 'enabled',
@@ -12,7 +12,7 @@ config = [{
'list': 'nzb_providers', 'list': 'nzb_providers',
'name': 'nzbsrus', 'name': 'nzbsrus',
'label': 'Nzbsrus', 'label': 'Nzbsrus',
'description': 'See <a href="https://www.nzbsrus.com/">NZBsRus</a>', 'description': 'See <a href="https://www.nzbsrus.com/">NZBsRus</a>. <strong>You need a VIP account!</strong>',
'wizard': True, 'wizard': True,
'options': [ 'options': [
{ {
@@ -53,7 +53,7 @@ class Nzbsrus(NZBProvider, RSS):
'name': title, 'name': title,
'age': age, 'age': age,
'size': size, 'size': size,
'url': self.urls['download'] % id + self.getApiExt() + self.getTextElement(nzb, 'key'), 'url': self.urls['download'] % nzb_id + self.getApiExt() + self.getTextElement(nzb, 'key'),
'detail_url': self.urls['detail'] % nzb_id, 'detail_url': self.urls['detail'] % nzb_id,
'description': self.getTextElement(nzb, 'addtext'), 'description': self.getTextElement(nzb, 'addtext'),
}) })
@@ -12,6 +12,7 @@ config = [{
'list': 'nzb_providers', 'list': 'nzb_providers',
'name': 'nzbX', 'name': 'nzbX',
'description': 'Free provider. See <a href="https://www.nzbx.co/">nzbX</a>', 'description': 'Free provider. See <a href="https://www.nzbx.co/">nzbX</a>',
'wizard': True,
'options': [ 'options': [
{ {
'name': 'enabled', 'name': 'enabled',
@@ -12,6 +12,7 @@ config = [{
'list': 'nzb_providers', 'list': 'nzb_providers',
'name': 'OMGWTFNZBs', 'name': 'OMGWTFNZBs',
'description': 'See <a href="http://omgwtfnzbs.org/">OMGWTFNZBs</a>', 'description': 'See <a href="http://omgwtfnzbs.org/">OMGWTFNZBs</a>',
'wizard': True,
'options': [ 'options': [
{ {
'name': 'enabled', 'name': 'enabled',
@@ -4,6 +4,7 @@ config = {
{ {
'label': 'Torrent', 'label': 'Torrent',
'description': 'Providers searching torrent sites for new releases', 'description': 'Providers searching torrent sites for new releases',
'wizard': True,
'type': 'list', 'type': 'list',
'name': 'torrent_providers', 'name': 'torrent_providers',
'tab': 'searcher', 'tab': 'searcher',
@@ -12,6 +12,7 @@ config = [{
'list': 'torrent_providers', 'list': 'torrent_providers',
'name': 'PassThePopcorn', 'name': 'PassThePopcorn',
'description': 'See <a href="https://passthepopcorn.me">PassThePopcorn.me</a>', 'description': 'See <a href="https://passthepopcorn.me">PassThePopcorn.me</a>',
'wizard': True,
'options': [ 'options': [
{ {
'name': 'enabled', 'name': 'enabled',
@@ -12,6 +12,7 @@ config = [{
'list': 'torrent_providers', 'list': 'torrent_providers',
'name': 'PublicHD', 'name': 'PublicHD',
'description': 'Public Torrent site with only HD content. See <a href="https://publichd.se/">PublicHD</a>', 'description': 'Public Torrent site with only HD content. See <a href="https://publichd.se/">PublicHD</a>',
'wizard': True,
'options': [ 'options': [
{ {
'name': 'enabled', 'name': 'enabled',
@@ -12,6 +12,7 @@ config = [{
'list': 'torrent_providers', 'list': 'torrent_providers',
'name': 'SceneAccess', 'name': 'SceneAccess',
'description': 'See <a href="https://sceneaccess.eu/">SceneAccess</a>', 'description': 'See <a href="https://sceneaccess.eu/">SceneAccess</a>',
'wizard': True,
'options': [ 'options': [
{ {
'name': 'enabled', 'name': 'enabled',
@@ -12,6 +12,7 @@ config = [{
'list': 'torrent_providers', 'list': 'torrent_providers',
'name': 'SceneHD', 'name': 'SceneHD',
'description': 'See <a href="https://scenehd.org">SceneHD</a>', 'description': 'See <a href="https://scenehd.org">SceneHD</a>',
'wizard': True,
'options': [ 'options': [
{ {
'name': 'enabled', 'name': 'enabled',
@@ -12,6 +12,7 @@ config = [{
'list': 'torrent_providers', 'list': 'torrent_providers',
'name': 'TorrentDay', 'name': 'TorrentDay',
'description': 'See <a href="http://www.td.af/">TorrentDay</a>', 'description': 'See <a href="http://www.td.af/">TorrentDay</a>',
'wizard': True,
'options': [ 'options': [
{ {
'name': 'enabled', 'name': 'enabled',
@@ -12,6 +12,7 @@ config = [{
'list': 'torrent_providers', 'list': 'torrent_providers',
'name': 'TorrentLeech', 'name': 'TorrentLeech',
'description': 'See <a href="http://torrentleech.org">TorrentLeech</a>', 'description': 'See <a href="http://torrentleech.org">TorrentLeech</a>',
'wizard': True,
'options': [ 'options': [
{ {
'name': 'enabled', 'name': 'enabled',
+2 -1
View File
@@ -98,7 +98,7 @@ def runCouchPotato(options, base_path, args, data_dir = None, log_dir = None, En
total_backups = len(backups) total_backups = len(backups)
for backup in backups: for backup in backups:
if total_backups > 3: if total_backups > 3:
if int(os.path.basename(backup)) < time.time() - 259200: if tryInt(os.path.basename(backup)) < time.time() - 259200:
for src_file in src_files: for src_file in src_files:
b_file = os.path.join(backup, os.path.basename(src_file)) b_file = os.path.join(backup, os.path.basename(src_file))
if os.path.isfile(b_file): if os.path.isfile(b_file):
@@ -212,6 +212,7 @@ def runCouchPotato(options, base_path, args, data_dir = None, log_dir = None, En
config = { config = {
'use_reloader': reloader, 'use_reloader': reloader,
'port': tryInt(Env.setting('port', default = 5000)), 'port': tryInt(Env.setting('port', default = 5000)),
'host': Env.setting('host', default = ''),
'ssl_cert': Env.setting('ssl_cert', default = None), 'ssl_cert': Env.setting('ssl_cert', default = None),
'ssl_key': Env.setting('ssl_key', default = None), 'ssl_key': Env.setting('ssl_key', default = None),
} }
+1 -1
View File
@@ -301,7 +301,7 @@ Page.Settings = new Class({
createList: function(content_container){ createList: function(content_container){
return new Element('div.option_list').grab( return new Element('div.option_list').grab(
new Element('h3', { new Element('h3', {
'text': 'Enable more providers' 'text': 'Enable another'
}) })
).inject(content_container) ).inject(content_container)
} }
+5 -4
View File
@@ -163,6 +163,7 @@
.page .option_list .enabler { .page .option_list .enabler {
padding: 0; padding: 0;
margin-left: 5px !important;
} }
.page .option_list .enabler:not(.disabled) { .page .option_list .enabler:not(.disabled) {
@@ -175,7 +176,7 @@
.page .option_list h3 { .page .option_list h3 {
padding: 0; padding: 0;
margin: 10px 0 0 0; margin: 10px 5px 0;
text-align: center; text-align: center;
font-weight: normal; font-weight: normal;
text-shadow: none; text-shadow: none;
@@ -188,7 +189,7 @@
display: inline-block; display: inline-block;
margin: 3px 3px 3px 20px; margin: 3px 3px 3px 20px;
padding: 4px 0; padding: 4px 0;
width: 159px; width: 173px;
vertical-align: top; vertical-align: top;
} }
@@ -628,14 +629,14 @@
.group_userscript .or { .group_userscript .or {
float: left; float: left;
margin: 20px 10px; margin: 20px -10px 0 10px;
} }
.group_userscript .bookmarklet { .group_userscript .bookmarklet {
display: block; display: block;
display: block; display: block;
float: left; float: left;
padding: 20px 15px 0 0 ; padding: 20px 15px 0 25px;
border-radius: 5px; border-radius: 5px;
} }