177 Commits

Author SHA1 Message Date
Christopher Allan Webber
33ddf4b1ef Moving the get_original_date method over to the MediaManager.
This fixes a bug so that it doesn't explode if the media_data doesn't
exist.

This commit sponsored by Ole-Morten Duesund.  Thank you!
2013-05-11 17:02:26 -05:00
Christopher Allan Webber
058226d0d2 Merge remote-tracking branch 'refs/remotes/tryggvib/532-exif-creation-date'
Conflicts:
	mediagoblin/config_spec.ini
	mediagoblin/templates/mediagoblin/user_pages/media.html
2013-05-11 13:48:42 -05:00
Elrond
d13cd99483 Fix typo in new stl MEDIA_MANAGER. 2013-05-02 23:38:07 +02:00
Elrond
7eec77ca90 Fix media manager reference in video.
An uninstantiated bare media manager doesn't any more
support ["something"]. You need to do .something.
Fixed for .source_type().
2013-04-30 23:44:56 +02:00
Praveen Kumar
761389507d Make all media types use the new MediaManager classes. 2013-04-30 22:09:25 +02:00
Elrond
8f88b1f6dc Rewrite resize_image to use proc_state.store_public.
This hopefully makes the code nicer and easier to change.
2013-04-27 17:25:39 +02:00
Elrond
3b359dddc7 image resizing: Refactor some decisions into resize_tool.
Loading the thumb/medium sizes from the config, saving
things to the db, and loading the image is now all done by
resize_tool. It still calls resize_image for the actual
work.
2013-04-27 17:19:50 +02:00
Elrond
c82a8ba54f resize_image: Change calling style a bit.
- entry: not used, removed.
- proc_state: going to be used, added.
- size_limits: not used, removed.
2013-04-24 15:20:32 +02:00
Elrond
dc1ec36eb9 resize_image: Refactor config loading a small bit.
Well, get the config into a local variable, for easier access.
2013-04-21 19:26:57 +02:00
dunkyp
35f6d6a750 image quality can be set in config file
(cherry-picked from
 https://gitorious.org/~dunkyp/mediagoblin/dunkyps-mediagoblin/commits/image_quality)
2013-04-20 10:54:13 -05:00
Elrond
4c7b9420ab stl:blender_render() - Remove useless arg_string. 2013-04-17 22:08:10 +02:00
Elrond
f84425c0c1 Turning image's media manager into a new style class.
images are the first media type to use the new style class
based media manager.
2013-04-17 12:09:30 +02:00
Elrond
95dab599da Add sniff_handler method to mediamanagers.
The MediaManagerBase gets a fallback "return False" one.
The Compat-Manager checks in the dict and calls that one or
returns False.
2013-04-17 12:09:30 +02:00
Elrond
6d37733a3f Add MediaManagerBase class.
This is the base class for all new style class based media
managers.
2013-04-17 12:08:53 +02:00
Elrond
e8676fa383 MediaManager: Use .foo instead of ['foo'].
To make .media_fetch_order work, create a property.
2013-04-17 12:08:53 +02:00
Elrond
2077d6ed93 First step towards a MediaManager class: Compat one.
To get us moving towards a MediaManager class, the first
idea is to create a class that wraps our current dict based
manager and makes all users happy.
2013-04-17 12:08:52 +02:00
Alon Levy
d0e9f843e2 PIL: Support systems with Pillow and without
Fixes for systems with Pillow, but leaves a "try: except ImportError" to
support anything that doesn't have a PIL top level import.

Signed-off-by: Alon Levy <alon@pobox.com>
2013-04-17 12:54:54 +03:00
Alon Levy
519bcfb0e6 pdf/processing.py: don't use check_output, only in python>=2.7
Signed-off-by: Alon Levy <alon@pobox.com>
2013-04-17 12:47:28 +03:00
Christopher Allan Webber
1d1276be79 Removing unused imports and an unused media_files dict reference 2013-04-15 15:31:22 -05:00
Alon Levy
a80ebf3b64 add pdf media type
The new media type supports pdf and a subset of media recognized by libreoffice via
unoconv.

Every document added goes through:
* conversion to pdf with unoconv if not already a pdf
* creation of thumbnail and medium sized image, and pdfinfo generates
 some information (even for unoconv produces docs - should fix this)

Poppler (pdftocairo, pdfinfo) is used.  http://poppler.freedesktop.org/

A working but uglified pdf.js integration exists, which is enabled by
setting pdf.pdf_js=true mediagoblin_local.ini (disabled in mediagoblin.ini)

Adds one test to the test_submission test suite, and another separate test_pdf suite.
The tests are only run if media_types.pdf.processing.check_prerequisites passes, so
the test suite will not require any extra package.

TODO: make test suite say 'skipped' in that case instead of just 'ok'

Signed-off-by: Alon Levy <alon@pobox.com>
2013-04-15 09:51:21 +03:00
Elrond
2dd0af3635 Merge remote-tracking branch 'cwebber/254_delete_queue_directories'
* cwebber/254_delete_queue_directories:
  Removing docstring bit about delete_file possibly deleting directories in the future
  Convert media processing backends to delete the queue directory (#254)
  Implement delete_dir in the FileStorage

Conflicts:
	mediagoblin/media_types/image/processing.py
	mediagoblin/media_types/video/processing.py

Conflicts, because those media_types already use the newer
proc_state.delete_queue_file() method (which needs
updating.
2013-04-08 15:57:06 +02:00
Elrond
af0b508c75 Little refactoring for images: media_files.
Set the media_files directly at the relvant places.
2013-04-03 18:49:46 +02:00
Christopher Allan Webber
126c3503a0 Merge remote-tracking branch 'aeva/671_fix_stl' 2013-03-25 08:01:11 -05:00
Aeva Ntsc
50d123b4be Ascii stl files now should have their whitespace stripped when parsing. 2013-03-25 07:55:24 -05:00
Aeva Ntsc
eacb9c4886 Fixed a bug that had binary stls be handled by the ascii stl parser. 2013-03-24 16:12:55 -05:00
Joar Wandborg
b06ea4ab46 Updated VideoThumbnailerMarkII, removed old
Removed the old VideoThumbnailer since it's not used anymore.

VideoThumbnailerMarkII:
Changed the state switching in on_thumbnail_message to only set the
state to "processing thumbnail" if the seek was succesful.

I'm not sure what I'm doing here, but I know at least some of it is
good, and as a whole, it seems to work, so far :)
2013-03-24 18:49:05 +01:00
Christopher Allan Webber
d0ceb506bd Fixing dates when uploaded in a video to a mediagoblin instance.
There were some "serializing to json strings" issues.  They should be
fixed now... much more careful whitelist and cleaning of the video
"tags" metadata out of gstreamer.

This commit sponsored by Aimee Sullivan.  Thanks!
2013-03-11 16:54:41 -05:00
Christopher Allan Webber
7bf229267d Making a fix so that video codec name switched from "vp8 video" to "vp8"
"vp8 video" is what vp8 is marked as in gstreamer's metadata.
However, the browser expects it just as the name "vp8".  So fixing
that.

This commit sponsored by Tyng-Ruey Chuang.  Thank you!
2013-03-06 12:05:40 -06:00
Christopher Allan Webber
f51a416778 Removing an unnecessary video write
In the case of if we're skipping transcoding, we don't need to copy
this file at all!

This commit sponsored by Frank Zambrini III.  Thanks!
2013-03-04 11:53:04 -06:00
Christopher Allan Webber
4f239ff194 Another elrond suggestion: only init orig_metadata if there's anything in the dict.
This commit sponsored by Joshua Rosen.  Thank you!
2013-03-03 14:29:30 -06:00
Christopher Allan Webber
9d4cebfd36 Per Elrond's suggestions moving DEFAULT_WEBM_TYPE to media manager
The reason for this is to avoid defining this twice as we were
previously (once in the template, once in video/models.py)

This commit sponsored by Roland McIntosh.  Thank you!
2013-03-03 14:27:36 -06:00
Christopher Allan Webber
787aafd644 Extrapolate type= based on the video metadata that we have, if we can.
It's kind of awkward because it relies on there being a entry.media_data,
but that's not guaranteed... (see http://issues.mediagoblin.org/ticket/650)
so we use a dopey fallback in the template in that case (kind of
annoying info duplication).

This commit sponsored by Piotr Wieczorek.  Thank you!
2013-03-03 11:41:40 -06:00
Christopher Allan Webber
3ff006ef3b pdb.set_trace() in mediagoblin code is Not Allowed(TM), removing from audio code
Of course, the version that appears here is not really dangerous
because it's for the "call the file individually" form of debugging,
but it isn't allowed anyway.

This commit sponsored by Michael Faryniarz.  Thanks!
2013-03-03 10:38:06 -06:00
Christopher Allan Webber
29adab4651 Now store metadata info from processing into the media type.
This comes in several parts:
 - Store the metadata from gstreamer during processing
 - Add a new JSONEncoded field to the VideoData table
 - And, of course, add a migration for that field!

This commit sponsored by Julius Tuomisto.  Thank you, Julius!
2013-03-03 10:36:37 -06:00
Christopher Allan Webber
ddbf6af1e2 Huge amount of work to (mostly) allow .ogg (and maybe other) formats to skip transcode
- Update get_display_media in several ways:
   - now uses the media type's own declaration of the order of things
   - returns both the media_size and the media_path, as per the docstring
   - implicitly uses self.media_files as opposed to forcing you to pass it in
 - update videos to use get_display_media
 - update images to declare media_fetch_order in the media manager (videos also)
 - update stl to use media.media_files['original'] instead of weird
   use of get_display_media
 - update sidebar to only conditionally show webm_640

TODO still: identify video type information *during* processing, show
that in the <video><source /></video> element.

This commit sponsored by Nathan Yergler.  Thanks, nyergler!
2013-03-02 19:06:31 -06:00
Christopher Allan Webber
fd693e368b If we're not transcoding, copy this file directly over to ['original']
There's no reason to copy it over to 'webm_640' in such a case,
clearly.

Added logic so we don't do it twice either.

Haven't tested this yet though ;)

This commit sponsored by Algot Runeman.  Thank you!
2013-03-01 17:28:07 -06:00
Christopher Allan Webber
ed6344009a Merge branch 'master' into joar-skip_transcoding
Conflicts:
	mediagoblin/config_spec.ini
2013-03-01 16:29:22 -06:00
Joar Wandborg
6bdf9a1044 Allow media managers without sniff_handler 2013-02-27 00:30:51 +01:00
Joar Wandborg
8d355df617 Tuned logging and added comments to 511 fix 2013-02-10 20:19:13 +01:00
pythonsnake
34c35c8cec Fixed issue #511. 2013-02-10 20:11:47 +01:00
Christopher Allan Webber
591c116098 Merge remote-tracking branch 'refs/remotes/elrond/sql/media_data' 2013-02-09 15:33:06 -06:00
Elrond
fb46fa663d Kill monkeypatching of ProcessingState.
And change the process_foo() API to accept a
processingstate now.

image and video are tested, the others are UNTESTED.
2013-02-08 10:09:37 +01:00
Elrond
715ea49546 Also refactor "copy original into public storage".
This makes the processing code easier to read/write and
alos will help the reprocessing once we get to it.

Thanks to Joar Wandborg for testing!
2013-02-08 10:09:37 +01:00
Elrond
bfd68cce85 Use ProcessingState for video.
Rewrite video to use the new ProcessingState.

Thanks to Joar Wandborg for testing!
2013-02-08 10:09:37 +01:00
Elrond
93b14fc300 Implement ProcessingState class and use for images
The idea is to have a class that has the knowledge of the
currently being processed media and also has tools for
that.

The long term idea is to make reprocessing easier by for
example hiding the way the original comes into the
processing code.
2013-02-08 10:05:42 +01:00
Elrond
1f268deda4 Turn media.{backref_nam} from a list to a scalar.
For all our media_types, let the backref on the media_entry
be a scalar (there is only one media_data per media_entry)
instead of a list with zero or one entry.

The media_data toolchain on MediaEntry currently handles
both transparently.
2013-02-01 22:02:35 +01:00
Joar Wandborg
d63cc34e71 Made pil_filters a PIL_FILTERS (global) 2013-01-22 23:28:17 +01:00
Joar Wandborg
7cd7db5af4 Made the image sampling filter configurable
- Changed the default to BICUBIC instead of previous ANTIALIAS
2013-01-22 23:28:17 +01:00
Joar Wandborg
5c754fdaee Added option to skip transcoding
- If the video input matches the configurable rules, just copy it to the
  output without transcoding it.
2013-01-22 23:03:14 +01:00
Sebastian Spaeth
36ae6bcbbb Convert media processing backends to delete the queue directory (#254)
We never deleted our queue directory which were created per submission.
With the FileStorage backend being able to delete directories now, we can
request the deletion of the task directory too. It will only be deleted if
it is completely empty.
2013-01-22 14:05:54 -06:00