Skip to content

Commit

Permalink
fix auto result mime_type, fix admin task list
Browse files Browse the repository at this point in the history
  • Loading branch information
yomguy committed Mar 3, 2015
1 parent c94fca5 commit 0722593
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion timeside/server/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@


class TaskAdmin(admin.ModelAdmin):
list_display = ['date_added', 'date_modified', 'status']
model = Task
list_display = ['__unicode__', 'date_added', 'date_modified', 'status']
list_filter = ['date_modified', 'status']


Expand Down
6 changes: 6 additions & 0 deletions timeside/server/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,10 @@ def status_setter(self, status):
self.status = status
self.save()

def mime_type_setter(self, mime_type):
self.mime_type = mime_type
self.save()

def __unicode__(self):
return '_'.join([self.item.title, unicode(self.preset.processor)])

Expand Down Expand Up @@ -299,9 +303,11 @@ def post_run(self, item, presets):
image_file = str(result.uuid) + '.png'
result.file = os.path.join(item_path, image_file)
proc.render(output=result.file.path)
result.mime_type_setter(get_mime_type(result.file.path))
result.status_setter(_DONE)
elif proc.type == 'encoder':
result = Result.objects.get(preset=preset, item=item)
result.mime_type_setter(get_mime_type(result.file.path))
result.status_setter(_DONE)
del proc

Expand Down
2 changes: 1 addition & 1 deletion timeside/server/templates/timeside/item_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ <h1>{{ object.title }}</h1>

<ul>
{% for result in object.results.all %}
<li><a href="{% if 'image' in result.mime_type %}{% url "timeside-result-png" result.id %}{% elif 'audio' in result.mime_type %}{% url "timeside-result-audio" result.id %}{% else %}{% url "timeside-result-json" result.id %}{% endif %}">{{ result }}</a> ({{ result.uuid }})</li>
<li><a href="{% if 'image' in result.mime_type %}{% url "timeside-result-png" result.id %}{% elif 'audio' in result.mime_type %}{% url "timeside-result-audio" result.id %}{% else %}{% url "timeside-result-json" result.id %}{% endif %}">{{ result }}</a> ({{ result.uuid }} {{ result.hdf5 }})</li>
{% endfor %}
<ul>

Expand Down

0 comments on commit 0722593

Please sign in to comment.