Compare commits

..

No commits in common. "774450d263079302b91078b848387a146166e5ba" and "853efbba9a1d792386fefd6e3c73b8ae89410236" have entirely different histories.

16 changed files with 45 additions and 52 deletions

View file

@ -375,3 +375,13 @@ def update_geoip(force=False):
def init():
load_config(True)
def shutdown():
if settings.RELOADER_RUNNING:
RUN_RELOADER = False
settings.RELOADER_RUNNING = False
if NOTIFIER:
NOTIFIER.stop()

View file

@ -1,17 +1,16 @@
# -*- coding: utf-8 -*-
from distutils.spawn import find_executable
from glob import glob
import os
from os.path import exists
import fractions
import logging
import math
import os
import re
import shutil
import subprocess
import tempfile
import time
from distutils.spawn import find_executable
from glob import glob
import numpy as np
import ox
@ -22,9 +21,6 @@ from PIL import Image
from .chop import Chop, make_keyframe_index
logger = logging.getLogger('pandora.' + __name__)
img_extension = 'jpg'
MAX_DISTANCE = math.sqrt(3 * pow(255, 2))

View file

@ -832,7 +832,7 @@ class Stream(models.Model):
# get current version from db and update
try:
self.refresh_from_db()
except Stream.DoesNotExist:
except archive.models.DoesNotExist:
pass
else:
self.update_status(ok, error)

View file

@ -65,7 +65,7 @@ def fill_queue():
def get_celery_worker_status():
ERROR_KEY = "ERROR"
try:
insp = app.control.inspect()
insp = celery.task.control.inspect()
d = insp.stats()
if not d:
d = {ERROR_KEY: 'No running Celery workers were found.'}

View file

@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
from datetime import datetime
import unicodedata
from django.db.models import Q, Manager

View file

@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
from datetime import datetime
import unicodedata
from six import string_types

View file

@ -6,12 +6,11 @@ import os
import re
import unicodedata
from django.conf import settings
from django.contrib.auth import get_user_model
from django.db import models, transaction
from django.db.models import Q, Sum, Max
from django.contrib.auth import get_user_model
from django.db.models.signals import pre_delete
from django.utils import datetime_safe
from django.conf import settings
from oxdjango.fields import JSONField
from PIL import Image
@ -80,7 +79,7 @@ class Document(models.Model, FulltextMixin):
current_values = []
for k in settings.CONFIG['documentKeys']:
if k.get('sortType') == 'person':
current_values += self.get_value(k['id'], [])
current_values += self.get(k['id'], [])
if not isinstance(current_values, list):
if not current_values:
current_values = []

View file

@ -60,25 +60,6 @@ def _order_query(qs, sort):
qs = qs.distinct()
return qs
def _order_by_group(query):
prefix = 'document__sort__'
if 'sort' in query:
op = '-' if query['sort'][0]['operator'] == '-' else ''
if len(query['sort']) == 1 and query['sort'][0]['key'] == 'items':
order_by = op + prefix + 'items'
if query['group'] == "year":
secondary = op + prefix + 'sortvalue'
order_by = (order_by, secondary)
elif query['group'] != "keyword":
order_by = (order_by, prefix + 'sortvalue')
else:
order_by = (order_by, 'value')
else:
order_by = op + prefix + 'sortvalue'
order_by = (order_by, prefix + 'items')
else:
order_by = ('-' + prefix + 'sortvalue', prefix + 'items')
return order_by
def findPages(request, data):
'''

View file

@ -3,16 +3,14 @@
import os
import re
from oxdjango.api import actions
from oxdjango.decorators import login_required_json
from oxdjango.http import HttpFileResponse
from oxdjango.shortcuts import render_to_json_response, get_object_or_404_json, json_response
import ox
from django.conf import settings
from oxdjango.decorators import login_required_json
from oxdjango.shortcuts import render_to_json_response, get_object_or_404_json, json_response
from django.db import transaction
from django.db.models import Max
from django.db.models import Sum
from oxdjango.http import HttpFileResponse
from oxdjango.api import actions
from django.conf import settings
from item import utils
from changelog.models import add_changelog

View file

@ -1209,7 +1209,7 @@ class Item(models.Model):
if not r:
return False
path = video.name
duration = sum(self.item.cache['durations'])
duration = sum(item.cache['durations'])
else:
path = stream.media.path
duration = stream.info['duration']

View file

@ -16,13 +16,11 @@ from wsgiref.util import FileWrapper
from django.conf import settings
from ox.utils import json, ET
import ox
from oxdjango.api import actions
from oxdjango.decorators import login_required_json
from oxdjango.http import HttpFileResponse
from oxdjango.shortcuts import render_to_json_response, get_object_or_404_json, json_response
import oxdjango
from oxdjango.http import HttpFileResponse
import ox
from . import models
from . import utils
@ -34,6 +32,7 @@ from clip.models import Clip
from user.models import has_capability
from changelog.models import add_changelog
from oxdjango.api import actions
def _order_query(qs, sort, prefix='sort__'):
@ -596,7 +595,7 @@ def add(request, data):
if p:
p.wait()
else:
item.make_poster()
i.make_poster()
del data['title']
if data:
response = edit_item(request.user, item, data)

View file

@ -11,7 +11,7 @@ keymap = {
default_key = 'name'
def parseCondition(condition, user):
k = condition.get('key', default_key)
k = condition.get('key', defauly_key)
k = keymap.get(k, k)
if not k:
k = default_key

View file

@ -167,7 +167,7 @@ class Task(models.Model):
job = self.get_job()
if job:
print(job)
r = app.control.revoke(job['id'])
r = celery.task.control.revoke(job['id'])
print(r)
for f in self.item.files.filter(encoding=True):
f.delete()

12
pandora/user/urls.py Normal file
View file

@ -0,0 +1,12 @@
# -*- coding: utf-8 -*-
from django.conf.urls.defaults import *
urlpatterns = patterns("user.views",
(r'^preferences', 'preferences'),
(r'^login', 'login'),
(r'^logout', 'logout'),
(r'^register', 'register'),
)

View file

@ -24,7 +24,7 @@ def get_location(ip):
location = g.city(ip)
except:
try:
location = g.country(ip)
location = g.country(s.ip)
except:
location = None
if location:

View file

@ -1,11 +1,11 @@
# -*- coding: utf-8 -*-
from celery.execute import send_task
from django.conf import settings
from app.celery import app
key = 'websocket'
def trigger_event(event, data):
if settings.WEBSOCKET:
app.send_task('trigger_event', [event, data], exchange=key, routing_key=key)
send_task('trigger_event', [event, data], exchange=key, routing_key=key)