2114 Commits

Author SHA1 Message Date
Elrond
5fe1fd0722 Create a fake MediaEntry.media_data for sql
So that the SQL backend is more useable, let the MediaEntry
have a faked media_data.
It's extremely fake: The returned dict is always a new one.
So any stored info is even lost!
2012-03-03 00:16:44 +01:00
Christopher Allan Webber
f4459ecfd8 Go go mediagoblin favico symmetry 2012-03-01 17:30:07 -06:00
Elrond
5ff575827b Video media_data: Change layout in the mongo world
Change the media_data for video from
entry.media_data["video"] to use entry.media_data directly.

Also start a bare MediaEntry.media_data_init(**kwargs)
method for setting up the media_data and possibly
initialising it with kwargs.
2012-03-01 22:25:41 +01:00
Elrond
94df840b3b SQL: Improve video media_data table
1. Make the foreignkey the primary_key.
2. Add width/height, as those are currently in use for the
   media_data
2012-03-01 21:58:49 +01:00
Joar Wandborg
10085b7739 Audio thumbnailing & spectrograms, media plugins use sniffing
* Added extlib/freesound/audioprocessing.py
* config_spec
  * Added create_spectrogram setting
  * Added media:medium and media:thumb max_{width,height} settings
* Added sniffing logic to
  - audio.processing:sniff_handler
  - video.processing:sniff_handler
* Changed audio.processing:sniff_handler logic
* Added audio thumbnailing functionality to audio.processing
  (works only with create_spectrogram enabled)
* Refractored contexts in audio.processing
* Added audio.transcoders:AudioThumbnailer
  Used for creating spectrograms and spectrogram thumbnails -
  Wadsworth's Constant, we meet again :)
* audio.transcoders:AudioTranscoder
  - Added mux_string kwarg
  - Delete self.pipeline on self.halt()
* Changed str.format formatting in image.processing:sniff_handler
  Had {1} without an {0}, changed to {0}
* Refractored VideoTranscoder to use transcode() for transcoding instead
  of __init__()
* Added discover() method to video.transcoders:VideoTranscoder
* Added spectrogram display to media_displays/audio.html
* Updated test_submission to reflect changes in media plugin delegation
2012-02-28 21:59:38 +01:00
Elrond
2bc8ff0d63 Cleanup Session after each request.
It's good practice to cleanup the SQL session after each
request so that the next request gets a fresh one.

It's an application decision whether one wants a
just-in-case ROLLBACK or COMMIT. There are two ideas behind
it, really. I have decided for ROLLBACK. The idea is "if
you forget to commit your changes yourself, there's
something broken. Maybe you got an exception?".
2012-02-28 20:52:35 +01:00
Elrond
3502958113 Attachment support in the SQL backend
attachments working with the sql backend.

- SQL Schema for attachment files, ordering attachments by
  their name, not by the submission order (as earlier).
- Dot-Notation for attachments, where missing.
- convert existing attachments over from mongo -> sql
2012-02-28 20:52:35 +01:00
Christopher Allan Webber
e9f87f728c Fix tests given recent celery "case" change 2012-02-28 13:31:03 -06:00
Luke Slater
4f9f969dec Accidentally overwrote the celery/__init__.py, fixed this and removed the upper correctly 2012-02-28 16:47:38 +00:00
Luke Slater
6bcdd4dc70 Changed celery config keys to upper case and removed upper casing of keys when initialising the config as per issue #214 2012-02-28 16:40:37 +00:00
Elrond
baae1578da Let mark_entry_failed log unknown exceptions
I don't know exactly why, but an exception during
processing hasn't found its way up. The entry was marked as
failed and that was it. So I decided to add a _log.warn to
the part of mark_entry_failed that handles general
exceptions.
2012-02-27 23:16:08 +01:00
Elrond
34344f1d85 Merge remote-tracking branch 'cwebber/celerysql'
* cwebber/celerysql:
  Adjust unit tests to match new celery/kombu sqlalchemy setup
  "database" is not the sqlalchemy kombu transport... should be "sqlalchemy"
  Celery and kombu databases should also be .gitignore'd
  kombu-sqlalchemy a requirement in order for kombu sqlalchemy transport to work
  Move mediagoblin dbs out of user_dev for race condition directory-creation reasons.
  Give kombu its own db.  Responding to Elrond "sqlite will lock all the time!" :)
  Apparently an absolute path is three slashes after sqlite:.  Thx elrond.
  Should be all that's needed to switch celery/kombu settings to sqlalchemy
