forked from 0x2620/pandora
flag group facets, better main movie filter
This commit is contained in:
parent
33725ff9d4
commit
86c5e3cc6a
1 changed files with 22 additions and 9 deletions
|
@ -75,17 +75,17 @@ class Bin(models.Model):
|
||||||
|
|
||||||
properties = {
|
properties = {
|
||||||
'title': {'type': 'string', 'sort': 'title', 'find': True},
|
'title': {'type': 'string', 'sort': 'title', 'find': True},
|
||||||
'director': {'type': 'person', 'array': True, 'sort': 'string', 'find': True},
|
'director': {'type': 'person', 'array': True, 'sort': 'string', 'find': True, 'group': True},
|
||||||
'country': {'type': 'string', 'array': True, 'sort': 'sring', 'find': True},
|
'country': {'type': 'string', 'array': True, 'sort': 'sring', 'find': True, 'group': True},
|
||||||
'year': {'type': 'string', 'sort': 'string', 'find': True},
|
'year': {'type': 'string', 'sort': 'string', 'find': True, 'group': True},
|
||||||
'language': {'type': 'string', 'array': True, 'sort': 'string', 'find': True},
|
'language': {'type': 'string', 'array': True, 'sort': 'string', 'find': True, 'group': True},
|
||||||
'runtime': {'type': 'integer', 'sort': 'integer'},
|
'runtime': {'type': 'integer', 'sort': 'integer'},
|
||||||
'writer': {'type': 'person', 'array': True, 'sort': 'string', 'find': True},
|
'writer': {'type': 'person', 'array': True, 'sort': 'string', 'find': True},
|
||||||
'producer': {'type': 'person', 'array': True, 'sort': 'string', 'find': True},
|
'producer': {'type': 'person', 'array': True, 'sort': 'string', 'find': True},
|
||||||
'cinematographer': {'type': 'person', 'array': True, 'sort': 'string', 'find': True},
|
'cinematographer': {'type': 'person', 'array': True, 'sort': 'string', 'find': True},
|
||||||
'editor': {'type': 'person', 'array': True, 'sort': 'string', 'find': True},
|
'editor': {'type': 'person', 'array': True, 'sort': 'string', 'find': True},
|
||||||
'actors': {'type': 'role', 'array': True, 'sort': 'length', 'find': True},
|
'actors': {'type': 'role', 'array': True, 'sort': 'length', 'find': True},
|
||||||
'genre': {'type': 'string', 'array': True, 'sort': 'length', 'find': True},
|
'genre': {'type': 'string', 'array': True, 'sort': 'length', 'find': True, 'group': True},
|
||||||
'keywords': {'type': 'string', 'array': True, 'sort': 'length', 'find': True},
|
'keywords': {'type': 'string', 'array': True, 'sort': 'length', 'find': True},
|
||||||
'summary': {'type': 'title', 'sort': 'length', 'find': True},
|
'summary': {'type': 'title', 'sort': 'length', 'find': True},
|
||||||
'trivia': {'type': 'title', 'sort': 'length', 'find': True},
|
'trivia': {'type': 'title', 'sort': 'length', 'find': True},
|
||||||
|
@ -135,7 +135,7 @@ def siteJson():
|
||||||
if i.get('autocomplete', False):
|
if i.get('autocomplete', False):
|
||||||
f['autocomplete'] = True
|
f['autocomplete'] = True
|
||||||
r['findKeys'].append(f)
|
r['findKeys'].append(f)
|
||||||
r['groups'] = filter(lambda k: 'array' in properties[k], properties.keys())
|
r['groups'] = filter(lambda k: properties[k].get('group', False), properties.keys())
|
||||||
r['itemViews'] = [
|
r['itemViews'] = [
|
||||||
{"id": "info", "title": "Info"},
|
{"id": "info", "title": "Info"},
|
||||||
{"id": "statistics", "title": "Statistics"},
|
{"id": "statistics", "title": "Statistics"},
|
||||||
|
@ -204,7 +204,7 @@ def siteJson():
|
||||||
"itemView": "info",
|
"itemView": "info",
|
||||||
"listQuery": {"conditions": [], "operator": ""},
|
"listQuery": {"conditions": [], "operator": ""},
|
||||||
"listsSize": 192,
|
"listsSize": 192,
|
||||||
"listView": "list",
|
"listView": "icons",
|
||||||
"sections": ["history", "lists", "public", "featured"],
|
"sections": ["history", "lists", "public", "featured"],
|
||||||
"showGroups": True,
|
"showGroups": True,
|
||||||
"showInfo": True,
|
"showInfo": True,
|
||||||
|
@ -655,7 +655,18 @@ class Item(models.Model):
|
||||||
|
|
||||||
def main_videos(self):
|
def main_videos(self):
|
||||||
#FIXME: needs to check if more than one user has main files and only take from "higher" user
|
#FIXME: needs to check if more than one user has main files and only take from "higher" user
|
||||||
return self.files.filter(is_main=True, is_video=True, available=True)
|
videos = self.files.filter(is_main=True, is_video=True, available=True)
|
||||||
|
if videos.count()>0:
|
||||||
|
first = videos[0]
|
||||||
|
user = first.instances.all()[0].volume.user
|
||||||
|
#only take videos from same user and with same width/height
|
||||||
|
def check(v):
|
||||||
|
if v.instances.filter(volume__user=user).count()>0 and \
|
||||||
|
first.width == v.width and first.height == v.height:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
videos = filter(check, videos)
|
||||||
|
return videos
|
||||||
|
|
||||||
def updateStreams(self):
|
def updateStreams(self):
|
||||||
files = {}
|
files = {}
|
||||||
|
@ -667,14 +678,16 @@ class Item(models.Model):
|
||||||
stream, created = Stream.objects.get_or_create(item=self, profile='%s.webm' % settings.VIDEO_PROFILE)
|
stream, created = Stream.objects.get_or_create(item=self, profile='%s.webm' % settings.VIDEO_PROFILE)
|
||||||
stream.video.name = stream_path(stream)
|
stream.video.name = stream_path(stream)
|
||||||
cmd = []
|
cmd = []
|
||||||
|
print files
|
||||||
for f in sorted(files):
|
for f in sorted(files):
|
||||||
cmd.append('+')
|
cmd.append('+')
|
||||||
cmd.append(files[f])
|
cmd.append(files[f])
|
||||||
if not os.path.exists(os.path.dirname(stream.video.path)):
|
if not os.path.exists(os.path.dirname(stream.video.path)):
|
||||||
os.makedirs(os.path.dirname(stream.video.path))
|
os.makedirs(os.path.dirname(stream.video.path))
|
||||||
cmd = [ 'mkvmerge', '-o', stream.video.path ] + cmd[1:]
|
cmd = [ 'mkvmerge', '-o', stream.video.path ] + cmd[1:]
|
||||||
|
#print cmd
|
||||||
p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
|
#p = subprocess.Popen(cmd, stdin=subprocess.PIPE)
|
||||||
p.wait()
|
p.wait()
|
||||||
stream.save()
|
stream.save()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue