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

View File

@@ -62,7 +62,6 @@ class Loader(object):
self.log.logger.addHandler(hdlr)
def addSignals(self):
signal.signal(signal.SIGINT, self.onExit)
signal.signal(signal.SIGTERM, lambda signum, stack_frame: sys.exit(1))
@@ -74,7 +73,7 @@ class Loader(object):
def onExit(self, signal, frame):
from couchpotato.core.event import fireEvent
fireEvent('app.crappy_shutdown', single = True)
fireEvent('app.shutdown', single = True)
def run(self):

View File

@@ -5,9 +5,10 @@
* 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.
* Post logs! Without seeing what is going on, I can't reproduce the error.
* What are you settings for the specific problem
* 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 is the movie + quality you are searching for.
* What are you settings for the specific problem.
* 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.
* 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 ;)

View File

@@ -10,6 +10,7 @@ from uuid import uuid4
import os
import platform
import signal
import sys
import time
import traceback
import webbrowser
@@ -178,6 +179,7 @@ class Core(Plugin):
def signalHandler(self):
def signal_handler(signal, frame):
fireEvent('app.do_shutdown')
fireEvent('app.shutdown')
signal.signal(signal.SIGINT, signal_handler)
signal.signal(signal.SIGTERM, signal_handler)

View File

@@ -2,7 +2,6 @@ from apscheduler.scheduler import Scheduler as Sched
from couchpotato.core.event import addEvent
from couchpotato.core.logger import CPLog
from couchpotato.core.plugins.base import Plugin
import logging
log = CPLog(__name__)

View File

@@ -38,10 +38,11 @@ class Transmission(Downloader):
'download-dir': folder_path
}
torrent_params = {
'seedRatioLimit': self.conf('ratio'),
'seedRatioMode': (0 if self.conf('ratio') else 1)
}
if self.conf('ratio'):
torrent_params = {
'seedRatioLimit': self.conf('ratio'),
'seedRatioMode': self.conf('ratio')
}
if not filedata and data.get('type') == 'torrent':
log.error('Failed sending torrent, no data')

View File

@@ -15,9 +15,9 @@ class Email(Notification):
# Extract all the settings from settings
from_address = self.conf('from')
to = self.conf('to')
smtp_server = self.conf('smtp_server')
to_address = self.conf('to')
ssl = self.conf('ssl')
smtp_server = self.conf('smtp_server')
smtp_user = self.conf('smtp_user')
smtp_pass = self.conf('smtp_pass')
@@ -25,22 +25,27 @@ class Email(Notification):
message = MIMEText(toUnicode(message))
message['Subject'] = self.default_title
message['From'] = from_address
message['To'] = to
message['To'] = to_address
try:
# 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)
# Check too see if an login attempt should be attempted
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)
# 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
mailserver.quit()
log.info('Email notifications sent.')
log.info('Email notification sent')
return True
except:
log.error('E-mail failed: %s', traceback.format_exc())

View File

