Dot-Notation for MediaEntry.media_files
This commit is contained in:
parent
010fe2d71b
commit
228c4470f4
@ -65,7 +65,7 @@ def _import_media(db, args):
|
|||||||
args._cache_path['queue'])
|
args._cache_path['queue'])
|
||||||
|
|
||||||
for entry in db.MediaEntry.find():
|
for entry in db.MediaEntry.find():
|
||||||
for name, path in entry['media_files'].items():
|
for name, path in entry.media_files.items():
|
||||||
_log.info('Importing: {0} - {1}'.format(
|
_log.info('Importing: {0} - {1}'.format(
|
||||||
entry.title,
|
entry.title,
|
||||||
name))
|
name))
|
||||||
@ -207,7 +207,7 @@ def _export_media(db, args):
|
|||||||
args._cache_path['queue'])
|
args._cache_path['queue'])
|
||||||
|
|
||||||
for entry in db.MediaEntry.find():
|
for entry in db.MediaEntry.find():
|
||||||
for name, path in entry['media_files'].items():
|
for name, path in entry.media_files.items():
|
||||||
_log.info(u'Exporting {0} - {1}'.format(
|
_log.info(u'Exporting {0} - {1}'.format(
|
||||||
entry.title,
|
entry.title,
|
||||||
name))
|
name))
|
||||||
|
@ -74,7 +74,7 @@ def process_video(entry):
|
|||||||
tmp_dst.read())
|
tmp_dst.read())
|
||||||
_log.debug('Saved medium')
|
_log.debug('Saved medium')
|
||||||
|
|
||||||
entry['media_files']['webm_640'] = medium_filepath
|
entry.media_files['webm_640'] = medium_filepath
|
||||||
|
|
||||||
# Save the width and height of the transcoded video
|
# Save the width and height of the transcoded video
|
||||||
entry.media_data['video'] = {
|
entry.media_data['video'] = {
|
||||||
@ -94,7 +94,7 @@ def process_video(entry):
|
|||||||
tmp_thumb.read())
|
tmp_thumb.read())
|
||||||
_log.debug('Saved thumbnail')
|
_log.debug('Saved thumbnail')
|
||||||
|
|
||||||
entry['media_files']['thumb'] = thumbnail_filepath
|
entry.media_files['thumb'] = thumbnail_filepath
|
||||||
|
|
||||||
if video_config['keep_original']:
|
if video_config['keep_original']:
|
||||||
# Push original file to public storage
|
# Push original file to public storage
|
||||||
@ -111,7 +111,7 @@ def process_video(entry):
|
|||||||
original_file.write(queued_file.read())
|
original_file.write(queued_file.read())
|
||||||
_log.debug('Saved original')
|
_log.debug('Saved original')
|
||||||
|
|
||||||
entry['media_files']['original'] = original_filepath
|
entry.media_files['original'] = original_filepath
|
||||||
|
|
||||||
mgg.queue_store.delete_file(queued_filepath)
|
mgg.queue_store.delete_file(queued_filepath)
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
<h1>Editing attachments for {{ media.title }}</h1>
|
<h1>Editing attachments for {{ media.title }}</h1>
|
||||||
<div style="text-align: center;" >
|
<div style="text-align: center;" >
|
||||||
<img src="{{ request.app.public_store.file_url(
|
<img src="{{ request.app.public_store.file_url(
|
||||||
media['media_files']['thumb']) }}" />
|
media.media_files['thumb']) }}" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if media.attachment_files|count %}
|
{% if media.attachment_files|count %}
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
<h1>{% trans media_title=media.title %}Editing {{ media_title }}{% endtrans %}</h1>
|
<h1>{% trans media_title=media.title %}Editing {{ media_title }}{% endtrans %}</h1>
|
||||||
<div style="text-align: center;" >
|
<div style="text-align: center;" >
|
||||||
<img src="{{ request.app.public_store.file_url(
|
<img src="{{ request.app.public_store.file_url(
|
||||||
media['media_files']['thumb']) }}" />
|
media.media_files['thumb']) }}" />
|
||||||
</div>
|
</div>
|
||||||
{{ wtforms_util.render_divs(form) }}
|
{{ wtforms_util.render_divs(form) }}
|
||||||
<div class="form_submit_buttons">
|
<div class="form_submit_buttons">
|
||||||
|
@ -23,14 +23,14 @@
|
|||||||
<pre>
|
<pre>
|
||||||
{%- autoescape False -%}
|
{%- autoescape False -%}
|
||||||
{{- request.app.public_store.get_file(
|
{{- request.app.public_store.get_file(
|
||||||
media['media_files']['unicode']).read()|string -}}
|
media.media_files['unicode']).read()|string -}}
|
||||||
{%- endautoescape -%}
|
{%- endautoescape -%}
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
{% if 'original' in media.media_files %}
|
{% if 'original' in media.media_files %}
|
||||||
<p>
|
<p>
|
||||||
<a href="{{ request.app.public_store.file_url(
|
<a href="{{ request.app.public_store.file_url(
|
||||||
media['media_files']['original']) }}">
|
media.media_files['original']) }}">
|
||||||
{%- trans -%}
|
{%- trans -%}
|
||||||
Original
|
Original
|
||||||
{%- endtrans -%}
|
{%- endtrans -%}
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
preload="auto"
|
preload="auto"
|
||||||
data-setup="">
|
data-setup="">
|
||||||
<source src="{{ request.app.public_store.file_url(
|
<source src="{{ request.app.public_store.file_url(
|
||||||
media['media_files']['webm_640']) }}"
|
media.media_files['webm_640']) }}"
|
||||||
type="video/webm; codecs="vp8, vorbis"" />
|
type="video/webm; codecs="vp8, vorbis"" />
|
||||||
<div class="no_html5">
|
<div class="no_html5">
|
||||||
{%- trans -%}Sorry, this video will not work because
|
{%- trans -%}Sorry, this video will not work because
|
||||||
@ -42,7 +42,7 @@
|
|||||||
{% if 'original' in media.media_files %}
|
{% if 'original' in media.media_files %}
|
||||||
<p>
|
<p>
|
||||||
<a href="{{ request.app.public_store.file_url(
|
<a href="{{ request.app.public_store.file_url(
|
||||||
media['media_files']['original']) }}">
|
media.media_files['original']) }}">
|
||||||
{%- trans -%}
|
{%- trans -%}
|
||||||
Original
|
Original
|
||||||
{%- endtrans -%}
|
{%- endtrans -%}
|
||||||
|
@ -36,9 +36,9 @@
|
|||||||
{# if there's a medium file size, that means the medium size
|
{# if there's a medium file size, that means the medium size
|
||||||
# isn't the original... so link to the original!
|
# isn't the original... so link to the original!
|
||||||
#}
|
#}
|
||||||
{% if media['media_files'].has_key('medium') %}
|
{% if media.media_files.has_key('medium') %}
|
||||||
<a href="{{ request.app.public_store.file_url(
|
<a href="{{ request.app.public_store.file_url(
|
||||||
media['media_files']['original']) }}">
|
media.media_files['original']) }}">
|
||||||
<img class="media_image"
|
<img class="media_image"
|
||||||
src="{{ display_media }}"
|
src="{{ display_media }}"
|
||||||
alt="Image for {{ media.title }}" />
|
alt="Image for {{ media.title }}" />
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
<div style="text-align: center;" >
|
<div style="text-align: center;" >
|
||||||
<img src="{{ request.app.public_store.file_url(
|
<img src="{{ request.app.public_store.file_url(
|
||||||
media['media_files']['thumb']) }}" />
|
media.media_files['thumb']) }}" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
{%- elif loop.last %} thumb_entry_last{% endif %}">
|
{%- elif loop.last %} thumb_entry_last{% endif %}">
|
||||||
<a href="{{ entry_url }}">
|
<a href="{{ entry_url }}">
|
||||||
<img src="{{ request.app.public_store.file_url(
|
<img src="{{ request.app.public_store.file_url(
|
||||||
entry['media_files']['thumb']) }}" />
|
entry.media_files['thumb']) }}" />
|
||||||
</a>
|
</a>
|
||||||
{% if entry.title %}
|
{% if entry.title %}
|
||||||
<br />
|
<br />
|
||||||
|
@ -23,7 +23,7 @@ def delete_media_files(media):
|
|||||||
Arguments:
|
Arguments:
|
||||||
- media: A MediaEntry document
|
- media: A MediaEntry document
|
||||||
"""
|
"""
|
||||||
for listpath in media['media_files'].itervalues():
|
for listpath in media.media_files.itervalues():
|
||||||
mg_globals.public_store.delete_file(
|
mg_globals.public_store.delete_file(
|
||||||
listpath)
|
listpath)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user