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():
|
def init():
|
||||||
load_config(True)
|
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 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import os
|
from distutils.spawn import find_executable
|
||||||
|
from glob import glob
|
||||||
from os.path import exists
|
from os.path import exists
|
||||||
import fractions
|
import fractions
|
||||||
|
import logging
|
||||||
import math
|
import math
|
||||||
|
import os
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
import time
|
import time
|
||||||
from distutils.spawn import find_executable
|
|
||||||
from glob import glob
|
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import ox
|
import ox
|
||||||
|
@ -21,6 +22,9 @@ from PIL import Image
|
||||||
|
|
||||||
from .chop import Chop, make_keyframe_index
|
from .chop import Chop, make_keyframe_index
|
||||||
|
|
||||||
|
|
||||||
|
logger = logging.getLogger('pandora.' + __name__)
|
||||||
|
|
||||||
img_extension = 'jpg'
|
img_extension = 'jpg'
|
||||||
|
|
||||||
MAX_DISTANCE = math.sqrt(3 * pow(255, 2))
|
MAX_DISTANCE = math.sqrt(3 * pow(255, 2))
|
||||||
|
|
|
@ -832,7 +832,7 @@ class Stream(models.Model):
|
||||||
# get current version from db and update
|
# get current version from db and update
|
||||||
try:
|
try:
|
||||||
self.refresh_from_db()
|
self.refresh_from_db()
|
||||||
except archive.models.DoesNotExist:
|
except Stream.DoesNotExist:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
self.update_status(ok, error)
|
self.update_status(ok, error)
|
||||||
|
|
|
@ -65,7 +65,7 @@ def fill_queue():
|
||||||
def get_celery_worker_status():
|
def get_celery_worker_status():
|
||||||
ERROR_KEY = "ERROR"
|
ERROR_KEY = "ERROR"
|
||||||
try:
|
try:
|
||||||
insp = celery.task.control.inspect()
|
insp = app.control.inspect()
|
||||||
d = insp.stats()
|
d = insp.stats()
|
||||||
if not d:
|
if not d:
|
||||||
d = {ERROR_KEY: 'No running Celery workers were found.'}
|
d = {ERROR_KEY: 'No running Celery workers were found.'}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from datetime import datetime
|
||||||
import unicodedata
|
import unicodedata
|
||||||
|
|
||||||
from django.db.models import Q, Manager
|
from django.db.models import Q, Manager
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from datetime import datetime
|
||||||
import unicodedata
|
import unicodedata
|
||||||
|
|
||||||
from six import string_types
|
from six import string_types
|
||||||
|
|
|
@ -6,11 +6,12 @@ import os
|
||||||
import re
|
import re
|
||||||
import unicodedata
|
import unicodedata
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
from django.contrib.auth import get_user_model
|
||||||
from django.db import models, transaction
|
from django.db import models, transaction
|
||||||
from django.db.models import Q, Sum, Max
|
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.db.models.signals import pre_delete
|
||||||
from django.conf import settings
|
from django.utils import datetime_safe
|
||||||
from oxdjango.fields import JSONField
|
from oxdjango.fields import JSONField
|
||||||
|
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
@ -79,7 +80,7 @@ class Document(models.Model, FulltextMixin):
|
||||||
current_values = []
|
current_values = []
|
||||||
for k in settings.CONFIG['documentKeys']:
|
for k in settings.CONFIG['documentKeys']:
|
||||||
if k.get('sortType') == 'person':
|
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 isinstance(current_values, list):
|
||||||
if not current_values:
|
if not current_values:
|
||||||
current_values = []
|
current_values = []
|
||||||
|
|
|
@ -60,6 +60,25 @@ def _order_query(qs, sort):
|
||||||
qs = qs.distinct()
|
qs = qs.distinct()
|
||||||
return qs
|
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):
|
def findPages(request, data):
|
||||||
'''
|
'''
|
||||||
|
|
|
@ -3,14 +3,16 @@
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
import ox
|
from oxdjango.api import actions
|
||||||
from oxdjango.decorators import login_required_json
|
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
|
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 import transaction
|
||||||
from django.db.models import Max
|
from django.db.models import Max
|
||||||
from oxdjango.http import HttpFileResponse
|
from django.db.models import Sum
|
||||||
from oxdjango.api import actions
|
|
||||||
from django.conf import settings
|
|
||||||
|
|
||||||
from item import utils
|
from item import utils
|
||||||
from changelog.models import add_changelog
|
from changelog.models import add_changelog
|
||||||
|
|
|
@ -1209,7 +1209,7 @@ class Item(models.Model):
|
||||||
if not r:
|
if not r:
|
||||||
return False
|
return False
|
||||||
path = video.name
|
path = video.name
|
||||||
duration = sum(item.cache['durations'])
|
duration = sum(self.item.cache['durations'])
|
||||||
else:
|
else:
|
||||||
path = stream.media.path
|
path = stream.media.path
|
||||||
duration = stream.info['duration']
|
duration = stream.info['duration']
|
||||||
|
|
|
@ -16,12 +16,14 @@ from wsgiref.util import FileWrapper
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
from ox.utils import json, ET
|
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
|
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 models
|
||||||
from . import utils
|
from . import utils
|
||||||
from . import tasks
|
from . import tasks
|
||||||
|
@ -32,7 +34,6 @@ from clip.models import Clip
|
||||||
from user.models import has_capability
|
from user.models import has_capability
|
||||||
from changelog.models import add_changelog
|
from changelog.models import add_changelog
|
||||||
|
|
||||||
from oxdjango.api import actions
|
|
||||||
|
|
||||||
|
|
||||||
def _order_query(qs, sort, prefix='sort__'):
|
def _order_query(qs, sort, prefix='sort__'):
|
||||||
|
@ -595,7 +596,7 @@ def add(request, data):
|
||||||
if p:
|
if p:
|
||||||
p.wait()
|
p.wait()
|
||||||
else:
|
else:
|
||||||
i.make_poster()
|
item.make_poster()
|
||||||
del data['title']
|
del data['title']
|
||||||
if data:
|
if data:
|
||||||
response = edit_item(request.user, item, data)
|
response = edit_item(request.user, item, data)
|
||||||
|
|
|
@ -11,7 +11,7 @@ keymap = {
|
||||||
default_key = 'name'
|
default_key = 'name'
|
||||||
|
|
||||||
def parseCondition(condition, user):
|
def parseCondition(condition, user):
|
||||||
k = condition.get('key', defauly_key)
|
k = condition.get('key', default_key)
|
||||||
k = keymap.get(k, k)
|
k = keymap.get(k, k)
|
||||||
if not k:
|
if not k:
|
||||||
k = default_key
|
k = default_key
|
||||||
|
|
Loading…
Reference in a new issue