2275 Commits

Author SHA1 Message Date
Elrond
7b82f56bae Fix cyclic import issue.
Oh well:

tools.exif -> processing -> db.util -> db.models -> db.mixin -> tools.exif

So import tools.exif locally in exif_display_iter()
2012-03-23 20:28:11 +01:00
Elrond
5bad26bc47 Create MediaEntry.exif_display_iter()
MediaEntry.media_data.exif_all will contain all the
"clean" EXIF data.

MediaEntry.exif_display_iter() is an iterator that fetches
the most interesting entries for display from that data.
2012-03-23 20:20:54 +01:00
Elrond
e0b0588fb1 image_mediadata: Add exif_all column 2012-03-23 19:22:28 +01:00
Elrond
e0e7232af9 Add copyright header to image/models.py 2012-03-23 19:22:28 +01:00
Jakob Kramer
fbf56c1a5d correct wrong version number
(`-dev' instead of `.dev')
2012-03-23 18:15:46 +01:00
Elrond
99c2f9f0c4 New media_data row needs to know its MediaEntry's id.
When creating a new media_data row, the new row needs to
know the MediaEntry it is associated with. I have no idea,
why this worked before at all. Maybe some implicit tricks
by sqlalchemy?
2012-03-22 21:21:38 +01:00
Joar Wandborg
a9d84d4cb7 Faster sniffing
- Sniffing now goes through the old extension-based filter before
  doing it the bitsniffing way.
- Refractored get_media_type_and_manager(filename).
- Removed ogg extension from video accepted extensions, audio
  will take care of that.
- Added custom audio player, still WIP,but working.
- Added test for sniffing. This only tests for the
  mediagoblin.media_types.image type, as that is the only
  one enabled from start.
2012-03-22 01:27:19 +01:00
Elrond
ecd538bb65 Add index=True for some columns.
These are the columns that seem to make the most sense to
have an index on them.
2012-03-21 22:46:38 +01:00
Elrond
e136ad3ed6 Finally load all models.
Load all models for the media_types. This was stopped by a
celery problem. But that is now fixed.
2012-03-21 21:48:09 +01:00
Elrond
32adc9b2a7 Panel: Find "unprocessed" not "processing" entries.
Our entries in the queue are marked as "unprocessed" and
not as "processing" as the panel code wanted it to be. So
search for the correct string.
2012-03-21 12:17:57 +01:00
Elrond
4114e54df5 And fix the in-celeryd import.
So that celeryd also loads the task.
2012-03-21 12:17:52 +01:00
Elrond
eace050a7d Move celery task into own task.py
Move the actual celery task from processing/__init__.py
into its own .../task.py. That way it can be imported as
needed.
2012-03-21 12:12:07 +01:00
Elrond
4bdee988b6 Turn processing.py into a submodule.
processing.py -> processing/__init__.py

This is in preparation for splitting processing a bit.
The main reason for the split is celery setup: celery needs
to be setup before even importing and importing and
subclassing some of its parts. So it's better to move the
critical parts into their own submodule and import it as
late as needed.
2012-03-21 12:11:58 +01:00
Christopher Allan Webber
8839540656 Merge remote-tracking branch 'refs/remotes/brett/bug270-lazycelery-script' 2012-03-20 23:24:43 -05:00
Brett Smith
6573573dd1 Add tests for image processing. Check filenames and image sizes.
This test helps verify that bug #261 is actually fixed.

In order to test that all the processed images are smaller, I needed to add
an image that's bigger than processing.MEDIUM_SIZE, hence bigblue.png.
2012-03-20 23:59:28 -04:00
Brett Smith
e75d4a0dd5 Make a function to generate test image filenames. 2012-03-20 23:03:11 -04:00
Brett Smith
d1f52dc776 Prefer nose assert_* methods to the assert built-in. 2012-03-20 22:40:32 -04:00
Brett Smith
c373903494 Refactor false image tests. 2012-03-20 22:36:56 -04:00
Brett Smith
c0e87ec9d2 Refactor normal upload tests.
This is nice because it means we do *all* the normal sanity tests for *all*
the normal uploads.  check_url() can be used in other tests too.
2012-03-20 22:30:57 -04:00
Brett Smith
77445d13ad Refactor MediaEntry fetches/checks into check_media(). 2012-03-20 22:16:28 -04:00
Brett Smith
31dd6013b8 Refactor data posts into one do_post function.
All the data posts in these tests had a lot of common code.  Putting all
that into a function makes it easier to write more tests (which I'll be
doing in a bit) and see what's really being tested.
2012-03-20 22:07:32 -04:00
Elrond
8fd81053b4 More standard media_data model for ascii.
ascii doesn't use media_data at all. So it needs the most
basic media_data model. Fix it to take the current form.
2012-03-20 23:55:28 +01:00
Elrond
b829595334 Create load_models().
So all models are ready when connecting to the db and so
our "db" object has all models listed on it, create a
function to load all models from the media_types, etc. Call
it in setup_database()

Problem: This gives celery warnings, because celery is
imported before being setup properly. No idea how to fix
this now. So media-type loading is excluded from
load_models for now.
2012-03-20 12:45:40 +01:00
Elrond
39fd817ab8 Import "Base" from base instead of models.
Import the "Base" class for models from db.sql.base instead
of db.sql.models.
2012-03-20 12:45:40 +01:00
Elrond
df7c405845 Disable query logging for now, so we get nicer logs
As the queries are quite verbose, disable them for now.
Reenabling them should be done in the central logging
config, which is another story for celery and bin/gmg.
2012-03-20 12:45:40 +01:00
Jakob Kramer
6b45ec1b0c 500 error because of subscripting instead of using attributes 2012-03-18 22:28:22 +01:00
Christopher Allan Webber
5f08116352 Committing extracted and compiled translations 2012-03-18 15:16:37 -05:00
Christopher Allan Webber
50fd85967f Committing present MediaGoblin translations before pushing extracted messages 2012-03-18 15:16:03 -05:00
Christopher Allan Webber
9dcd8436a9 Fixing manual tyop: MediaGoblin, not MediaGobiin (thanks gandaro!) 2012-03-18 14:39:35 -05:00
Christopher Allan Webber
94e6052375 Merge branch 'master' into derek-moore-bug405_email_notifications_for_comments
Conflicts:
	mediagoblin/db/mongo/migrations.py
2012-03-18 12:12:41 -05:00
Christopher Allan Webber
54477b4d76 Removing print statements from convert_gps_media_data migration
Kind of useful to see but... I don't think they're needed, and I'm not
super comfortable with print statements being in migrations.  Seems
semi bloated!
2012-03-18 12:07:41 -05:00
Brett Smith
176f207b63 small readability improvements in resize_image 2012-03-18 09:35:14 -04:00
Brett Smith
063670e9b4 Refactor image resize code, with better filenames (#261)
The code to make thumbnail- and medium-sized images in processing.py is
pretty similar, so I rolled that out into a separate function that we call
with different arguments as appropriate.

The new function should work identically to the old code, except it saves
images with filenames based on the original filename, like
`foobar.medium.jpg` instead of just `medium.jpg`.  This fixes bug #261.
2012-03-17 23:43:46 -04:00
Brett Smith
e4df2fc5b3 Refactor lazyserver.sh to lazystarter.sh and provide lazycelery.sh (#270)
Bug #270 asks for a lazycelery.sh script much like lazyserver.sh.  Rather
than duplicate the code, I consolidated them into a single script,
lazystarter.sh.  The script reconfigures itself a bit, and runs a
particular server, based on the name that's used to call it, but no matter
what it uses the same code to offer help and find configuration files and
server launchers.  Hopefully this will make it easy to add other
features/fix bugs as needed in the future, and have them stay in sync.
2012-03-17 22:33:08 -04:00
Elrond
7bf819a995 Let convert_mongo_to_sql add Migration Records
The mongosql tool is really dumping directly into the sql
database and is trying not to use too much logic that might
change later.

So this means, it needs to create the migration records on
its own!
So add a bunch of records with version=0.
2012-03-17 23:45:29 +01:00
Christopher Allan Webber
16fca040d5 Merge remote-tracking branch 'brett/bug264-delete-comments-with-media' 2012-03-17 17:18:15 -05:00
Christopher Allan Webber
2011f2d89e Merge branch 'master' of gitorious.org:mediagoblin/mediagoblin 2012-03-17 17:09:26 -05:00
Christopher Allan Webber
9e55431143 mongo->sql conversion script now runs mongo migrations first, just in case 2012-03-17 17:08:46 -05:00
Jef van Schendel
327a1bb279 Remove sidedata class from html pages 2012-03-17 22:58:33 +01:00
Christopher Allan Webber
4a250dbdde Also ignore the /share/ directory 2012-03-17 16:57:18 -05:00
Jef van Schendel
4c417c59b3 Small styling change for sidebar data 2012-03-17 22:56:25 +01:00
Christopher Allan Webber
2f5ce68c6c Make mediagoblin SQL models all use a consistent table naming scheme 2012-03-17 16:56:23 -05:00
Brett Smith
a0a7f87f62 When media is deleted, delete associated comments too.
The actual code is just a simple for loop; there might be a better
implementation but this is a fine start.  I also extended test_delete to
check this too.
2012-03-17 17:53:00 -04:00
Christopher Allan Webber
431811eb36 Mongosql imports made celery get set up before we wanted it via ./bin/gmg commands
Just moved the import into the actual function.  That resolved the issue!
2012-03-17 12:31:11 -05:00
Elrond
416b439fc8 More/better translation.
- Try to preserve some translations (somehow).
- Mark "Tagged with" again for translation.
- Do not translate the empty string
2012-03-17 13:18:43 +01:00
Jef van Schendel
7e5a5acd5a Small formatting changes to footer text. 2012-03-16 23:05:30 +01:00
Elrond
07163593ee Create function to search media by slug.
Searching media by slug is easy on mongo. But doing the
joins in sqlalchemy is not as nice. So created a function
for doing it.

Well, and create the same function for mongo, so that it
also works.
2012-03-16 21:20:14 +01:00
Elrond
d8409c26a0 Fix for mongo.
pymongo does not rewind a cursor after leaving a for loop.
So let us do it by hand. Well.
2012-03-16 21:20:14 +01:00
Elrond
1eff10fa0f More efficient first element fetching and Dot-Notation.
_get_tag_name_from_entries:
1) Replace:
     if q.count():
       elem = q[0]
   by:
     for element in q:
       ...
       break

   this doesn't do two db queries but only one.

2) And another dose of Dot-Notation as usual.
2012-03-16 21:20:14 +01:00
Elrond
1b4d9edaef Fix _get_tag_name_from_entries().
Replace == by =.
2012-03-16 21:19:25 +01:00