Merge branch 'refs/heads/develop'
This commit is contained in:
@@ -142,7 +142,9 @@ class Updater(Plugin):
|
||||
}
|
||||
|
||||
def doShutdown(self):
|
||||
self.updater.deletePyc(show_logs = False)
|
||||
if not Env.get('dev'):
|
||||
self.updater.deletePyc(show_logs = False)
|
||||
|
||||
return super(Updater, self).doShutdown()
|
||||
|
||||
|
||||
|
||||
@@ -38,9 +38,18 @@ class ProfilePlugin(Plugin):
|
||||
|
||||
def forceDefaults(self):
|
||||
|
||||
db = get_db()
|
||||
|
||||
# Fill qualities and profiles if they are empty somehow..
|
||||
if db.count(db.all, 'profile') == 0:
|
||||
|
||||
if db.count(db.all, 'quality') == 0:
|
||||
fireEvent('quality.fill', single = True)
|
||||
|
||||
self.fill()
|
||||
|
||||
# Get all active movies without profile
|
||||
try:
|
||||
db = get_db()
|
||||
medias = fireEvent('media.with_status', 'active', single = True)
|
||||
|
||||
profile_ids = [x.get('_id') for x in self.all()]
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import traceback
|
||||
import re
|
||||
from CodernityDB.database import RecordNotFound
|
||||
|
||||
from couchpotato import get_db
|
||||
from couchpotato.api import addApiView
|
||||
@@ -51,6 +52,7 @@ class QualityPlugin(Plugin):
|
||||
addEvent('quality.order', self.getOrder)
|
||||
addEvent('quality.ishigher', self.isHigher)
|
||||
addEvent('quality.isfinish', self.isFinish)
|
||||
addEvent('quality.fill', self.fill)
|
||||
|
||||
addApiView('quality.size.save', self.saveSize)
|
||||
addApiView('quality.list', self.allView, docs = {
|
||||
@@ -152,24 +154,31 @@ class QualityPlugin(Plugin):
|
||||
order = 0
|
||||
for q in self.qualities:
|
||||
|
||||
db.insert({
|
||||
'_t': 'quality',
|
||||
'order': order,
|
||||
'identifier': q.get('identifier'),
|
||||
'size_min': tryInt(q.get('size')[0]),
|
||||
'size_max': tryInt(q.get('size')[1]),
|
||||
})
|
||||
existing = None
|
||||
try:
|
||||
existing = db.get('quality', q.get('identifier'))
|
||||
except RecordNotFound:
|
||||
pass
|
||||
|
||||
log.info('Creating profile: %s', q.get('label'))
|
||||
db.insert({
|
||||
'_t': 'profile',
|
||||
'order': order + 20, # Make sure it goes behind other profiles
|
||||
'core': True,
|
||||
'qualities': [q.get('identifier')],
|
||||
'label': toUnicode(q.get('label')),
|
||||
'finish': [True],
|
||||
'wait_for': [0],
|
||||
})
|
||||
if not existing:
|
||||
db.insert({
|
||||
'_t': 'quality',
|
||||
'order': order,
|
||||
'identifier': q.get('identifier'),
|
||||
'size_min': tryInt(q.get('size')[0]),
|
||||
'size_max': tryInt(q.get('size')[1]),
|
||||
})
|
||||
|
||||
log.info('Creating profile: %s', q.get('label'))
|
||||
db.insert({
|
||||
'_t': 'profile',
|
||||
'order': order + 20, # Make sure it goes behind other profiles
|
||||
'core': True,
|
||||
'qualities': [q.get('identifier')],
|
||||
'label': toUnicode(q.get('label')),
|
||||
'finish': [True],
|
||||
'wait_for': [0],
|
||||
})
|
||||
|
||||
order += 1
|
||||
|
||||
|
||||
@@ -29,9 +29,14 @@ var QualityBase = new Class({
|
||||
},
|
||||
|
||||
getQuality: function(identifier){
|
||||
return this.qualities.filter(function(q){
|
||||
return q.identifier == identifier;
|
||||
}).pick();
|
||||
try {
|
||||
return this.qualities.filter(function(q){
|
||||
return q.identifier == identifier;
|
||||
}).pick();
|
||||
}
|
||||
catch(e){}
|
||||
|
||||
return {}
|
||||
},
|
||||
|
||||
addSettings: function(){
|
||||
@@ -104,7 +109,7 @@ var QualityBase = new Class({
|
||||
var profile_list;
|
||||
self.settings.createGroup({
|
||||
'label': 'Profile Defaults',
|
||||
'description': '(Needs refresh \'' +(App.isMac() ? 'CMD+R' : 'F5')+ '\' after editing)'
|
||||
'description': '(Needs refresh \'' +(App.isMac() ? 'CMD+R' : 'F5')+ '\' after editing)'
|
||||
}).adopt(
|
||||
new Element('.ctrlHolder#profile_ordering').adopt(
|
||||
new Element('label[text=Order]'),
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
[Unit]
|
||||
Description=CouchPotato application instance
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/lib/CouchPotatoServer/CouchPotato.py --daemon
|
||||
ExecStart=/var/lib/CouchPotatoServer/CouchPotato.py --daemon
|
||||
GuessMainPID=no
|
||||
Type=forking
|
||||
User=couchpotato
|
||||
Group=couchpotato
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
WantedBy=multi-user.target
|
||||
|
||||
+8
-5
@@ -1,6 +1,7 @@
|
||||
# axel.py
|
||||
#
|
||||
# Copyright (C) 2010 Adrian Cristea adrian dot cristea at gmail dotcom
|
||||
# Edits by Ruud Burger
|
||||
#
|
||||
# Based on an idea by Peter Thatcher, found on
|
||||
# http://www.valuedlessons.com/2008/04/events-in-python.html
|
||||
@@ -11,12 +12,14 @@
|
||||
# Source: http://pypi.python.org/pypi/axel
|
||||
# Docs: http://packages.python.org/axel
|
||||
|
||||
from couchpotato.core.helpers.variable import natsortKey
|
||||
import Queue
|
||||
from Queue import Empty, Queue
|
||||
import hashlib
|
||||
import sys
|
||||
import threading
|
||||
|
||||
from couchpotato.core.helpers.variable import natsortKey
|
||||
|
||||
|
||||
class Event(object):
|
||||
"""
|
||||
Event object inspired by C# events. Handlers can be registered and
|
||||
@@ -140,7 +143,7 @@ class Event(object):
|
||||
|
||||
def fire(self, *args, **kwargs):
|
||||
""" Stores all registered handlers in a queue for processing """
|
||||
self.queue = Queue.Queue()
|
||||
self.queue = Queue()
|
||||
result = {}
|
||||
|
||||
if self.handlers:
|
||||
@@ -239,9 +242,9 @@ class Event(object):
|
||||
order_lock.release()
|
||||
|
||||
if self.queue.empty():
|
||||
raise Queue.Empty
|
||||
raise Empty
|
||||
|
||||
except Queue.Empty:
|
||||
except Empty:
|
||||
break
|
||||
|
||||
def _extract(self, queue_item):
|
||||
|
||||
Reference in New Issue
Block a user