Turning image's media manager into a new style class.
[mediagoblin.git] / docs / source / siteadmin / media-types.rst
CommitLineData
473a4431
CAW
1.. MediaGoblin Documentation
2
3 Written in 2011, 2012 by MediaGoblin contributors
4
5 To the extent possible under law, the author(s) have dedicated all
6 copyright and related and neighboring rights to this software to
7 the public domain worldwide. This software is distributed without
8 any warranty.
9
10 You should have received a copy of the CC0 Public Domain
11 Dedication along with this software. If not, see
12 <http://creativecommons.org/publicdomain/zero/1.0/>.
13
9bc2fc6c
CAW
14.. _media-types-chapter:
15
16====================
d34757dc 17Media Types
9bc2fc6c
CAW
18====================
19
20In the future, there will be all sorts of media types you can enable,
d34757dc
JW
21but in the meanwhile there are three additional media types: video, audio
22and ascii art.
9bc2fc6c
CAW
23
24First, you should probably read ":doc:`configuration`" to make sure
25you know how to modify the mediagoblin config file.
26
d34757dc
JW
27
28Enabling Media Types
29====================
30
31Media types are enabled in your mediagoblin configuration file, typically it is
32created by copying ``mediagoblin.ini`` to ``mediagoblin_local.ini`` and then
33applying your changes to ``mediagoblin_local.ini``. If you don't already have a
34``mediagoblin_local.ini``, create one in the way described.
35
36Most media types have additional dependencies that you will have to install.
37You will find descriptions on how to satisfy the requirements of each media type
38on this page.
39
40To enable a media type, edit the ``media_types`` list in your
41``mediagoblin_local.ini``. For example, if your system supported image and
42video media types, then the list would look like this::
43
44 media_types = mediagoblin.media_types.image, mediagoblin.media_types.video
45
9d5cd0b9
CAW
46Note that after enabling new media types, you must run dbupdate like so::
47
48 ./bin/gmg dbupdate
49
50If you are running an active site, depending on your server
51configuration, you may need to stop it first (and it's certainly a
52good idea to restart it after the update).
53
54
d34757dc
JW
55How does MediaGoblin decide which media type to use for a file?
56===============================================================
57
58MediaGoblin has two methods for finding the right media type for an uploaded
59file. One is based on the file extension of the uploaded file; every media type
60maintains a list of supported file extensions. The second is based on a sniffing
61handler, where every media type may inspect the uploaded file and tell if it
62will accept it.
63
64The file-extension-based approach is used before the sniffing-based approach,
65if the file-extension-based approach finds a match, the sniffing-based approach
66will be skipped as it uses far more processing power.
67
68
9bc2fc6c
CAW
69Video
70=====
71
72To enable video, first install gstreamer and the python-gstreamer
73bindings (as well as whatever gstremaer extensions you want,
3a8b18f8 74good/bad/ugly). On Debianoid systems
9bc2fc6c 75
3a8b18f8
JW
76.. code-block:: bash
77
78 sudo apt-get install python-gst0.10 \
79 gstreamer0.10-plugins-base \
80 gstreamer0.10-plugins-bad \
81 gstreamer0.10-plugins-good \
82 gstreamer0.10-plugins-ugly \
7798f911 83 gstreamer0.10-ffmpeg
582958e3 84
9bc2fc6c 85
5ef7ab08
CAW
86Add ``mediagoblin.media_types.video`` to the ``media_types`` list in your
87``mediagoblin_local.ini`` and restart MediaGoblin.
88
3a8b18f8
JW
89Run
90
91.. code-block:: bash
3fe3b222 92
5ef7ab08
CAW
93 ./bin/gmg dbupdate
94
9bc2fc6c
CAW
95Now you should be able to submit videos, and mediagoblin should
96transcode them.
97
7798f911
WKG
98.. note::
99
100 You almost certainly want to separate Celery from the normal
101 paste process or your users will probably find that their connections
102 time out as the video transcodes. To set that up, check out the
103 ":doc:`production-deployments`" section of this manual.
efd69313
CAW
104
105
d34757dc
JW
106Audio
107=====
108
109To enable audio, install the gstreamer and python-gstreamer bindings (as well
110as whatever gstreamer plugins you want, good/bad/ugly), scipy and numpy are
111also needed for the audio spectrograms.
112To install these on Debianoid systems, run::
113
114 sudo apt-get install python-gst0.10 gstreamer0.10-plugins-{base,bad,good,ugly} \
115 gstreamer0.10-ffmpeg python-numpy python-scipy
116
117The ``scikits.audiolab`` package you will install in the next step depends on the
118``libsndfile1-dev`` package, so we should install it.
3a8b18f8
JW
119On Debianoid systems, run
120
121.. code-block:: bash
d34757dc
JW
122
123 sudo apt-get install libsndfile1-dev
124
34a85313 125.. note::
8518e95e 126 scikits.audiolab will display a warning every time it's imported if you do
34a85313 127 not compile it with alsa support. Alsa support is not necessary for the GNU
8518e95e
JW
128 MediaGoblin application but if you do not wish the alsa warnings from
129 audiolab you should also install ``libasound2-dev`` before installing
130 scikits.audiolab.
34a85313 131
d34757dc
JW
132Then install ``scikits.audiolab`` for the spectrograms::
133
134 ./bin/pip install scikits.audiolab
135
136Add ``mediagoblin.media_types.audio`` to the ``media_types`` list in your
5ef7ab08
CAW
137``mediagoblin_local.ini`` and restart MediaGoblin.
138
3a8b18f8
JW
139Run
140
141.. code-block:: bash
3fe3b222 142
5ef7ab08
CAW
143 ./bin/gmg dbupdate
144
145You should now be able to upload and listen to audio files!
d34757dc
JW
146
147
efd69313
CAW
148Ascii art
149=========
150
151To enable ascii art support, first install the
152`chardet <http://pypi.python.org/pypi/chardet>`_
3a8b18f8
JW
153library, which is necessary for creating thumbnails of ascii art
154
155.. code-block:: bash
efd69313
CAW
156
157 ./bin/easy_install chardet
158
159
160Next, modify (and possibly copy over from ``mediagoblin.ini``) your
7798f911
WKG
161``mediagoblin_local.ini``. In the ``[mediagoblin]`` section, add
162``mediagoblin.media_types.ascii`` to the ``media_types`` list.
163
164For example, if your system supported image and ascii art media types, then
165the list would look like this::
efd69313
CAW
166
167 media_types = mediagoblin.media_types.image, mediagoblin.media_types.ascii
168
3a8b18f8
JW
169Run
170
171.. code-block:: bash
3fe3b222 172
5ef7ab08
CAW
173 ./bin/gmg dbupdate
174
efd69313 175Now any .txt file you uploaded will be processed as ascii art!
5ef7ab08
CAW
176
177
178STL / 3d model support
179======================
180
181To enable the "STL" 3d model support plugin, first make sure you have
182a recentish `Blender <http://blender.org>`_ installed and available on
183your execution path. This feature has been tested with Blender 2.63.
184It may work on some earlier versions, but that is not guaranteed (and
185is surely not to work prior to Blender 2.5X).
186
187Add ``mediagoblin.media_types.stl`` to the ``media_types`` list in your
188``mediagoblin_local.ini`` and restart MediaGoblin.
189
3a8b18f8
JW
190Run
191
192.. code-block:: bash
3fe3b222 193
5ef7ab08
CAW
194 ./bin/gmg dbupdate
195
196You should now be able to upload .obj and .stl files and MediaGoblin
197will be able to present them to your wide audience of admirers!
a80ebf3b
AL
198
199PDF and Document
200================
201
202To enable the "PDF and Document" support plugin, you need pdftocairo, pdfinfo,
203unoconv with headless support. All executables must be on your execution path.
204
205To install this on Fedora:
206
207.. code-block:: bash
208
209 sudo yum install -y ppoppler-utils unoconv libreoffice-headless
210
211pdf.js relies on git submodules, so be sure you have fetched them:
212
213.. code-block:: bash
214
215 git submodule init
216 git submodule update
217
218This feature has been tested on Fedora with:
219 poppler-utils-0.20.2-9.fc18.x86_64
220 unoconv-0.5-2.fc18.noarch
221 libreoffice-headless-3.6.5.2-8.fc18.x86_64
222
223It may work on some earlier versions, but that is not guaranteed.
224
225Add ``mediagoblin.media_types.pdf`` to the ``media_types`` list in your
226``mediagoblin_local.ini`` and restart MediaGoblin.
227
228Run
229
230.. code-block:: bash
231
232 ./bin/gmg dbupdate
233
234