-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathREADME
More file actions
120 lines (84 loc) · 6.24 KB
/
README
File metadata and controls
120 lines (84 loc) · 6.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
===================
imgur_bash_uploader
===================
===================
WHAT IS IT?
===================
Client photo uploader written in bash shell scripting that talks to imgur.com using Oauth protocol
===================
INSTALL
===================
Since it's a shell script there is no need to install the application. But it does have some dependencies that should be installed:
a) cURL: C URL command line tool
sudo apt-get install curl
b) urlencode: It's an application that transforms strings into 'percent encode' so they can be used on URLs and HTTP requests. It is within the package gridsite-clients. More information here: http://packages.debian.org/sid/gridsite-clients
sudo apt-get install gridsite-clients
c) xpath is the Perl wrapper to parse XML tags.
sudo apt-get install libxml-xpath-perl
===================
SETUP UP WITH IMGUR.COM
===================
1) Get a pair of keys from http://imgur.com/. You need to register an application and the OauthConsumerKey and OauthSecretKey will be given to you. For this instructions let's say you gave your app the name Blah (You can give whatever name you want as long as it's not yet taken).
2) Use the keys from step 1 to update imgur_config.sh.
3) run ./main.sh
4) When you run imgur_bash_uploader for the first time it will connect to the imgur server and request a 'request token'. After aquiring the 'request token' it will generate an URL like this on your screen
https://api.imgur.com/oauth/authorize?oauth_token=sdoqe28849ruufdksjkjw92898eifukfjdklfiodioig
5) Open the above URL on your favorite browser. The imgur website will say something like 'the application Blah wants to access your account. Allow / Deny'. Login using your personal account. After that, imgur will generate an access token that will link your personal account with the next request your app Blah will make to imgur. It means, when imgur_bash_uploader uploads photos, they will be uploaded into the personal account you just logged in.
6) A file called valid_access_token.sh will be created with the access keys from the step above. That file will be used for future requests so you don't have to do steps 4 and 5 again. It's said that the access key is valid forever. If for some reason the key is revoked, the next time you run imgur_bash_uploader, it will go automatically thru steps 4 and 5 again and update valid_access_token.sh.
===================
RUNNING
===================
1) Create a directory and place the pictures you want to upload there. Let's say the directory is /data/imgur_photo_upload_root_dir/INPUT.
2) Update the variable PHOTO_ROOT_DIR in imgur_config.sh like this:
export PHOTO_ROOT_DIR=/data/imgur_photo_upload_root_dir/INPUT
3) Organize the pictures inside directories. The directories will became albums containning the pictures. Directories that containg no pictures will be ignored. Pictures children of PHOTO_ROOT_DIR will be uploaded but won't be added to any album.
WARNING: photos and directory names should not contain weird characters as well as spaces.
Example:
/data/imgur_photo_upload_root_dir/INPUT
.
|-- P1050250.JPG
|-- P1050257.JPG
|-- another_dir_name
| `-- 2012_07
| |-- IMG_20120708_152103.jpg
| |-- IMG_20120708_160547.jpg
| `-- IMG_20120708_175629.jpg
|-- some_dir
| `-- 2012_07
| |-- P1050222.JPG
| |-- P1050225.JPG
| |-- P1050226.JPG
| |-- P1050244.JPG
| |-- P1050246.JPG
| |-- P1050247.JPG
| |-- P1050248.JPG
| |-- P1050249.JPG
| |-- P1050255.JPG
| |-- P1050256.JPG
| |-- P1050258.JPG
| |-- P1050260.JPG
| |-- P1050262.JPG
| |-- P1050263.JPG
| |-- P1050268.JPG
| |-- P1050274.JPG
| |-- P1050276.JPG
| `-- P1050277.JPG
`-- whatever
`-- 2012_06
|-- photo_0000000001.jpg
|-- photo_0000000002.jpg
|-- photo_0000000003.jpg
|-- photo_0000000004.jpg
|-- photo_0000000005.jpg
|-- photo_0000000006.jpg
|-- photo_0000000008.jpg
|-- photo_0000000009.jpg
|-- photo_0000000010.jpg
|-- photo_0000000011.jpg
`-- photo_0000000012.jpg
directories another_dir_name, some_dir and whatever will be ignored.
Two albums will be created: 2012_07 and 2012_06. Note there are two directories named 2012_07. Their pictures will be combined into only one album 2012_07.
Picture P1050250.JPG and P1050257.JPG will be uploaded but won't be added to any album because they are in the PHOTO_ROOT_DIR.
4) run ./main.sh
5) Look at the ouput on stdout and LOGTEMPDIR. If everything went ok, your pictures were uploaded and moved to MOVE_PHOTO_DIR.
if the application fails to run for some reason, it will leave the directory structure in a stable way so when it runs again it picks up from where it left.