@@ -10,7 +10,7 @@ config = [{
'tab': 'notifications',
'list': 'notification_providers',
'name': 'notifymywp',
'label': 'Notify My Windows Phone',
'label': 'Windows Phone',
'options': [
{
'name': 'enabled',

View File

@@ -12,7 +12,7 @@ class Automation(Plugin):
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)
def addMovies(self):

View File

@@ -78,7 +78,7 @@ class Plugin(object):
self.makeDir(os.path.dirname(path))
try:
f = open(path, 'w' if not binary else 'wb')
f = open(path, 'w+' if not binary else 'w+b')
f.write(content)
f.close()
os.chmod(path, Env.getPermission('file'))

View File

@@ -251,7 +251,7 @@ class Searcher(Plugin):
# Remove releases that aren't found anymore
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)
else:

View File

@@ -1,8 +1,13 @@
.page.wizard .uniForm {
width: 80%;
margin: 0 auto 30px;
}
.page.wizard h1 {
padding: 10px 30px;
margin: 0;
display: block;
font-size: 40px;
font-size: 30px;
margin-top: 80px;
}

View File

@@ -41,8 +41,7 @@ Page.Wizard = new Class({
},
'providers': {
'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.',
'include': ['nzb_providers', 'torrent_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.'
},
'renamer': {
'title': 'Move & rename the movies after downloading?',
@@ -213,8 +212,6 @@ Page.Wizard = new Class({
// Hide retention
self.el.getElement('.tab_searcher').hide();
self.el.getElement('.t_searcher').hide();
self.el.getElement('.t_nzb_providers').hide();
self.el.getElement('.t_torrent_providers').hide();
// Add pointer
new Element('.tab_wrapper').wraps(tabs).adopt(

View File

@@ -27,7 +27,7 @@ class IMDB(Automation, RSS):
try:
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:
movies.append(imdb)

View File

@@ -4,6 +4,7 @@ config = {
{
'label': 'Usenet',
'description': 'Providers searching usenet for new releases',
'wizard': True,
'type': 'list',
'name': 'nzb_providers',
'tab': 'searcher',

View File

@@ -12,6 +12,7 @@ config = [{
'list': 'nzb_providers',
'name': 'binsearch',
'description': 'Free provider, less accurate. See <a href="https://www.binsearch.info/">BinSearch</a>',
'wizard': True,
'options': [
{
'name': 'enabled',

View File

@@ -12,6 +12,7 @@ config = [{
'list': 'nzb_providers',
'name': 'FTDWorld',
'description': 'Free provider, less accurate. See <a href="http://ftdworld.net">FTDWorld</a>',
'wizard': True,
'options': [
{
'name': 'enabled',

View File

@@ -12,6 +12,7 @@ config = [{
'list': 'nzb_providers',
'name': 'NZBClub',
'description': 'Free provider, less accurate. See <a href="https://www.nzbclub.com/">NZBClub</a>',
'wizard': True,
'options': [
{
'name': 'enabled',

View File

@@ -12,6 +12,7 @@ config = [{
'list': 'nzb_providers',
'name': 'nzbindex',
'description': 'Free provider, less accurate. See <a href="https://www.nzbindex.com/">NZBIndex</a>',
'wizard': True,
'options': [
{
'name': 'enabled',

View File

@@ -12,7 +12,7 @@ config = [{
'list': 'nzb_providers',
'name': '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,
'options': [
{

View File

@@ -53,7 +53,7 @@ class Nzbsrus(NZBProvider, RSS):
'name': title,
'age': age,
'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,
'description': self.getTextElement(nzb, 'addtext'),
})

View File

@@ -12,6 +12,7 @@ config = [{
'list': 'nzb_providers',
'name': 'nzbX',
'description': 'Free provider. See <a href="https://www.nzbx.co/">nzbX</a>',
'wizard': True,
'options': [
{
'name': 'enabled',

View File

@@ -12,6 +12,7 @@ config = [{
'list': 'nzb_providers',
'name': 'OMGWTFNZBs',
'description': 'See <a href="http://omgwtfnzbs.org/">OMGWTFNZBs</a>',
'wizard': True,
'options': [
{
'name': 'enabled',

View File

@@ -4,6 +4,7 @@ config = {
{
'label': 'Torrent',
'description': 'Providers searching torrent sites for new releases',
'wizard': True,
'type': 'list',
'name': 'torrent_providers',
'tab': 'searcher',

View File

@@ -12,6 +12,7 @@ config = [{
'list': 'torrent_providers',
'name': 'PassThePopcorn',
'description': 'See <a href="https://passthepopcorn.me">PassThePopcorn.me</a>',
'wizard': True,
'options': [
{
'name': 'enabled',

View File

@@ -12,6 +12,7 @@ config = [{
'list': 'torrent_providers',
'name': 'PublicHD',
'description': 'Public Torrent site with only HD content. See <a href="https://publichd.se/">PublicHD</a>',
'wizard': True,
'options': [
{
'name': 'enabled',

View File

@@ -12,6 +12,7 @@ config = [{
'list': 'torrent_providers',
'name': 'SceneAccess',
'description': 'See <a href="https://sceneaccess.eu/">SceneAccess</a>',
'wizard': True,
'options': [
{
'name': 'enabled',

View File

@@ -12,6 +12,7 @@ config = [{
'list': 'torrent_providers',
'name': 'SceneHD',
'description': 'See <a href="https://scenehd.org">SceneHD</a>',
'wizard': True,
'options': [
{
'name': 'enabled',

View File

@@ -12,6 +12,7 @@ config = [{
'list': 'torrent_providers',
'name': 'TorrentDay',
'description': 'See <a href="http://www.td.af/">TorrentDay</a>',
'wizard': True,
'options': [
{
'name': 'enabled',

View File

@@ -12,6 +12,7 @@ config = [{
'list': 'torrent_providers',
'name': 'TorrentLeech',
'description': 'See <a href="http://torrentleech.org">TorrentLeech</a>',
'wizard': True,
'options': [
{
'name': 'enabled',

View File

@@ -98,7 +98,7 @@ def runCouchPotato(options, base_path, args, data_dir = None, log_dir = None, En
total_backups = len(backups)
for backup in backups:
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:
b_file = os.path.join(backup, os.path.basename(src_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 = {
'use_reloader': reloader,
'port': tryInt(Env.setting('port', default = 5000)),
'host': Env.setting('host', default = ''),
'ssl_cert': Env.setting('ssl_cert', default = None),
'ssl_key': Env.setting('ssl_key', default = None),
}

View File

@@ -301,7 +301,7 @@ Page.Settings = new Class({
createList: function(content_container){
return new Element('div.option_list').grab(
new Element('h3', {
'text': 'Enable more providers'
'text': 'Enable another'
})
).inject(content_container)
}

View File

@@ -163,6 +163,7 @@
.page .option_list .enabler {
padding: 0;
margin-left: 5px !important;
}
.page .option_list .enabler:not(.disabled) {
@@ -175,7 +176,7 @@
.page .option_list h3 {
padding: 0;
margin: 10px 0 0 0;
margin: 10px 5px 0;
text-align: center;
font-weight: normal;
text-shadow: none;
@@ -188,7 +189,7 @@
display: inline-block;
margin: 3px 3px 3px 20px;
padding: 4px 0;
width: 159px;
width: 173px;
vertical-align: top;
}
@@ -628,14 +629,14 @@
.group_userscript .or {
float: left;
margin: 20px 10px;
margin: 20px -10px 0 10px;
}
.group_userscript .bookmarklet {
display: block;
display: block;
float: left;
padding: 20px 15px 0 0 ;
padding: 20px 15px 0 25px;
border-radius: 5px;
}