Merge branch 'refs/heads/develop'
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
from __future__ import with_statement
|
from __future__ import with_statement
|
||||||
from couchpotato.core.downloaders.base import Downloader
|
from couchpotato.core.downloaders.base import Downloader
|
||||||
from couchpotato.core.logger import CPLog
|
from couchpotato.core.logger import CPLog
|
||||||
|
from couchpotato.environment import Env
|
||||||
import os
|
import os
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
@@ -36,6 +37,7 @@ class Blackhole(Downloader):
|
|||||||
log.info('Downloading %s to %s.', (data.get('type'), fullPath))
|
log.info('Downloading %s to %s.', (data.get('type'), fullPath))
|
||||||
with open(fullPath, 'wb') as f:
|
with open(fullPath, 'wb') as f:
|
||||||
f.write(filedata)
|
f.write(filedata)
|
||||||
|
os.chmod(fullPath, Env.getPermission('file'))
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
log.info('File %s already exists.', fullPath)
|
log.info('File %s already exists.', fullPath)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ from couchpotato.core.downloaders.base import Downloader
|
|||||||
from couchpotato.core.helpers.encoding import tryUrlencode, ss
|
from couchpotato.core.helpers.encoding import tryUrlencode, ss
|
||||||
from couchpotato.core.helpers.variable import cleanHost, mergeDicts
|
from couchpotato.core.helpers.variable import cleanHost, mergeDicts
|
||||||
from couchpotato.core.logger import CPLog
|
from couchpotato.core.logger import CPLog
|
||||||
|
from couchpotato.environment import Env
|
||||||
from urllib2 import URLError
|
from urllib2 import URLError
|
||||||
import json
|
import json
|
||||||
import traceback
|
import traceback
|
||||||
@@ -38,9 +39,9 @@ class Sabnzbd(Downloader):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
if params.get('mode') is 'addfile':
|
if params.get('mode') is 'addfile':
|
||||||
sab = self.urlopen(url, timeout = 60, params = {'nzbfile': (ss(nzb_filename), filedata)}, multipart = True, show_error = False)
|
sab = self.urlopen(url, timeout = 60, params = {'nzbfile': (ss(nzb_filename), filedata)}, multipart = True, show_error = False, headers = {'User-Agent': Env.getIdentifier()})
|
||||||
else:
|
else:
|
||||||
sab = self.urlopen(url, timeout = 60, show_error = False)
|
sab = self.urlopen(url, timeout = 60, show_error = False, headers = {'User-Agent': Env.getIdentifier()})
|
||||||
except URLError:
|
except URLError:
|
||||||
log.error('Failed sending release, probably wrong HOST: %s', traceback.format_exc(0))
|
log.error('Failed sending release, probably wrong HOST: %s', traceback.format_exc(0))
|
||||||
return False
|
return False
|
||||||
@@ -139,7 +140,7 @@ class Sabnzbd(Downloader):
|
|||||||
'output': 'json'
|
'output': 'json'
|
||||||
}))
|
}))
|
||||||
|
|
||||||
data = self.urlopen(url, timeout = 60, show_error = False)
|
data = self.urlopen(url, timeout = 60, show_error = False, headers = {'User-Agent': Env.getIdentifier()})
|
||||||
if use_json:
|
if use_json:
|
||||||
d = json.loads(data)
|
d = json.loads(data)
|
||||||
if d.get('error'):
|
if d.get('error'):
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
from couchpotato.core.plugins.renamer.main import Renamer
|
from couchpotato.core.plugins.renamer.main import Renamer
|
||||||
|
import os
|
||||||
|
|
||||||
def start():
|
def start():
|
||||||
return Renamer()
|
return Renamer()
|
||||||
@@ -111,6 +112,15 @@ config = [{
|
|||||||
'label': 'Separator',
|
'label': 'Separator',
|
||||||
'description': 'Replace all the spaces with a character. Example: ".", "-" (without quotes). Leave empty to use spaces.',
|
'description': 'Replace all the spaces with a character. Example: ".", "-" (without quotes). Leave empty to use spaces.',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'advanced': True,
|
||||||
|
'name': 'ntfs_permission',
|
||||||
|
'label': 'NTFS Permission',
|
||||||
|
'type': 'bool',
|
||||||
|
'hidden': os.name != 'nt',
|
||||||
|
'description': 'Set permission of moved files to that of destination folder (Windows NTFS only).',
|
||||||
|
'default': False,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
}, {
|
}, {
|
||||||
'tab': 'renamer',
|
'tab': 'renamer',
|
||||||
|
|||||||
@@ -455,6 +455,8 @@ class Renamer(Plugin):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
os.chmod(dest, Env.getPermission('file'))
|
os.chmod(dest, Env.getPermission('file'))
|
||||||
|
if os.name == 'nt' and self.conf('ntfs_permission'):
|
||||||
|
os.popen('icacls "' + dest + '"* /reset /T')
|
||||||
except:
|
except:
|
||||||
log.error('Failed setting permissions for file: %s, %s', (dest, traceback.format_exc(1)))
|
log.error('Failed setting permissions for file: %s, %s', (dest, traceback.format_exc(1)))
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
from .main import Goodfilms
|
||||||
|
|
||||||
|
def start():
|
||||||
|
return Goodfilms()
|
||||||
|
|
||||||
|
config = [{
|
||||||
|
'name': 'goodfilms',
|
||||||
|
'groups': [
|
||||||
|
{
|
||||||
|
'tab': 'automation',
|
||||||
|
'list': 'watchlist_providers',
|
||||||
|
'name': 'goodfilms_automation',
|
||||||
|
'label': 'Goodfilms',
|
||||||
|
'description': 'import movies from your <a href="http://goodfil.ms">Goodfilms</a> queue',
|
||||||
|
'options': [
|
||||||
|
{
|
||||||
|
'name': 'automation_enabled',
|
||||||
|
'default': False,
|
||||||
|
'type': 'enabler',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'automation_username',
|
||||||
|
'label': 'Username',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}]
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
from couchpotato.core.logger import CPLog
|
||||||
|
from couchpotato.core.providers.automation.base import Automation
|
||||||
|
from bs4 import BeautifulSoup
|
||||||
|
|
||||||
|
log = CPLog(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
class Goodfilms(Automation):
|
||||||
|
|
||||||
|
url = 'http://goodfil.ms/%s/queue'
|
||||||
|
|
||||||
|
def getIMDBids(self):
|
||||||
|
|
||||||
|
if not self.conf('automation_username'):
|
||||||
|
log.error('Please fill in your username')
|
||||||
|
return []
|
||||||
|
|
||||||
|
movies = []
|
||||||
|
|
||||||
|
for movie in self.getWatchlist():
|
||||||
|
imdb_id = self.search(movie.get('title'), movie.get('year'), imdb_only = True)
|
||||||
|
movies.append(imdb_id)
|
||||||
|
|
||||||
|
return movies
|
||||||
|
|
||||||
|
def getWatchlist(self):
|
||||||
|
|
||||||
|
url = self.url % self.conf('automation_username')
|
||||||
|
soup = BeautifulSoup(self.getHTMLData(url))
|
||||||
|
|
||||||
|
movies = []
|
||||||
|
|
||||||
|
for movie in soup.find_all('div', attrs = { 'class': 'movie', 'data-film-title': True }):
|
||||||
|
movies.append({ 'title': movie['data-film-title'], 'year': movie['data-film-year'] })
|
||||||
|
|
||||||
|
return movies
|
||||||
@@ -88,7 +88,7 @@ Page.Manage = new Class({
|
|||||||
'onComplete': function(json){
|
'onComplete': function(json){
|
||||||
self.update_in_progress = true;
|
self.update_in_progress = true;
|
||||||
|
|
||||||
if(!json.progress){
|
if(!json || !json.progress){
|
||||||
clearInterval(self.progress_interval);
|
clearInterval(self.progress_interval);
|
||||||
self.update_in_progress = false;
|
self.update_in_progress = false;
|
||||||
if(self.progress_container){
|
if(self.progress_container){
|
||||||
|
|||||||
+6
-6
@@ -14,6 +14,11 @@
|
|||||||
prog=couchpotato
|
prog=couchpotato
|
||||||
lockfile=/var/lock/subsys/$prog
|
lockfile=/var/lock/subsys/$prog
|
||||||
|
|
||||||
|
# Source couchpotato configuration
|
||||||
|
if [ -f /etc/sysconfig/couchpotato ]; then
|
||||||
|
. /etc/sysconfig/couchpotato
|
||||||
|
fi
|
||||||
|
|
||||||
## Edit user configuation in /etc/sysconfig/couchpotato to change
|
## Edit user configuation in /etc/sysconfig/couchpotato to change
|
||||||
## the defaults
|
## the defaults
|
||||||
username=${CP_USER-couchpotato}
|
username=${CP_USER-couchpotato}
|
||||||
@@ -22,11 +27,6 @@ datadir=${CP_DATA-~/.couchpotato}
|
|||||||
pidfile=${CP_PIDFILE-/var/run/couchpotato/couchpotato.pid}
|
pidfile=${CP_PIDFILE-/var/run/couchpotato/couchpotato.pid}
|
||||||
##
|
##
|
||||||
|
|
||||||
# Source couchpotato configuration
|
|
||||||
if [ -f /etc/sysconfig/couchpotato ]; then
|
|
||||||
. /etc/sysconfig/couchpotato
|
|
||||||
fi
|
|
||||||
|
|
||||||
pidpath=`dirname ${pidfile}`
|
pidpath=`dirname ${pidfile}`
|
||||||
options=" --daemon --pid_file=${pidfile} --data_dir=${datadir}"
|
options=" --daemon --pid_file=${pidfile} --data_dir=${datadir}"
|
||||||
|
|
||||||
@@ -87,4 +87,4 @@ case "$1" in
|
|||||||
*)
|
*)
|
||||||
echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload}"
|
echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload}"
|
||||||
exit 2
|
exit 2
|
||||||
esac
|
esac
|
||||||
|
|||||||
Reference in New Issue
Block a user