forked from 0x2620/pandora
missing imports and typos
This commit is contained in:
parent
e1a28c941a
commit
774450d263
12 changed files with 49 additions and 30 deletions
|
@ -375,13 +375,3 @@ 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()
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
from distutils.spawn import find_executable
|
||||
from glob import glob
|
||||
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
|
||||
|
@ -21,6 +22,9 @@ 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))
|
||||
|
|
|
@ -832,7 +832,7 @@ class Stream(models.Model):
|
|||
# get current version from db and update
|
||||
try:
|
||||
self.refresh_from_db()
|
||||
except archive.models.DoesNotExist:
|
||||
except Stream.DoesNotExist:
|
||||
pass
|
||||
else:
|
||||
self.update_status(ok, error)
|
||||
|
|
|
@ -65,7 +65,7 @@ def fill_queue():
|
|||
def get_celery_worker_status():
|
||||
ERROR_KEY = "ERROR"
|
||||
try:
|
||||
insp = celery.task.control.inspect()
|
||||
insp = app.control.inspect()
|
||||
d = insp.stats()
|
||||
if not d:
|
||||
d = {ERROR_KEY: 'No running Celery workers were found.'}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from datetime import datetime
|
||||
import unicodedata
|
||||
|
||||
from django.db.models import Q, Manager
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from datetime import datetime
|
||||
import unicodedata
|
||||
|
||||
from six import string_types
|
||||
|
|
|
@ -6,11 +6,12 @@ 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.conf import settings
|
||||
from django.utils import datetime_safe
|
||||
from oxdjango.fields import JSONField
|
||||
|
||||
from PIL import Image
|
||||
|
@ -79,7 +80,7 @@ class Document(models.Model, FulltextMixin):
|
|||
current_values = []
|
||||
for k in settings.CONFIG['documentKeys']:
|
||||
if k.get('sortType') == 'person':
|
||||
current_values += self.get(k['id'], [])
|
||||
current_values += self.get_value(k['id'], [])
|
||||
if not isinstance(current_values, list):
|
||||
if not current_values:
|
||||
current_values = []
|
||||
|
|
|
@ -60,6 +60,25 @@ 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):
|
||||
'''
|
||||
|
|
|
@ -3,14 +3,16 @@
|
|||
import os
|
||||
import re
|
||||
|
||||
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 ox
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import transaction
|
||||
from django.db.models import Max
|
||||
from oxdjango.http import HttpFileResponse
|
||||
from oxdjango.api import actions
|
||||
from django.conf import settings
|
||||
from django.db.models import Sum
|
||||
|
||||
from item import utils
|
||||
from changelog.models import add_changelog
|
||||
|
|
|
@ -1209,7 +1209,7 @@ class Item(models.Model):
|
|||
if not r:
|
||||
return False
|
||||
path = video.name
|
||||
duration = sum(item.cache['durations'])
|
||||
duration = sum(self.item.cache['durations'])
|
||||
else:
|
||||
path = stream.media.path
|
||||
duration = stream.info['duration']
|
||||
|
|
|
@ -16,12 +16,14 @@ from wsgiref.util import FileWrapper
|
|||
from django.conf import settings
|
||||
|
||||
from ox.utils import json, ET
|
||||
|
||||
from oxdjango.decorators import login_required_json
|
||||
from oxdjango.shortcuts import render_to_json_response, get_object_or_404_json, json_response
|
||||
from oxdjango.http import HttpFileResponse
|
||||
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 . import models
|
||||
from . import utils
|
||||
from . import tasks
|
||||
|
@ -32,7 +34,6 @@ 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__'):
|
||||
|
@ -595,7 +596,7 @@ def add(request, data):
|
|||
if p:
|
||||
p.wait()
|
||||
else:
|
||||
i.make_poster()
|
||||
item.make_poster()
|
||||
del data['title']
|
||||
if data:
|
||||
response = edit_item(request.user, item, data)
|
||||
|
|
|
@ -11,7 +11,7 @@ keymap = {
|
|||
default_key = 'name'
|
||||
|
||||
def parseCondition(condition, user):
|
||||
k = condition.get('key', defauly_key)
|
||||
k = condition.get('key', default_key)
|
||||
k = keymap.get(k, k)
|
||||
if not k:
|
||||
k = default_key
|
||||
|
|
Loading…
Reference in a new issue