#+TITLE: GNU MediaGoblin @ ChiPy #+AUTHOR: Christopher Allan Webber #+EMAIL: cwebber@dustycloud.org #+DATE: 2011-06-09 Thu #+DESCRIPTION: #+KEYWORDS: #+LANGUAGE: en #+OPTIONS: H:3 num:t toc:t \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t #+OPTIONS: TeX:t LaTeX:t skip:nil d:nil todo:t pri:nil tags:not-in-toc #+INFOJS_OPT: view:nil toc:nil ltoc:t mouse:underline buttons:0 path:http://orgmode.org/org-info.js #+EXPORT_SELECT_TAGS: export #+EXPORT_EXCLUDE_TAGS: noexport #+LINK_UP: #+LINK_HOME: #+XSLT: #+startup: beamer #+LaTeX_CLASS: beamer #+LaTeX_CLASS_OPTIONS: [bigger] #+latex_header: \mode{\usetheme{Madrid}} #+BEAMER_FRAME_LEVEL: 2 #+COLUMNS: %40ITEM %10BEAMER_env(Env) %9BEAMER_envargs(Env Args) %4BEAMER_col(Col) %10BEAMER_extra(Extra) #+LATEX_HEADER: \hypersetup{colorlinks=true, urlcolor=cyan} * About me! ** Hello Chipy! / About Me - Hi, I'm Christopher Allan Webber! - I used to give talks here a lot - Then I moved to Deklabbs (DeKalb, IL) - By dayjob, a programmer for Creative Commons - By night, programmer on various FOSS things, maker of weird drawings - [[http://dustycloud.org/]] - But I'm not here to talk about me... ** Logo? :PROPERTIES: :BEAMER_envargs: [shrink = 11] :END: : .-''-. : < o o > : /oO-Ooo'\ : ///\/ -____- \ : -->\. ///\.\ : \__/\ -\_/ / : ) \_/ : / \__/ ' : / / | | : ____ _ _ _ _ : / ___| \ | | | | | : | | _| \| | | | | : | |_| | |\ | |_| | : \____|_| \_|\___/ : __ __ _ _ ____ _ _ _ : | \/ | ___ __| (_) __ _ / ___| ___ | |__ | (_)_ __ : | |\/| |/ _ \/ _` | |/ _` | | _ / _ \| '_ \| | | '_ \ : | | | | __/ (_| | | (_| | |_| | (_) | |_) | | | | | | : |_| |_|\___|\__,_|_|\__,_|\____|\___/|_.__/|_|_|_| |_| ** So, about GNU MediaGoblin! Pull up [[http://mediagoblin.org/]] Better summary on page but in short we're building: - Media publishing system - Initially images only - But designing for multiple media types (video, documents, etc) - Federated (more on this later!) - Think: FOSS, federated Flickr/DeviantArt (eventually YouTube/Blip/Vimeo) ** The problem of intarwebs homogenization Teh intarwebs! - Initially this great, decentralized, fault-tolerant system - More and more homogenization means: - more centralization - more rigidity - more fragility - sad intarwebs ** Enter federation and free software - Decentralization w/ intercommunication - We already know what this looks like outside the web: - email - xmpp/jabber - Federated web services: bringing intercommunication to the web - We already have a pretty good meta-standard: OStatus * Let's see some screenshots ** Main page :PROPERTIES: :BEAMER_envargs: [shrink = 13] :END: : | GNU MediaGoblin | login | register | : |------------------------------------------------| : | | : | ___________________________________________ | : | | | | : | | GNU MediaGoblin is a great way to start | | : | | sharing blah blah blah | | : | | [ Sign me up! ] | | : | | [ More about GMG ] | | : | '-------------------------------------------' | : | | : | ___________________________________________ | : | |_Featured_works____________________________| | : | | _________ _________ _________ | | : | | | ,-\/ | | ,( ) | | ,,, | | | : | | | /o o_,,| | (_o_) | | e~_~ | | | : | | |/ __vvvv | | / | | \ / | | | : | | | / \ | | ,,,,,, | | / \ | | | : | | '---------' '---------' '---------' | | : | | Dragons of Clover in Joe is so | | : | | Flame by the grass Hip | | : | | schendje by clovdud by joe | | : | '-------------------------------------------' | ** Piece of media :PROPERTIES: :BEAMER_envargs: [shrink = 13] :END: : | GNU MediaGoblin | login | register | : |------------------------------------------------| : | | : | The Terror of Tinman Tim | : | Posted by cwebber on May 8, 2011 | : | ___________________________________________ | : | | | | : | | __ ____ | | : | | (O)== | |=(O) | | : | | | |O o| DESTROY ALL HUMANS | | : | | |__|[ww]| | | : | | | | _ | _ | | : | | | ((((((_ |((_ | | : | | | | | | | : | | |____|____| | | : | | |_| \_\ _ | | : | | _/_/_ \_// / | | : | | |___|| |/_/ | | : | | | | : | '-------------------------------------------' | : | _________________________________________ | : | | Just another piece on a robot who wants | | : | | to do what any robot would want to do. | | : | '-----------------------------------------' | : | | : | Comments: | : | __________________________________________ | : | | Wow I love your robot!!!!!! | | : | | sue @ May 8 2011 11:45PM | | : | '------------------------------------------' | ** User profile :PROPERTIES: :BEAMER_envargs: [shrink = 14] :END: : _____ : |_( )_| USER NAME : | | | : |_/_\_| : : Recent artwork: : ___________________ ___________________________ : | ___ ___ ___ | |_About_User_Name___________| : | |pic| |pic| |pic| | | | : | |___| |___| |___| | | Some sort of self- | : | ___ ___ ___ | | description probably goes | : < | |pic| |pic| |pic| | > | here | : | |___| |___| |___| | | | : | ___ ___ ___ | | | : | |pic| |pic| |pic| | | | : | |___| |___| |___| | | | : |___________________| |___________________________| : : ___________________________ : Recent favorites: |_Recent_activity___________| : ___________________ | New picture: DragonFace | : | ___ ___ ___ | | 4/2/2010 | : | |pic| |pic| |pic| | |---------------------------| : | |___| |___| |___| | | Sup yall this is some kind| : | ___ ___ ___ | | of mini blogpost. Maybe | : < | |pic| |pic| |pic| | > | the interface will allow | : | |___| |___| |___| | | for this? | : | ___ ___ ___ | |___________________________| : | |pic| |pic| |pic| | : | |___| |___| |___| | ___________________________ : |___________________| |_External_comments_here____| : | Dang! This stuff rocks | : | - Joe 4/2/2010 | : |---------------------------| : | Nice job on the dragon | : | - Morgan 4/2/2010 | : '---------------------------' ** Uploading an image :PROPERTIES: :BEAMER_envargs: [shrink = 14] :END: : Upload an image : : [ Title ] : : Upload: [ ] [Browse] : ___________________________________________ : | | : | | : | o0O | : | o ' | : | o_.' | : | | : | Uploading... OK | <-, : | Resizing... OK | | : | | Area replaced w/ resized : | | image when done : |___________________________________________| : ________________ : License |_CC BY-SA_____|V| : ___________________________________________ : | Description goes here. | : | You can type it up in here and everything | : | and it'll show up under the image. | : | | : | Possibly we should allow some kind of | : | markup... maybe markdown? | : '___________________________________________' : : __________________________________________ : |> Advanced | : ------------------------------------------ ** OH WAIT Oh wait sorry so sorry Real screenshots: http://mediagoblin.org/2011/06/version-002---we-can-haz-pages/ * The technology stack ** But this is a ChiPy presentation! What is GNU MediaGoblin from like, a technical standpoint ** "Framework" - WSGI minimalist application - "no framework" / unframework - "Django minus Django" - highly recommend reading "Another Do-It-Yourself Framework" in webob docs http://pythonpaste.org/webob/do-it-yourself.html ** Django minus Django (part 1) - Django minus Django, why not Django? - I must be an idiot, I don't know how great Django is - I've done a *ton* of Django development, yes I know how awesome it is - Actually I replaced the world's first major Python Paste deployment with Django at Imaginary Landscape - McAvoy: "Do your fingers burn as you type" - I think this was the right choice for Imaginary Landscape! - Also have worked on http://miroguide.com/ and http://mirocommunity.org and Django was *great* for these - Django is great for many, maybe most webdev, and is the absolute best option for new python web programmers ** Django minus Django (part 2) - Replace the templates with Jinja2, replace the database with MongoDB / MongoKit, etc, how much Django do you have left? - Most of Django's ideas implemented as good or better in independent libraries now - Gluing together those libraries yourself - not hard at all - "framework" module ~mediagoblin/app.py~ only 160 lines and pretty custom - In the end our stack still owes a lot of thanks to Django though. - (Other frameworks are also nice, hi Massimo!) ** What the app looks like: :PROPERTIES: :BEAMER_envargs: [shrink = 10] :END: : -. mediagoblin/ : |-> app.py : |-> routing.py : |-> util.py : | : |-. db/ : | |-> models.py : | '-> migrations.py : | : |-. auth/ : | |-> routing.py : | |-> views.py : | '-> lib.py : | : |-. submit/ : | |-> routing.py : | |-> views.py : | '-> lib.py : | : |-. templates/ ... etc. Look familiar enough? ** The technology stack page! - Python :: langauge - Nose :: tests - zc.buildout :: for the environment, you can use virtualenv tho - MongoDB :: for the database - MongoKit :: ORM for the database - Paste Deploy :: For launching the application / application configuration - WebOb :: Request / Response objects (very Django-like) - Jinja2 :: Templating system - WTForms :: Form stuff - Celery :: For farming out tasks/media processing (image resizing, video transcoding, etc) - A few other things :: Whatever, read our setup.py ** ~mediagoblin/auth/routing.py~ :PROPERTIES: :BEAMER_envargs: [shrink = 11] :END: #+BEGIN_SRC python from routes.route import Route auth_routes = [ Route('mediagoblin.auth.register', '/register/', controller='mediagoblin.auth.views:register'), Route('mediagoblin.auth.register_success', '/register/success/', template='mediagoblin/auth/register_success.html', controller='mediagoblin.views:simple_template_render'), Route('mediagoblin.auth.login', '/login/', controller='mediagoblin.auth.views:login'), Route('mediagoblin.auth.logout', '/logout/', controller='mediagoblin.auth.views:logout'), #+END_SRC ** ~mediagoblin/db/models.py~ :PROPERTIES: :BEAMER_envargs: [shrink = 9] :END: #+BEGIN_SRC python class User(Document): __collection__ = 'users' structure = { 'username': unicode, 'email': unicode, 'created': datetime.datetime, 'plugin_data': dict, # plugins can dump stuff here. 'pw_hash': unicode, 'email_verified': bool, 'status': unicode, 'verification_key': unicode, 'is_admin': bool, } required_fields = ['username', 'created', 'pw_hash', 'email'] default_values = { 'created': datetime.datetime.utcnow #+END_SRC ** ~mediagoblin/user_pages/views.py~ :PROPERTIES: :BEAMER_envargs: [shrink = 11] :END: ~mediagoblin/user_pages/views.py~ #+BEGIN_SRC python @uses_pagination def user_home(request, page): """'Homepage' of a User()""" user = request.db.User.find_one({ 'username': request.matchdict['user'], 'status': 'active'}) if not user: return exc.HTTPNotFound() cursor = request.db.MediaEntry.find( {'uploader': user['_id'], 'state': 'processed'}).sort('created', DESCENDING) # [...] return render_to_response( request, 'mediagoblin/user_pages/user.html', {'user': user, 'media_entries': media_entries, 'pagination': pagination}) #+END_SRC ** ~mediagoblin/auth/forms.py~ :PROPERTIES: :BEAMER_envargs: [shrink = 9] :END: #+BEGIN_SRC python class RegistrationForm(wtforms.Form): username = wtforms.TextField( 'Username', [wtforms.validators.Required(), wtforms.validators.Length(min=3, max=30), wtforms.validators.Regexp(r'^\w+$')]) password = wtforms.PasswordField( 'Password', [wtforms.validators.Required(), wtforms.validators.Length(min=6, max=30), wtforms.validators.EqualTo( 'confirm_password', 'Passwords must match.')]) confirm_password = wtforms.PasswordField( 'Confirm password', [wtforms.validators.Required()]) email = wtforms.TextField( 'Email address', [wtforms.validators.Required(), wtforms.validators.Email()]) #+END_SRC ** mediagoblin/templates/[...]/user.html :PROPERTIES: :BEAMER_envargs: [shrink = 12] :END: #+BEGIN_SRC html {% block mediagoblin_content %}
{% endblock %} #+END_SRC ** Why MongoDB? :PROPERTIES: :BEAMER_envargs: [shrink = 4] :END: - Actually little to do with scalability - Kind of the opposite (worried about scaling down) - More flexibility: *** Example :B_example: :PROPERTIES: :BEAMER_env: example :END: #+BEGIN_SRC python {"title": "Me talking until you are bored", "description": "blah blah blah", "media_type": "audio", "media_data": { "length": "2:30", "codec": "OGG Vorbis"}, "plugin_data": { "licensing": { "license": "http://creativecommons.org/[...]/"}}} #+END_SRC ** Thoughts on MongoKit - Pretty great - Good way to ensure structure while retaining flexibility - Not too fond of the indexing and migration stuff, we'll probably do it ourselves - Development slightly stagnant, but not completely - Doesn't bloat your documents at all - Hope it keeps going! ** Thoughts on Jinja2 - Like Django templating but extremely better: - Able to pass in arguments to function - Don't have to waste your time on superfluous tags - {% elif %} ** OStatus! http://ostatus.org - How we're going to do federation - Kind of a meta-standard - PubSubHubbub - Salmon - etc... - Already in use! - StatusNet / http://identi.ca - Google Buzz (largely) - Can go through this at end if have time :) # ** Why Python? (Why not?) # # - Hm, preaching to the choir. But not everyone thinks Python is a good idea. # - So instead: Why not? Deployability. # - Currently Python is not very deployable to non-python devs # - PHP: easy to deploy, you can just drop it in # - BUT: shared hosting is the past, virtual machines the future # - Abstract configuration of servers (a la Puppet?) maybe the solution? # ** But we are using Python # # - We know python, love python # - Founders have brought, real, live big projects to life in python: # - http://mirocommunity.org # - http://miroguide.org # - Miro itself (... a couple of us are Miro hackers) # - Most of Creative Commons' stuff # - As said, lots of work at Imaginary Landscape # - And a bunch more varied expeience from the non-founders # - We can do this. * State of the project / etc ** A bit on it being a GNU project - Wasn't originally a GNU project, was asked if I want to make it GNU - But I'm very proud the software is "GNU MediaGoblin" - web-wise, FOSS is winning in libraries and failing in applications - Vision of GNU 25 years ago, and mostly come true - Many of us rely on this dream come true for our dayjobs even - Do the ideas of GNU apply in the modern day? - A very interesting copyright assignment strategy ** Actual state of the project - 1 month private development - 1.5 months public dev - For that timeline, made some good progress: - a lot of good infrastructure - you can submit and view media - authentication system - start of a good theme - A lot of the best features still "in the future": - federation - multiple media types - Moving fast! * How do I get involved ** Okay, I want to get involved! We're off to a really great start but *we could use your help!* Getting started easier than you might think! See the "hacking howto" section of our docs especially. *** Join us! Contact us! :B_block: :PROPERTIES: :BEAMER_env: block :END: - Website :: http://mediagoblin.org - Join us :: http://mediagoblin.org/join/ <- ! - Docs :: http://docs.mediagoblin.org - IRC :: #mediagoblin on irc.freenode.net - Contact me :: http://dustycloud.org/contact/