Fixed Copyright Headers
[mediagoblin.git] / docs / source / siteadmin / commandline-upload.rst
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
14 ======================
15 Command-line uploading
16 ======================
17
18 If you're a site administrator and have access to the server then you
19 can use the 'addmedia' task. If you're just a user and want to upload
20 media by the command line you can. This can be done with the pump.io
21 API. There is `p <https://github.com/xray7224/p/>`_, which will allow you
22 to easily upload media from the command line, follow p's docs to do that.
23
24 To use the addmedia command::
25
26 ./bin/gmg addmedia username your_media.jpg
27
28 This will submit the file "your_media.jpg" to be a media entry
29 associated with the user "username".
30
31 You can get help on all the available options by running::
32
33 ./bin/gmg addmedia --help
34
35 Here's a longer example that makes use of more options::
36
37 ./bin/gmg addmedia aveyah awesome_spaceship.png \
38 --title "My awesome spaceship" \
39 --description "Flying my awesome spaceship, since I'm an awesome pilot" \
40 --license "http://creativecommons.org/licenses/by-sa/3.0/" \
41 --tags "spaceships, pilots, awesome" \
42 --slug "awesome-spaceship"
43
44 You can also pass in the `--celery` option if you would prefer that
45 your media be passed over to celery to be processed rather than be
46 processed immediately.
47
48 ============================
49 Command-line batch uploading
50 ============================
51
52 There's another way to submit media, and it can be much more powerful, although
53 it is a bit more complex.
54
55 ./bin/gmg batchaddmedia admin /path/to/your/metadata.csv
56
57 This is an example of what a script may look like. The important part here is
58 that you have to create the 'metadata.csv' file.::
59
60 media:location,dcterms:title,dcterms:creator,dcterms:type
61 "http://www.example.net/path/to/nap.png","Goblin taking a nap",,"Image"
62 "http://www.example.net/path/to/snore.ogg","Goblin Snoring","Me","Audio"
63
64 The above is an example of a very simple metadata.csv file. The batchaddmedia
65 script would read this and attempt to upload only two pieces of media, and would
66 be able to automatically name them appropriately.
67
68 The csv file
69 ============
70 The location column
71 -------------------
72 The location column is the one column that is absolutely necessary for
73 uploading your media. This gives a path to each piece of media you upload. This
74 can either a path to a local file or a direct link to remote media (with the
75 link in http format). As you can see in the example above the (fake) media was
76 stored remotely on "www.example.net".
77
78 Other internal nodes
79 --------------------
80 There are other columns which can be used by the script to provide information.
81 These are not stored as part of the media's metadata. You can use these columns to
82 provide default information for your media entry, but as you'll see below, it's
83 just as easy to provide this information through the correct metadata columns.
84
85 - **id** is used to identify the media entry to the user in case of an error in the batchaddmedia script.
86 - **license** is used to set a license for your piece a media for mediagoblin's use. This must be a URI.
87 - **title** will set the title displayed to mediagoblin users.
88 - **description** will set a description of your media.
89
90 Metadata columns
91 ----------------
92 Other columns can be used to provide detailed metadata about each media entry.
93 Our metadata system accepts any information provided for in the
94 `RDFa Core Initial Context`_, and the batchupload script recognizes all of the
95 resources provided within it.
96
97 .. _RDFa Core Initial Context: http://www.w3.org/2011/rdfa-context/rdfa-1.1
98
99 The uploader may include the metadata for each piece of media, or
100 leave them blank if they want to. A few columns from `Dublin Core`_ are
101 notable because the batchaddmedia script also uses them to set the default
102 information of uploaded media entries.
103
104 .. _Dublin Core: http://wiki.dublincore.org/index.php/User_Guide
105
106 - **dc:title** sets a title for your media entry.
107 - **dc:description** sets a description of your media entry.
108
109 If both a metadata column and an internal node for the title are provided, mediagoblin
110 will use the internal node as the media entry's display name. This makes it so
111 that if you want to display a piece of media with a different title
112 than the one provided in its metadata, you can just provide different data for
113 the 'dc:title' and 'title' columns. The same is true of the 'description' and
114 'dc:description'.