2012-02-27 21:55:02 +01:00
Christopher Allan Webber
6b38a38a91 Committing extracted and compiled translations 2012-02-26 15:51:11 -06:00
Christopher Allan Webber
42d0d8f3cd Committing present MediaGoblin translations before pushing extracted messages 2012-02-26 15:51:00 -06:00
Christopher Allan Webber
a9a63a686e Adjust unit tests to match new celery/kombu sqlalchemy setup 2012-02-26 15:45:58 -06:00
Christopher Allan Webber
b8e1abf782 "database" is not the sqlalchemy kombu transport... should be "sqlalchemy" 2012-02-26 13:27:09 -06:00
Christopher Allan Webber
a68e3e8320 Celery and kombu databases should also be .gitignore'd 2012-02-26 13:26:44 -06:00
Christopher Allan Webber
b594eadfbf kombu-sqlalchemy a requirement in order for kombu sqlalchemy transport to work 2012-02-26 13:25:02 -06:00
Elrond
c60bbe07c5 Let SQL objects support .setdefault() and .delete()
Some parts in the code like to use .setdefault(). So make
them happy and provide a minimal version. It ignores the
given default and expects the attribute to already exist.

Other parts use .delete() to delete a complete object. This
version expects the object to live in a session and also
does the final commit.
2012-02-26 19:46:44 +01:00
Elrond
8efcd40558 Dot-Notation: MediaComment and some random places 2012-02-26 19:19:48 +01:00
Elrond
ec97c937b7 Let Main Server emit startup notice including version
There was no place in the software telling the user the
version in use. So start by having the main server emit a
startup notice including the version string. Uses python
logging, so should be easy to reconfigure, etc.
2012-02-26 18:45:35 +01:00
Christopher Allan Webber
b2a7e44c9e Move mediagoblin dbs out of user_dev for race condition directory-creation reasons. 2012-02-26 08:20:17 -06:00
Christopher Allan Webber
b94dfe4cbf Give kombu its own db. Responding to Elrond "sqlite will lock all the time!" :) 2012-02-26 07:58:40 -06:00
Christopher Allan Webber
200abf856b Apparently an absolute path is three slashes after sqlite:. Thx elrond.
sqlite:///////////////////////////////////whaaaaaa.db
2012-02-26 07:46:23 -06:00
Christopher Allan Webber
e629cde0b3 Should be all that's needed to switch celery/kombu settings to sqlalchemy 2012-02-25 22:39:38 -06:00
Elrond
58f96a13e4 Allow .id instead of ._id for the Mongo backend
To allow easier migration to the SQLAlchemy style .id give
the User and MediaEntry mongo classes an alias attribute of
.id that maps to ['_id'].

Use it in the upload process, because this was one of the
last positions with a ['_id'] instead of ._id (due to a bug
in mongokit).
2012-02-25 14:10:57 +01:00
Elrond
9891351256 Create "gmg convert_mongo_to_sql" command
Finally, to make testing of sql a bit easier, create a
bin/gmg command to do the conversion from mongo to sql.
It's currently named "convert_mongo_to_sql".

The most important option is the gmg -cf option to give a
configfile with the appropiate sql_engine definition.
2012-02-23 23:49:09 +01:00
Elrond
1582181701 mongo to sql convert: Better Ordering
Order the conversion by the "created" attribute. That way
the sql ids are mostly in the order they would have been,
if sql was used earlier.

Makes things nicer to look at in a db dump.
2012-02-23 23:44:13 +01:00
Elrond
572d4f01ff Use task_id in generating the queue file path
The task_id is created anyway as a UUID. So it is very
unique per definition. The only thing needed for the queue
file path is a unique part.

