Merge remote branch 'joar/b681-comments_from_reviewing_video'
* joar/b681-comments_from_reviewing_video: Bug 681 - Comments from reviewing the new video merge
This commit is contained in:
commit
8d52214f1e
@ -30,7 +30,7 @@ class InvalidFileType(Exception):
|
|||||||
|
|
||||||
def get_media_types():
|
def get_media_types():
|
||||||
"""
|
"""
|
||||||
Generator that returns the available media types
|
Generator, yields the available media types
|
||||||
"""
|
"""
|
||||||
for media_type in mg_globals.app_config['media_types']:
|
for media_type in mg_globals.app_config['media_types']:
|
||||||
yield media_type
|
yield media_type
|
||||||
@ -38,7 +38,7 @@ def get_media_types():
|
|||||||
|
|
||||||
def get_media_managers():
|
def get_media_managers():
|
||||||
'''
|
'''
|
||||||
Generator that returns all available media managers
|
Generator, yields all enabled media managers
|
||||||
'''
|
'''
|
||||||
for media_type in get_media_types():
|
for media_type in get_media_types():
|
||||||
__import__(media_type)
|
__import__(media_type)
|
||||||
@ -46,7 +46,16 @@ def get_media_managers():
|
|||||||
yield media_type, sys.modules[media_type].MEDIA_MANAGER
|
yield media_type, sys.modules[media_type].MEDIA_MANAGER
|
||||||
|
|
||||||
|
|
||||||
def get_media_manager(_media_type = None):
|
def get_media_manager(_media_type):
|
||||||
|
'''
|
||||||
|
Get the MEDIA_MANAGER based on a media type string
|
||||||
|
|
||||||
|
Example::
|
||||||
|
get_media_type('mediagoblin.media_types.image')
|
||||||
|
'''
|
||||||
|
if not _media_type:
|
||||||
|
return False
|
||||||
|
|
||||||
for media_type, manager in get_media_managers():
|
for media_type, manager in get_media_managers():
|
||||||
if media_type in _media_type:
|
if media_type in _media_type:
|
||||||
return manager
|
return manager
|
||||||
@ -57,13 +66,19 @@ def get_media_manager(_media_type = None):
|
|||||||
|
|
||||||
|
|
||||||
def get_media_type_and_manager(filename):
|
def get_media_type_and_manager(filename):
|
||||||
|
'''
|
||||||
|
Get the media type and manager based on a filename
|
||||||
|
'''
|
||||||
for media_type, manager in get_media_managers():
|
for media_type, manager in get_media_managers():
|
||||||
if filename.find('.') > 0:
|
if filename.find('.') > 0:
|
||||||
|
# Get the file extension
|
||||||
ext = os.path.splitext(filename)[1].lower()
|
ext = os.path.splitext(filename)[1].lower()
|
||||||
else:
|
else:
|
||||||
raise InvalidFileType(
|
raise InvalidFileType(
|
||||||
_('Could not find any file extension in "{filename}"').format(
|
_('Could not find any file extension in "{filename}"').format(
|
||||||
filename=filename))
|
filename=filename))
|
||||||
|
|
||||||
|
# Omit the dot from the extension and match it against
|
||||||
|
# the media manager
|
||||||
if ext[1:] in manager['accepted_extensions']:
|
if ext[1:] in manager['accepted_extensions']:
|
||||||
return media_type, manager
|
return media_type, manager
|
||||||
|
@ -17,15 +17,10 @@
|
|||||||
import Image
|
import Image
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from celery.task import Task
|
|
||||||
from celery import registry
|
|
||||||
|
|
||||||
from mediagoblin.db.util import ObjectId
|
|
||||||
from mediagoblin import mg_globals as mgg
|
from mediagoblin import mg_globals as mgg
|
||||||
|
|
||||||
from mediagoblin.processing import BaseProcessingFail, \
|
from mediagoblin.processing import BadMediaFail, \
|
||||||
mark_entry_failed, BadMediaFail, create_pub_filepath, THUMB_SIZE, \
|
create_pub_filepath, THUMB_SIZE, MEDIUM_SIZE
|
||||||
MEDIUM_SIZE
|
|
||||||
|
|
||||||
################################
|
################################
|
||||||
# Media processing initial steps
|
# Media processing initial steps
|
||||||
|
@ -74,14 +74,14 @@ class VideoThumbnailer:
|
|||||||
|
|
||||||
buffer_probes = {}
|
buffer_probes = {}
|
||||||
|
|
||||||
errors = []
|
|
||||||
|
|
||||||
def __init__(self, source_path, dest_path):
|
def __init__(self, source_path, dest_path):
|
||||||
'''
|
'''
|
||||||
Set up playbin pipeline in order to get video properties.
|
Set up playbin pipeline in order to get video properties.
|
||||||
|
|
||||||
Initializes and runs the gobject.MainLoop()
|
Initializes and runs the gobject.MainLoop()
|
||||||
'''
|
'''
|
||||||
|
self.errors = []
|
||||||
|
|
||||||
self.source_path = source_path
|
self.source_path = source_path
|
||||||
self.dest_path = dest_path
|
self.dest_path = dest_path
|
||||||
|
|
||||||
|
@ -14,14 +14,11 @@
|
|||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import sys
|
|
||||||
|
|
||||||
from mediagoblin import mg_globals
|
from mediagoblin import mg_globals
|
||||||
from mediagoblin.tools.pagination import Pagination
|
from mediagoblin.tools.pagination import Pagination
|
||||||
from mediagoblin.tools.response import render_to_response
|
from mediagoblin.tools.response import render_to_response
|
||||||
from mediagoblin.db.util import DESCENDING
|
from mediagoblin.db.util import DESCENDING
|
||||||
from mediagoblin.decorators import uses_pagination
|
from mediagoblin.decorators import uses_pagination
|
||||||
from mediagoblin import media_types
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -36,8 +33,7 @@ def root_view(request, page):
|
|||||||
request, 'mediagoblin/root.html',
|
request, 'mediagoblin/root.html',
|
||||||
{'media_entries': media_entries,
|
{'media_entries': media_entries,
|
||||||
'allow_registration': mg_globals.app_config["allow_registration"],
|
'allow_registration': mg_globals.app_config["allow_registration"],
|
||||||
'pagination': pagination,
|
'pagination': pagination})
|
||||||
'sys': sys})
|
|
||||||
|
|
||||||
|
|
||||||
def simple_template_render(request):
|
def simple_template_render(request):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user