From 93bdab9daad3ae431afd41a2efaefae05a555d88 Mon Sep 17 00:00:00 2001
From: Joar Wandborg
+ {% trans %}Don't have an account yet?{% endtrans %}
+ {%- trans %}Create one here!{% endtrans %}
+
+
+ {% trans %}Forgot your password?{% endtrans %}
+
- {% trans %}Don't have an account yet?{% endtrans %}
-
- {% trans %}Forgot your password?{% endtrans %}
- {% trans %}In case it doesn't:{% endtrans %}
+
+ {% else %}
-
- {% else %}
-
- {% endif %}
+ {% endif %}
+ {% endblock %}
diff --git a/mediagoblin/user_pages/views.py b/mediagoblin/user_pages/views.py
index 6a82d718..5458c694 100644
--- a/mediagoblin/user_pages/views.py
+++ b/mediagoblin/user_pages/views.py
@@ -29,6 +29,8 @@ from mediagoblin.decorators import (uses_pagination, get_user_media_entry,
from werkzeug.contrib.atom import AtomFeed
+from mediagoblin.media_types import get_media_manager
+
@uses_pagination
def user_home(request, page):
@@ -113,9 +115,11 @@ def media_home(request, media, page, **kwargs):
comment_form = user_forms.MediaCommentForm(request.POST)
+ media_template_name = get_media_manager(media['media_type'])['display_template']
+
return render_to_response(
request,
- 'mediagoblin/user_pages/media.html',
+ media_template_name,
{'media': media,
'comments': comments,
'pagination': pagination,
From 1f255101f54579760f2238d70dd3aa0b3cd4ba92 Mon Sep 17 00:00:00 2001
From: Joar Wandborg
Vj0J)T9zL_yidFLWk
z66Y8~=|}&A71)N)3lA2~x(D(48>*!}VL#K;Nun2`D#=^t7v?E)Je51Ed)ZPHk8Xm&
z0(VEx6BqJyR0Pyc2#dGbH3b9q&wEP;
-
- {%- trans %}Create one here!{% endtrans %}
-
-
- {%- trans %}Change it!{% endtrans %}
- {% trans %}Forgot your password?{% endtrans %}
+ {% trans %}Recover password{% endtrans %}
{{ wtforms_util.render_divs(fp_form) }}
@@ -147,7 +147,7 @@
This is where your media will appear, but you don't seem to have added anything yet.
{%- endtrans %}
-
{%- trans %}Add media{% endtrans -%}
From 5ab3855e1f8fd94058ccea76ef2d5a1d795cc93a Mon Sep 17 00:00:00 2001
From: Jef van Schendel Tags
-
+
{% set edit_url = request.urlgen('mediagoblin.edit.edit_media',
user= media.uploader().username,
media= media._id) %}
-
- {% trans %}edit{% endtrans %}
+ {% trans %}Edit{% endtrans %}
{% set delete_url = request.urlgen('mediagoblin.user_pages.media_confirm_delete',
user= media.uploader().username,
media= media._id) %}
-
- {% trans %}delete{% endtrans %}
+ {% trans %}Delete{% endtrans %}
{% trans %}Tagged with{% endtrans %}
{% for tag in media.tags %}
{% if loop.last %}
- {% trans %}and{% endtrans %} {{ tag['name'] }}.
{% elif loop.revindex==2 %}
From a00f1c1e1cecb8f127b6a064e2cd90c8f613660d Mon Sep 17 00:00:00 2001
From: Jakob Kramer {% trans %}Tagged with{% endtrans %}
{% for tag in media.tags %}
{% if loop.last %}
+ {# the 'and' should only appear if there is more than one tag #}
{% if media.tags|length > 1 %}
- {% trans %}and{% endtrans %}
+ {% trans %}and{% endtrans %}
{% endif %}
- {{ tag['name'] }}.
- {% elif loop.revindex==2 %}
- {{ tag['name'] }}
- {% else %}{{ tag['name'] }},
+
+ {{ tag['name'] }}.
+ {% elif loop.revindex==2 %}
+ {{ tag['name'] }}
+ {% else %}{{ tag['name'] }},
{% endif %}
{% endfor %}
{% trans %}Actions{% endtrans %}
@@ -151,7 +151,7 @@ {% endif %} {% if app_config['allow_attachments'] - and (media['uploader'] == request.user['_id'] + and (media['uploader'] == request.user._id or request.user['is_admin']) %}
{% trans %}Here's a spot to tell others about yourself.{% endtrans %} @@ -113,7 +113,7 @@ {% else %}
{% trans -%} diff --git a/mediagoblin/tests/test_auth.py b/mediagoblin/tests/test_auth.py index 40961eca..153c6e53 100644 --- a/mediagoblin/tests/test_auth.py +++ b/mediagoblin/tests/test_auth.py @@ -168,7 +168,7 @@ def test_register_views(test_app): ## Make sure user is logged in request = template.TEMPLATE_TEST_CONTEXT[ 'mediagoblin/user_pages/user.html']['request'] - assert request.session['user_id'] == unicode(new_user['_id']) + assert request.session['user_id'] == unicode(new_user._id) ## Make sure we get email confirmation, and try verifying assert len(mail.EMAIL_TEST_INBOX) == 1 @@ -185,7 +185,7 @@ def test_register_views(test_app): ### user should have these same parameters assert parsed_get_params['userid'] == [ - unicode(new_user['_id'])] + unicode(new_user._id)] assert parsed_get_params['token'] == [ new_user['verification_key']] @@ -193,7 +193,7 @@ def test_register_views(test_app): template.clear_test_template_context() response = test_app.get( "/auth/verify_email/?userid=%s&token=total_bs" % unicode( - new_user['_id'])) + new_user._id)) response.follow() context = template.TEMPLATE_TEST_CONTEXT[ 'mediagoblin/user_pages/user.html'] @@ -269,7 +269,7 @@ def test_register_views(test_app): # user should have matching parameters new_user = mg_globals.database.User.find_one({'username': 'happygirl'}) - assert parsed_get_params['userid'] == [unicode(new_user['_id'])] + assert parsed_get_params['userid'] == [unicode(new_user._id)] assert parsed_get_params['token'] == [new_user['fp_verification_key']] ### The forgotten password token should be set to expire in ~ 10 days @@ -280,7 +280,7 @@ def test_register_views(test_app): template.clear_test_template_context() response = test_app.get( "/auth/forgot_password/verify/?userid=%s&token=total_bs" % unicode( - new_user['_id']), status=400) + new_user._id), status=400) assert response.status == '400 Bad Request' ## Try using an expired token to change password, shouldn't work @@ -412,7 +412,7 @@ def test_authentication_views(test_app): # Make sure user is in the session context = template.TEMPLATE_TEST_CONTEXT['mediagoblin/root.html'] session = context['request'].session - assert session['user_id'] == unicode(test_user['_id']) + assert session['user_id'] == unicode(test_user._id) # Successful logout # ----------------- diff --git a/mediagoblin/tests/test_submission.py b/mediagoblin/tests/test_submission.py index 1c657e6c..dec7118b 100644 --- a/mediagoblin/tests/test_submission.py +++ b/mediagoblin/tests/test_submission.py @@ -177,7 +177,7 @@ class TestSubmission: request.urlgen('mediagoblin.user_pages.media_confirm_delete', # No work: user=media.uploader().username, user=self.test_user['username'], - media=media['_id']), + media=media._id), # no value means no confirm {}) @@ -197,7 +197,7 @@ class TestSubmission: request.urlgen('mediagoblin.user_pages.media_confirm_delete', # No work: user=media.uploader().username, user=self.test_user['username'], - media=media['_id']), + media=media._id), {'confirm': 'y'}) response.follow() @@ -208,7 +208,7 @@ class TestSubmission: # Does media entry still exist? assert_false( request.db.MediaEntry.find( - {'_id': media['_id']}).count()) + {'_id': media._id}).count()) def test_malicious_uploads(self): # Test non-suppoerted file with non-supported extension diff --git a/mediagoblin/tools/pagination.py b/mediagoblin/tools/pagination.py index bc20ec90..5ebc3c5a 100644 --- a/mediagoblin/tools/pagination.py +++ b/mediagoblin/tools/pagination.py @@ -53,7 +53,7 @@ class Pagination(object): cursor = copy.copy(self.cursor) for (doc, increment) in izip(cursor, count(0)): - if doc['_id'] == jump_to_id: + if doc._id == jump_to_id: self.page = 1 + int(floor(increment / self.per_page)) self.active_id = jump_to_id diff --git a/mediagoblin/user_pages/views.py b/mediagoblin/user_pages/views.py index 2090d6fd..82865bb4 100644 --- a/mediagoblin/user_pages/views.py +++ b/mediagoblin/user_pages/views.py @@ -45,7 +45,7 @@ def user_home(request, page): {'user': user}) cursor = request.db.MediaEntry.find( - {'uploader': user['_id'], + {'uploader': user._id, 'state': 'processed'}).sort('created', DESCENDING) pagination = Pagination(page, cursor) @@ -78,7 +78,7 @@ def user_gallery(request, page): return render_404(request) cursor = request.db.MediaEntry.find( - {'uploader': user['_id'], + {'uploader': user._id, 'state': 'processed'}).sort('created', DESCENDING) pagination = Pagination(page, cursor) @@ -135,8 +135,8 @@ def media_post_comment(request, media): assert request.method == 'POST' comment = request.db.MediaComment() - comment['media_entry'] = media['_id'] - comment['author'] = request.user['_id'] + comment['media_entry'] = media._id + comment['author'] = request.user._id comment['content'] = unicode(request.POST['comment_content']) comment['content_html'] = cleaned_markdown_conversion(comment['content']) @@ -179,7 +179,7 @@ def media_confirm_delete(request, media): location=media.url_for_self(request.urlgen)) if ((request.user[u'is_admin'] and - request.user[u'_id'] != media.uploader()[u'_id'])): + request.user._id != media.uploader()._id)): messages.add_message( request, messages.WARNING, _("You are about to delete another user's media. " @@ -207,7 +207,7 @@ def atom_feed(request): return render_404(request) cursor = request.db.MediaEntry.find({ - 'uploader': user['_id'], + 'uploader': user._id, 'state': 'processed'}) \ .sort('created', DESCENDING) \ .limit(ATOM_DEFAULT_NR_OF_UPDATED_ITEMS) @@ -251,7 +251,7 @@ def processing_panel(request): # # Make sure we have permission to access this user's panel. Only # admins and this user herself should be able to do so. - if not (user[u'_id'] == request.user[u'_id'] + if not (user._id == request.user._id or request.user.is_admin): # No? Let's simply redirect to this user's homepage then. return redirect( @@ -260,12 +260,12 @@ def processing_panel(request): # Get media entries which are in-processing processing_entries = request.db.MediaEntry.find( - {'uploader': user['_id'], + {'uploader': user._id, 'state': 'processing'}).sort('created', DESCENDING) # Get media entries which have failed to process failed_entries = request.db.MediaEntry.find( - {'uploader': user['_id'], + {'uploader': user._id, 'state': 'failed'}).sort('created', DESCENDING) # Render to response From 3618a9ac5112c657fd095a0f9cbd346921a4e800 Mon Sep 17 00:00:00 2001 From: Elrond
Date: Mon, 14 Nov 2011 17:11:37 +0100
Subject: [PATCH 061/302] Dot-Notation: x._id = ObjectId() doesn't seem to work
properly
For whatever reason, this does not work as expected:
entry._id = ObjectId()
Need to go this way:
entry['_id'] = ObjectId()
---
mediagoblin/submit/views.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mediagoblin/submit/views.py b/mediagoblin/submit/views.py
index bd63bd18..139b1d1d 100644
--- a/mediagoblin/submit/views.py
+++ b/mediagoblin/submit/views.py
@@ -52,7 +52,7 @@ def submit_start(request):
# create entry and save in database
entry = request.db.MediaEntry()
- entry._id = ObjectId()
+ entry['_id'] = ObjectId()
entry['title'] = (
unicode(request.POST['title'])
or unicode(splitext(filename)[0]))
From 64fd0462bdd821d5777d9697e67d951838f87de0 Mon Sep 17 00:00:00 2001
From: Joar Wandborg
Date: Tue, 15 Nov 2011 22:43:05 +0100
Subject: [PATCH 062/302] Committing some futile attempts to make GStreamer
transcode the audio properly.
- Added CPU count detection
- Added videorate
- Added audiorate
---
mediagoblin/media_types/video/transcoders.py | 45 +++++++++++++++++---
1 file changed, 38 insertions(+), 7 deletions(-)
diff --git a/mediagoblin/media_types/video/transcoders.py b/mediagoblin/media_types/video/transcoders.py
index 3a30aedf..de3701f6 100644
--- a/mediagoblin/media_types/video/transcoders.py
+++ b/mediagoblin/media_types/video/transcoders.py
@@ -29,6 +29,18 @@ _log = logging.getLogger(__name__)
logging.basicConfig()
_log.setLevel(logging.DEBUG)
+CPU_COUNT = 2
+try:
+ import multiprocessing
+ try:
+ CPU_COUNT = multiprocessing.cpu_count()
+ except NotImplementedError:
+ _log.warning('multiprocessing.cpu_count not implemented')
+ pass
+except ImportError:
+ _log.warning('Could not import multiprocessing, defaulting to 2 CPU cores')
+ pass
+
try:
import gtk
except:
@@ -627,10 +639,13 @@ class VideoTranscoder:
self.videoqueue = gst.element_factory_make('queue', 'videoqueue')
self.pipeline.add(self.videoqueue)
+ self.videorate = gst.element_factory_make('videorate', 'videorate')
+ self.pipeline.add(self.videorate)
+
self.ffmpegcolorspace = gst.element_factory_make(
'ffmpegcolorspace', 'ffmpegcolorspace')
self.pipeline.add(self.ffmpegcolorspace)
-
+
self.videoscale = gst.element_factory_make('ffvideoscale', 'videoscale')
#self.videoscale.set_property('method', 2) # I'm not sure this works
#self.videoscale.set_property('add-borders', 0)
@@ -648,11 +663,22 @@ class VideoTranscoder:
self.audioqueue = gst.element_factory_make('queue', 'audioqueue')
self.pipeline.add(self.audioqueue)
+ self.audiorate = gst.element_factory_make('audiorate', 'audiorate')
+ self.pipeline.add(self.audiorate)
+
self.audioconvert = gst.element_factory_make('audioconvert', 'audioconvert')
self.pipeline.add(self.audioconvert)
+ self.audiocapsfilter = gst.element_factory_make('capsfilter', 'audiocapsfilter')
+ audiocaps = ['audio/x-raw-float']
+ self.audiocapsfilter.set_property(
+ 'caps',
+ gst.caps_from_string(
+ ','.join(audiocaps)))
+ self.pipeline.add(self.audiocapsfilter)
+
self.vorbisenc = gst.element_factory_make('vorbisenc', 'vorbisenc')
- self.vorbisenc.set_property('quality', 0.7)
+ self.vorbisenc.set_property('quality', 1)
self.pipeline.add(self.vorbisenc)
# WebMmux & filesink
@@ -685,7 +711,8 @@ class VideoTranscoder:
self.filesrc.link(self.decoder)
# Link all the video elements in a link to webmux
- self.videoqueue.link(self.ffmpegcolorspace)
+ self.videoqueue.link(self.videorate)
+ self.videorate.link(self.ffmpegcolorspace)
self.ffmpegcolorspace.link(self.videoscale)
self.videoscale.link(self.capsfilter)
#self.capsfilter.link(self.xvimagesink)
@@ -695,8 +722,12 @@ class VideoTranscoder:
if self.data.is_audio:
# Link all the audio elements in a line to webmux
#self.audioconvert.link(self.alsasink)
- self.audioqueue.link(self.audioconvert)
- self.audioconvert.link(self.vorbisenc)
+ self.audioqueue.link(self.audiorate)
+ self.audiorate.link(self.audioconvert)
+ self.audioconvert.link(self.audiocapsfilter)
+ self.audiocapsfilter.link(self.vorbisenc)
+ #self.audiocapsfilter.link(self.level)
+ #self.level.link(self.vorbisenc)
self.vorbisenc.link(self.webmmux)
self.webmmux.link(self.progressreport)
@@ -729,7 +760,7 @@ class VideoTranscoder:
'''
Sets up the output format (width, height) for the video
'''
- caps = ['video/x-raw-yuv', 'pixel-aspect-ratio=1/1']
+ caps = ['video/x-raw-yuv', 'pixel-aspect-ratio=1/1', 'framerate=30/1']
if self.data.videoheight > self.data.videowidth:
# Whoa! We have ourselves a portrait video!
@@ -743,7 +774,7 @@ class VideoTranscoder:
self.capsfilter.set_property(
'caps',
gst.caps_from_string(
- ', '.join(caps)))
+ ','.join(caps)))
def _on_message(self, bus, message):
_log.debug((bus, message, message.type))
From 359781f075f22c6ea677e28756c8046b2f405e63 Mon Sep 17 00:00:00 2001
From: Joar Wandborg
Date: Wed, 16 Nov 2011 14:20:27 +0100
Subject: [PATCH 063/302] Fixed video transcoding
- Added audiorate with tolerance 80 million
- Removed deprecated thumbnailer
---
mediagoblin/media_types/video/transcoders.py | 213 +------------------
1 file changed, 1 insertion(+), 212 deletions(-)
diff --git a/mediagoblin/media_types/video/transcoders.py b/mediagoblin/media_types/video/transcoders.py
index de3701f6..f6a2eb21 100644
--- a/mediagoblin/media_types/video/transcoders.py
+++ b/mediagoblin/media_types/video/transcoders.py
@@ -340,218 +340,6 @@ class VideoThumbnailer:
self.loop.quit()
-class DeprecatedVideoThumbnailer:
- '''
- Creates a video thumbnail
-
- - Sets up discoverer & transcoding pipeline.
- Discoverer finds out information about the media file
- - Launches gobject.MainLoop, this triggers the discoverer to start running
- - Once the discoverer is done, it calls the __discovered callback function
- - The __discovered callback function launches the transcoding process
- - The _on_message callback is called from the transcoding process until it
- gets a message of type gst.MESSAGE_EOS, then it calls __stop which shuts
- down the gobject.MainLoop
- '''
-
- WADSWORTH_CONSTANT = 30 # percent
-
- def __init__(self, src, dst, **kwargs):
- _log.info('Initializing VideoThumbnailer...')
-
- self.loop = gobject.MainLoop()
-
- self.source_path = src
- self.destination_path = dst
-
- self.destination_dimensions = kwargs.get('dimensions') or (180, 180)
-
- if not type(self.destination_dimensions) == tuple:
- raise Exception('dimensions must be tuple: (width, height)')
-
- self._setup()
- self._run()
-
- def _setup(self):
- self._setup_pipeline()
- self._setup_discover()
-
- def _run(self):
- _log.info('Discovering...')
- self.discoverer.discover()
- _log.info('Done')
-
- _log.debug('Initializing MainLoop()')
- self.loop.run()
-
- def _setup_discover(self):
- self.discoverer = discoverer.Discoverer(self.source_path)
-
- # Connect self.__discovered to the 'discovered' event
- self.discoverer.connect('discovered', self.__discovered)
-
- def __discovered(self, data, is_media):
- '''
- Callback for media discoverer.
- '''
- if not is_media:
- self.__stop()
- raise Exception('Could not discover {0}'.format(self.source_path))
-
- _log.debug('__discovered, data: {0}'.format(data))
-
- self.data = data
-
- # Run any tasks that depend on the info from the discovery
- self._on_discovered()
-
- # Tell the transcoding pipeline to start running
- _log.info('Transcoding...')
-
- def _on_discovered(self):
- self.__setup_capsfilter()
-
- def _setup_pipeline(self):
- # Create a new pipeline
- self.pipeline = gst.Pipeline('VideoThumbnailerPipeline')
-
- # Create the elements in the pipeline
- self.filesrc = gst.element_factory_make('filesrc', 'filesrc')
- self.filesrc.set_property('location', self.source_path)
- self.pipeline.add(self.filesrc)
-
- self.decoder = gst.element_factory_make('decodebin2', 'decoder')
- self.decoder.connect('new-decoded-pad', self._on_dynamic_pad)
- self.pipeline.add(self.decoder)
-
- self.ffmpegcolorspace = gst.element_factory_make(
- 'ffmpegcolorspace', 'ffmpegcolorspace')
- self.pipeline.add(self.ffmpegcolorspace)
-
- self.videoscale = gst.element_factory_make('videoscale', 'videoscale')
- self.videoscale.set_property('method', 'bilinear')
- self.pipeline.add(self.videoscale)
-
- self.capsfilter = gst.element_factory_make('capsfilter', 'capsfilter')
- self.pipeline.add(self.capsfilter)
-
- self.jpegenc = gst.element_factory_make('jpegenc', 'jpegenc')
- self.pipeline.add(self.jpegenc)
-
- #self.filesink = gst.element_factory_make('filesink', 'filesink')
- #self.filesink.set_property('location', self.destination_path)
- #self.pipeline.add(self.filesink)
-
- self.appsink = gst.element_factory_make('appsink', 'appsink')
- self.appsink.set_property('emit-signals', True)
- self.appsink.connect('new-preroll', self.__on_sink_preroll)
- self.pipeline.add(self.appsink)
-
- self.progressreport = gst.element_factory_make(
- 'progressreport', 'progressreport')
- self.progressreport.set_property('update-freq', 1)
- self.pipeline.add(self.progressreport)
-
- self.identity = gst.element_factory_make('identity', 'id')
- self.pipeline.add(self.identity)
-
- # Link all the elements together
- self.filesrc.link(self.decoder)
- self.ffmpegcolorspace.link(self.videoscale)
- self.videoscale.link(self.capsfilter)
- self.capsfilter.link(self.jpegenc)
- self.jpegenc.link(self.progressreport)
- self.progressreport.link(self.identity)
- #self.identity.link(self.filesink)
- self.identity.link(self.appsink)
-
- self.pipeline.set_state(gst.STATE_PAUSED)
-
- self._setup_bus()
-
- def __on_sink_preroll(self, sink):
- _log.debug('SINK PREROLL!!!!')
-
- def _on_dynamic_pad(self, dbin, pad, islast):
- '''
- Callback called when ``decodebin2`` has a pad that we can connect to
- '''
- # Intersect the capabilities of the video sink and the pad src
- # Then check if they have no common capabilities.
- if not self.ffmpegcolorspace.get_pad_template('sink')\
- .get_caps().intersect(pad.get_caps()).is_empty():
- # It IS a video src pad.
- pad.link(self.ffmpegcolorspace.get_pad('sink'))
- gst.DEBUG_BIN_TO_DOT_FILE(
- self.pipeline,
- gst.DEBUG_GRAPH_SHOW_ALL,
- 'ss')
-
- def _setup_bus(self):
- self.bus = self.pipeline.get_bus()
- self.bus.add_signal_watch()
- self.bus.connect('message', self._on_message)
-
- def __setup_capsfilter(self):
- caps = ['video/x-raw-rgb', 'pixel-aspect-ratio=1/1']
-
- if self.data.videoheight > self.data.videowidth:
- # Whoa! We have ourselves a portrait video!
- caps.append('height={0}'.format(
- self.destination_dimensions[1]))
- else:
- # It's a landscape, phew, how normal.
- caps.append('width={0}'.format(
- self.destination_dimensions[0]))
-
- self.capsfilter.set_property(
- 'caps',
- gst.caps_from_string(
- ', '.join(caps)))
-
- def __find_wadsworth(self):
- if self.decoder.seek_simple(
- gst.FORMAT_PERCENT,
- gst.SEEK_FLAG_NONE,
- 0 * 10000):
- _log.info('Found wadsworth')
- #pdb.set_trace()
- #self.pipeline.set_state(gst.STATE_PLAYING)
- self.__get_buffer()
- self.__stop()
- else:
- pdb.set_trace()
-
- def __get_buffer(self):
- buffer = self.appsink.emit('pull-preroll')
- open(self.destination_path, 'wb').write(buffer)
-
- def _on_message(self, bus, message):
- t = message.type
-
- _log.debug((
- t == gst.MESSAGE_ASYNC_DONE,
- bus,
- message))
-
- if t == gst.MESSAGE_EOS:
- self.__stop()
- _log.info('Got EOS')
- elif t == gst.MESSAGE_ASYNC_DONE:
- #pdb.set_trace()
- self.__find_wadsworth()
- elif t == gst.MESSAGE_ERROR:
- _log.error((bus, message))
- self.__stop()
-
- def __stop(self):
- _log.debug(self.loop)
-
- self.pipeline.set_state(gst.STATE_NULL)
-
- gobject.idle_add(self.loop.quit)
-
-
class VideoTranscoder:
'''
Video transcoder
@@ -664,6 +452,7 @@ class VideoTranscoder:
self.pipeline.add(self.audioqueue)
self.audiorate = gst.element_factory_make('audiorate', 'audiorate')
+ self.audiorate.set_property('tolerance', 80000000)
self.pipeline.add(self.audiorate)
self.audioconvert = gst.element_factory_make('audioconvert', 'audioconvert')
From 76c6c806caec7af20a3fe11c04bb783baacc3934 Mon Sep 17 00:00:00 2001
From: Christopher Allan Webber
Date: Wed, 16 Nov 2011 17:53:46 -0600
Subject: [PATCH 064/302] Accidentally had user['profile'] where it shoulda
been user['bio']
---
mediagoblin/templates/mediagoblin/user_pages/user.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mediagoblin/templates/mediagoblin/user_pages/user.html b/mediagoblin/templates/mediagoblin/user_pages/user.html
index c5beeaaa..6d938262 100644
--- a/mediagoblin/templates/mediagoblin/user_pages/user.html
+++ b/mediagoblin/templates/mediagoblin/user_pages/user.html
@@ -78,7 +78,7 @@
{%- trans username=user.username %}{{ username }}'s profile{% endtrans -%}
- {% if not user['url'] and not user['profile'] %}
+ {% if not user['url'] and not user['bio'] %}
{% if request.user['_id'] == user['_id'] %}
-
+
{% if next %}
-
{% endif %}
diff --git a/mediagoblin/templates/mediagoblin/auth/register.html b/mediagoblin/templates/mediagoblin/auth/register.html
index 25b68058..a0d0a277 100644
--- a/mediagoblin/templates/mediagoblin/auth/register.html
+++ b/mediagoblin/templates/mediagoblin/auth/register.html
@@ -29,7 +29,7 @@
{{ csrf_token }}
+ class="button_form" />
From ccca0fbfc3667900d0a5ad3687c27f4fd72db061 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber
Date: Thu, 17 Nov 2011 08:28:23 -0600
Subject: [PATCH 065/302] Beginnings of sqlalchemy models
---
mediagoblin/db/sql.py | 95 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 95 insertions(+)
create mode 100644 mediagoblin/db/sql.py
diff --git a/mediagoblin/db/sql.py b/mediagoblin/db/sql.py
new file mode 100644
index 00000000..31ebfbf4
--- /dev/null
+++ b/mediagoblin/db/sql.py
@@ -0,0 +1,95 @@
+import datetime
+
+from sqlalchemy.ext.declarative import declarative_base
+from sqlalchemy import (
+ Column, Integer, Unicode, UnicodeText, DateTime, Boolean, ForeignKey,
+ UniqueConstraint)
+
+
+Base = declarative_base()
+
+
+class User(Base):
+ __tablename__ = "users"
+
+ id = Column(Integer, primary_key=True)
+ username = Column(Unicode, nullable=False, unique=True)
+ email = Column(Unicode, nullable=False)
+ created = Column(DateTime, nullable=False, default=datetime.datetime.now)
+ pw_hash = Column(Unicode, nullable=False)
+ email_verified = Column(Boolean)
+ status = Column(Unicode, default="needs_email_verification", nullable=False)
+ verification_key = Column(Unicode)
+ is_admin = Column(Boolean, default=False, nullable=False)
+ url = Column(Unicode)
+ bio = Column(UnicodeText) # ??
+ bio_html = Column(UnicodeText) # ??
+ fp_verification_key = Column(Unicode)
+ fp_verification_expire = Column(DateTime)
+
+ ## TODO
+ # plugin data would be in a separate model
+
+
+class MediaEntry(Base):
+ __tablename__ = "media_entries"
+
+ id = Column(Integer, primary_key=True)
+ uploader = Column(Integer, ForeignKey('users.id'), nullable=False)
+ slug = Column(Unicode, nullable=False)
+ created = Column(DateTime, nullable=False, default=datetime.datetime.now)
+ description = Column(UnicodeText) # ??
+ description_html = Column(UnicodeText) # ??
+ media_type = Column(Unicode, nullable=False)
+
+ fail_error = Column(Unicode)
+ fail_metadata = Column(UnicodeText)
+
+ queued_media_file = Column(Unicode)
+
+ queued_task_id = Column(Unicode)
+
+ __table_args__ = (
+ UniqueConstraint('uploader', 'slug'),
+ {})
+
+ ## TODO
+ # media_files
+ # media_data
+ # attachment_files
+ # fail_error
+
+
+class Tag(Base):
+ __tablename__ = "tags"
+
+ id = Column(Integer, primary_key=True)
+ slug = Column(Unicode, nullable=False, unique=True)
+
+
+class MediaTag(Base):
+ __tablename__ = "media_tags"
+
+ id = Column(Integer, primary_key=True)
+ tag = Column(Integer, ForeignKey('tags.id'), nullable=False)
+ name = Column(Unicode)
+ media_entry = Column(
+ Integer, ForeignKey('media_entries.id'),
+ nullable=False)
+ # created = Column(DateTime, nullable=False, default=datetime.datetime.now)
+
+ __table_args__ = (
+ UniqueConstraint('tag', 'media_entry'),
+ {})
+
+
+class MediaComment(Base):
+ __tablename__ = "media_comments"
+
+ id = Column(Integer, primary_key=True)
+ media_entry = Column(
+ Integer, ForeignKey('media_entries.id'), nullable=False)
+ author = Column(Integer, ForeignKey('users.id'), nullable=False)
+ created = Column(DateTime, nullable=False, default=datetime.datetime.now)
+ content = Column(UnicodeText, nullable=False)
+ content_html = Column(UnicodeText)
From 6950c6c77c2daf4a47810e05a7c3f64f8995059d Mon Sep 17 00:00:00 2001
From: Christopher Allan Webber
Date: Sat, 19 Nov 2011 08:31:37 -0600
Subject: [PATCH 066/302] Adding app_config and global_config to the template
environment
---
mediagoblin/tools/template.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/mediagoblin/tools/template.py b/mediagoblin/tools/template.py
index 905a36df..a0eaabe7 100644
--- a/mediagoblin/tools/template.py
+++ b/mediagoblin/tools/template.py
@@ -55,6 +55,8 @@ def get_jinja_env(template_loader, locale):
template_env.globals['fetch_messages'] = messages.fetch_messages
template_env.globals['gridify_list'] = gridify_list
template_env.globals['gridify_cursor'] = gridify_cursor
+ template_env.globals['app_config'] = mg_globals.app_config
+ template_env.globals['global_config'] = mg_globals.global_config
if exists(locale):
SETUP_JINJA_ENVS[locale] = template_env
From 53bc39755bf22fe8eebf06b051018eba111a64e7 Mon Sep 17 00:00:00 2001
From: Christopher Allan Webber
Date: Sat, 19 Nov 2011 08:33:29 -0600
Subject: [PATCH 067/302] Add app_config and global_config to the template
environment
---
mediagoblin/tools/template.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/mediagoblin/tools/template.py b/mediagoblin/tools/template.py
index a0eaabe7..0986761b 100644
--- a/mediagoblin/tools/template.py
+++ b/mediagoblin/tools/template.py
@@ -52,6 +52,7 @@ def get_jinja_env(template_loader, locale):
# All templates will know how to ...
# ... fetch all waiting messages and remove them from the queue
# ... construct a grid of thumbnails or other media
+ # ... have access to the global and app config
template_env.globals['fetch_messages'] = messages.fetch_messages
template_env.globals['gridify_list'] = gridify_list
template_env.globals['gridify_cursor'] = gridify_cursor
From 3c0411f51f43ade8c7d47df4f3843fd79d4709b5 Mon Sep 17 00:00:00 2001
From: "Pablo J. Urbano Santos"
Date: Sat, 19 Nov 2011 17:07:41 +0100
Subject: [PATCH 068/302] Allow instance owners to customize html titles of
page: Added html_title config option. Made base.html template use
html_title option as page title.
---
mediagoblin/config_spec.ini | 3 +++
mediagoblin/templates/mediagoblin/base.html | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/mediagoblin/config_spec.ini b/mediagoblin/config_spec.ini
index 900957ce..b804358c 100644
--- a/mediagoblin/config_spec.ini
+++ b/mediagoblin/config_spec.ini
@@ -1,4 +1,7 @@
[mediagoblin]
+# HTML title of the pages
+html_title = string(default="GNU MediaGoblin")
+
# database stuff
db_host = string()
db_name = string(default="mediagoblin")
diff --git a/mediagoblin/templates/mediagoblin/base.html b/mediagoblin/templates/mediagoblin/base.html
index 925386e5..0d6b9e40 100644
--- a/mediagoblin/templates/mediagoblin/base.html
+++ b/mediagoblin/templates/mediagoblin/base.html
@@ -19,7 +19,7 @@
- {% block title %}{% trans %}GNU MediaGoblin{% endtrans %}{% endblock title %}
+ {{ app_config['html_title'] }}
Date: Sat, 19 Nov 2011 19:11:42 +0100
Subject: [PATCH 069/302] Added parameter ascending to
MediaEntry::get_comments, if true, comments will be ordered ascending,
otherwise descending
---
mediagoblin/db/models.py | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py
index 1c1bc2fd..f13a4457 100644
--- a/mediagoblin/db/models.py
+++ b/mediagoblin/db/models.py
@@ -217,9 +217,14 @@ class MediaEntry(Document):
'created': datetime.datetime.utcnow,
'state': u'unprocessed'}
- def get_comments(self):
+ def get_comments(self, ascending=False):
+ if ascending:
+ order = ASCENDING
+ else:
+ order = DESCENDING
+
return self.db.MediaComment.find({
- 'media_entry': self._id}).sort('created', DESCENDING)
+ 'media_entry': self._id}).sort('created', order)
def get_display_media(self, media_map,
fetch_order=common.DISPLAY_IMAGE_FETCHING_ORDER):
From 1a3138addd43d410b03cdd1816e0a62bd217de30 Mon Sep 17 00:00:00 2001
From: "Pablo J. Urbano Santos"
Date: Sat, 19 Nov 2011 19:15:41 +0100
Subject: [PATCH 070/302] media_home: order comments by ascending date.
---
mediagoblin/user_pages/views.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mediagoblin/user_pages/views.py b/mediagoblin/user_pages/views.py
index 82865bb4..98a21bb4 100644
--- a/mediagoblin/user_pages/views.py
+++ b/mediagoblin/user_pages/views.py
@@ -106,11 +106,11 @@ def media_home(request, media, page, **kwargs):
"""
if ObjectId(request.matchdict.get('comment')):
pagination = Pagination(
- page, media.get_comments(), MEDIA_COMMENTS_PER_PAGE,
+ page, media.get_comments(True), MEDIA_COMMENTS_PER_PAGE,
ObjectId(request.matchdict.get('comment')))
else:
pagination = Pagination(
- page, media.get_comments(), MEDIA_COMMENTS_PER_PAGE)
+ page, media.get_comments(True), MEDIA_COMMENTS_PER_PAGE)
comments = pagination()
From fc5695c538f2b6d230c0e431087e9c10e6deac6c Mon Sep 17 00:00:00 2001
From: Corey Farwell
Date: Sat, 19 Nov 2011 10:43:31 -0800
Subject: [PATCH 071/302] incorrect path in nginx config
---
docs/source/deploying.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/source/deploying.rst b/docs/source/deploying.rst
index c2ba0c47..b944a3d3 100644
--- a/docs/source/deploying.rst
+++ b/docs/source/deploying.rst
@@ -207,7 +207,7 @@ this ``nginx.conf`` file should be modeled on the following: ::
# Instance specific media:
location /mgoblin_media/ {
- alias /srv/mediagoblin.example.org/mediagoblin/mediagoblin/user_dev/media/public/;
+ alias /srv/mediagoblin.example.org/mediagoblin/user_dev/media/public/;
}
# Mounting MediaGoblin itself via fastcgi.
From b4b7b6a57a5ad9a5e52a5d3e05f9ad3d3e8b650a Mon Sep 17 00:00:00 2001
From: Christopher Allan Webber
Date: Sat, 19 Nov 2011 13:42:30 -0600
Subject: [PATCH 072/302] Added Corey Farwell to the list of contributors
---
AUTHORS | 1 +
1 file changed, 1 insertion(+)
diff --git a/AUTHORS b/AUTHORS
index c9fc5c8e..b0ef7154 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -13,6 +13,7 @@ Thank you!
* Alex Camelio
* Bernhard Keller
* Caleb Forbes Davis V
+* Corey Farwell
* Chris Moylan
* Christopher Allan Webber
* Daniel Neel
From 7c378f2cd5324a05e709cbada5eb5668ce3a3469 Mon Sep 17 00:00:00 2001
From: Christopher Allan Webber
Date: Sat, 19 Nov 2011 14:01:38 -0600
Subject: [PATCH 073/302] Allow user to set whether comments are ascending or
descending
---
mediagoblin/config_spec.ini | 3 +++
mediagoblin/user_pages/views.py | 8 ++++++--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/mediagoblin/config_spec.ini b/mediagoblin/config_spec.ini
index 900957ce..4d412346 100644
--- a/mediagoblin/config_spec.ini
+++ b/mediagoblin/config_spec.ini
@@ -27,6 +27,9 @@ allow_registration = boolean(default=True)
tags_delimiter = string(default=",")
tags_max_length = integer(default=50)
+# Whether comments are ascending or descending
+comments_ascending = boolean(default=True)
+
# By default not set, but you might want something like:
# "%(here)s/user_dev/templates/"
local_templates = string()
diff --git a/mediagoblin/user_pages/views.py b/mediagoblin/user_pages/views.py
index 98a21bb4..25fd2ebb 100644
--- a/mediagoblin/user_pages/views.py
+++ b/mediagoblin/user_pages/views.py
@@ -106,11 +106,15 @@ def media_home(request, media, page, **kwargs):
"""
if ObjectId(request.matchdict.get('comment')):
pagination = Pagination(
- page, media.get_comments(True), MEDIA_COMMENTS_PER_PAGE,
+ page, media.get_comments(
+ mg_globals.app_config['comments_ascending']),
+ MEDIA_COMMENTS_PER_PAGE,
ObjectId(request.matchdict.get('comment')))
else:
pagination = Pagination(
- page, media.get_comments(True), MEDIA_COMMENTS_PER_PAGE)
+ page, media.get_comments(
+ mg_globals.app_config['comments_ascending']),
+ MEDIA_COMMENTS_PER_PAGE)
comments = pagination()
From 1bc231c766c41f61aee6d91c631bd972426b277b Mon Sep 17 00:00:00 2001
From: Christopher Allan Webber
Date: Sat, 19 Nov 2011 14:03:01 -0600
Subject: [PATCH 074/302] Added Pablo Santos to the AUTHORS file
---
AUTHORS | 1 +
1 file changed, 1 insertion(+)
diff --git a/AUTHORS b/AUTHORS
index b0ef7154..76e16b86 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -28,6 +28,7 @@ Thank you!
* Nathan Yergler
* Odin Hørthe Omdal
* Osama Khalid
+* Pablo J. Urbano Santos
* Rasmus Larsson
* Sam Kleinman
* Sebastian Spaeth
From 7880168526032bc2ddce96257d8f62a01e562832 Mon Sep 17 00:00:00 2001
From: Christopher Allan Webber
Date: Sat, 19 Nov 2011 14:06:48 -0600
Subject: [PATCH 075/302] Added back the title block
---
mediagoblin/templates/mediagoblin/base.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mediagoblin/templates/mediagoblin/base.html b/mediagoblin/templates/mediagoblin/base.html
index 0d6b9e40..64fafb73 100644
--- a/mediagoblin/templates/mediagoblin/base.html
+++ b/mediagoblin/templates/mediagoblin/base.html
@@ -19,7 +19,7 @@
- {{ app_config['html_title'] }}
+ {% block title %}{{ app_config['html_title'] }}{% endblock %}
Date: Sat, 19 Nov 2011 23:46:42 +0100
Subject: [PATCH 076/302] Change form structure and add relevant CSS rules
---
mediagoblin/static/css/base.css | 6 +++++-
mediagoblin/templates/mediagoblin/utils/wtforms.html | 12 +++++-------
2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/mediagoblin/static/css/base.css b/mediagoblin/static/css/base.css
index afd10207..a7b659c3 100644
--- a/mediagoblin/static/css/base.css
+++ b/mediagoblin/static/css/base.css
@@ -212,7 +212,11 @@ text-align: center;
width: 100%;
}
-.form_field_label,.form_field_input {
+.form_field_input {
+ margin-bottom: 10px;
+}
+
+.form_field_label {
margin-bottom: 4px;
}
diff --git a/mediagoblin/templates/mediagoblin/utils/wtforms.html b/mediagoblin/templates/mediagoblin/utils/wtforms.html
index 6a86fd24..39dca7cc 100644
--- a/mediagoblin/templates/mediagoblin/utils/wtforms.html
+++ b/mediagoblin/templates/mediagoblin/utils/wtforms.html
@@ -18,18 +18,16 @@
{# Generically render a field #}
{% macro render_field_div(field) %}
-
- {{ _(field.label.text) }}
- {{ field }}
+
+
+ {{ field }}
{%- if field.errors -%}
{% for error in field.errors %}
-
- {{ error }}
-
+ {{ _(field.description) }}
+
{%- endmacro %}
From 2d62e9efd210becd30982e65e06a6ef97029b391 Mon Sep 17 00:00:00 2001
From: lora
Date: Sat, 19 Nov 2011 17:00:25 -0600
Subject: [PATCH 077/302] issue 582: use media.slug instead of media.id
---
mediagoblin/decorators.py | 3 +--
mediagoblin/templates/mediagoblin/user_pages/media.html | 4 ++--
.../mediagoblin/user_pages/media_confirm_delete.html | 2 +-
3 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/mediagoblin/decorators.py b/mediagoblin/decorators.py
index 19e22bca..38f52ced 100644
--- a/mediagoblin/decorators.py
+++ b/mediagoblin/decorators.py
@@ -58,7 +58,7 @@ def user_may_delete_media(controller):
"""
def wrapper(request, *args, **kwargs):
uploader = request.db.MediaEntry.find_one(
- {'_id': ObjectId(request.matchdict['media'])}).uploader()
+ {'slug': request.matchdict['media'] }).uploader()
if not (request.user['is_admin'] or
request.user['_id'] == uploader['_id']):
return exc.HTTPForbidden()
@@ -95,7 +95,6 @@ def get_user_media_entry(controller):
if not user:
return render_404(request)
-
media = request.db.MediaEntry.find_one(
{'slug': request.matchdict['media'],
'state': 'processed',
diff --git a/mediagoblin/templates/mediagoblin/user_pages/media.html b/mediagoblin/templates/mediagoblin/user_pages/media.html
index 433f74dc..5e1b73de 100644
--- a/mediagoblin/templates/mediagoblin/user_pages/media.html
+++ b/mediagoblin/templates/mediagoblin/user_pages/media.html
@@ -124,7 +124,7 @@
diff --git a/mediagoblin/templates/mediagoblin/auth/login.html b/mediagoblin/templates/mediagoblin/auth/login.html
index 756f67c0..c3807e5f 100644
--- a/mediagoblin/templates/mediagoblin/auth/login.html
+++ b/mediagoblin/templates/mediagoblin/auth/login.html
@@ -42,10 +42,10 @@
{% trans %}Forgot your password?{% endtrans %}
{{ error }}
{% endfor %} {%- endif %} {% if field.description -%} -{{ _(field.description) }}
{%- endif %}{% set edit_url = request.urlgen('mediagoblin.edit.edit_media', user= media.uploader().username, - media= media._id) %} + media= media.slug) %}
@@ -133,7 +133,7 @@
{% set delete_url = request.urlgen('mediagoblin.user_pages.media_confirm_delete', user= media.uploader().username, - media= media._id) %} + media= media.slug) %}
diff --git a/mediagoblin/templates/mediagoblin/user_pages/media_confirm_delete.html b/mediagoblin/templates/mediagoblin/user_pages/media_confirm_delete.html
index dd6923a9..f62082bd 100644
--- a/mediagoblin/templates/mediagoblin/user_pages/media_confirm_delete.html
+++ b/mediagoblin/templates/mediagoblin/user_pages/media_confirm_delete.html
@@ -23,7 +23,7 @@
{% trans %}Don't have one yet? It's easy!{% endtrans %}
{% trans register_url=request.urlgen('mediagoblin.auth.register') -%} - Create an account at this site + Create an account at this site or - Set up MediaGoblin on your own server + Set up MediaGoblin on your own server {%- endtrans %} {% endif %}