Before the objectid of the MediaEntry was used instead. But
in the sql world the objectid is only available after an
"insert" on the db. And creating the queue_file_path
afterwards would require an "update" on the db. We can save
that. ... for now.
2012-02-21 20:47:26 +01:00
Jef van Schendel
ee9a0e3c78 Forgot to add these layout changes. Everything should work now. 2012-02-21 18:09:38 +01:00
Jef van Schendel
aa8804719c Resolve merge conflicts 2012-02-21 17:43:05 +01:00
Christopher Allan Webber
99812bbc4a We now require sqlalchemy and sqlalchemy-migrate 2012-02-19 15:30:38 -06:00
Christopher Allan Webber
d2506eebb4 Commenting out the migrations that don't exist yet 2012-02-18 23:19:41 -06:00
Christopher Allan Webber
3ea1cf36fc Updates so that dbupdate command works
- Various fixes to dbupdate itself
 - Switching db/sql/migrations.py to use a dict instead of a list
 - Registering the function
2012-02-18 23:19:09 -06:00
Christopher Allan Webber
4d8be4fe0d Merge branch 'master' into sqlmigrate 2012-02-18 15:33:29 -06:00
Elrond
a45631e3f3 Start having useful defaults for SQL
Mostly this means: Havintg a config_spec.ini that has a
local (relative to mediagoblin.ini) sqlite db with the name
"mediagoblin.db".

Also:
- Add to .gitignore
- Add a notice to mediagoblin.ini about the db
2012-02-18 19:34:11 +01:00
Elrond
6456cefa0d Fix MediaTag __init__ to handle no args
Let the init code also handle createing a fresh clean
instance without any attrs set.
2012-02-18 19:34:11 +01:00
Elrond
cf27accc9e SQL: fail_metadata as JSON encoded field
fail_metadata used to be a dict in mongo. So a json encoded
field should be okay too.

We could use a pickled field instead, which would be more
flexible.
2012-02-18 19:29:01 +01:00
Christopher Allan Webber
63352aaf70 Merge branch 'master' into sqlmigrate
Conflicts:
	mediagoblin/db/sql/models.py
2012-02-18 10:01:47 -06:00
Jef van Schendel
6c2e57304c Responsive thumbnail gallery time 2012-02-18 14:46:12 +01:00
Elrond
feba5c5287 Drop pre-rendered html: MediaComment.content_html
After a bit of discussion, we decided to drop the
pre-rendered html from the database and render it on
the fly.

In another step, we will use some proper caching method to
cache this stuff.

This commit affects the MediaComment.content_html part.
2012-02-18 12:50:30 +01:00
Elrond
1e72e075f8 Drop pre-rendered html: MediaEntry.description_html
After a bit of discussion, we decided to drop the
pre-rendered html from the database and render it on
the fly.

In another step, we will use some proper caching method to
cache this stuff.

This commit affects the MediaEntry.description_html part.
2012-02-18 12:41:25 +01:00
Elrond
e61ab0998b Drop pre-rendered html: User.bio_html
After a bit of discussion, we decided to drop the
pre-rendered html from the database and render it on
the fly.

In another step, we will use some proper caching method to
cache this stuff.

This commit affects the User.bio_html part.
2012-02-18 12:35:30 +01:00
Joar Wandborg
9f46a79dde Removed old audio.transcoder file (the real one is audio.transcoders) 2012-02-16 18:59:55 +01:00
Joar Wandborg
92f129b5c7 Added sniffing logic for image media type
For now, it's a re-implementation of the old file-extension checking
logic, as I have not found a GStreamer-like "discoverer" in PIL.
2012-02-16 18:43:15 +01:00
Jef van Schendel
3d44c01ad6 Enlarge navigation buttons when mobile 2012-02-15 18:47:34 +01:00
Jef van Schendel
5cbf73aaca Change button style in edit.html 2012-02-15 18:44:38 +01:00
Jef van Schendel
f4cbe074fa Simplify and fix button styles; add larger button styles for mobile 2012-02-15 17:30:32 +01:00
Jef van Schendel
b6a686913f Removed cancel_link class; slight changes to button_form style 2012-02-15 17:15:42 +01:00
Joar Wandborg
ec4261a449 Changed media processing delegation to a 'sniffing' method
- Added sniff handlers to all media plugins
  All of them except audio returning False for ANYTHING
  at the moment.
2012-02-15 01:15:29 +01:00