aspera-cli 4.7.0 → 4.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +1 -0
- data/README.md +844 -861
- data/bin/ascli +20 -1
- data/bin/asession +37 -34
- data/docs/test_env.conf +11 -3
- data/examples/aoc.rb +13 -12
- data/examples/dascli +26 -0
- data/examples/faspex4.rb +34 -29
- data/examples/transfer.rb +30 -29
- data/lib/aspera/aoc.rb +151 -143
- data/lib/aspera/ascmd.rb +56 -45
- data/lib/aspera/ats_api.rb +6 -5
- data/lib/aspera/cli/basic_auth_plugin.rb +18 -16
- data/lib/aspera/cli/extended_value.rb +32 -30
- data/lib/aspera/cli/formater.rb +103 -111
- data/lib/aspera/cli/info.rb +2 -1
- data/lib/aspera/cli/listener/line_dump.rb +1 -0
- data/lib/aspera/cli/listener/logger.rb +1 -0
- data/lib/aspera/cli/listener/progress.rb +13 -12
- data/lib/aspera/cli/listener/progress_multi.rb +21 -20
- data/lib/aspera/cli/main.rb +106 -89
- data/lib/aspera/cli/manager.rb +96 -85
- data/lib/aspera/cli/plugin.rb +50 -32
- data/lib/aspera/cli/plugins/alee.rb +6 -5
- data/lib/aspera/cli/plugins/aoc.rb +521 -426
- data/lib/aspera/cli/plugins/ats.rb +84 -83
- data/lib/aspera/cli/plugins/bss.rb +30 -27
- data/lib/aspera/cli/plugins/config.rb +483 -397
- data/lib/aspera/cli/plugins/console.rb +17 -15
- data/lib/aspera/cli/plugins/cos.rb +26 -35
- data/lib/aspera/cli/plugins/faspex.rb +201 -168
- data/lib/aspera/cli/plugins/faspex5.rb +109 -74
- data/lib/aspera/cli/plugins/node.rb +378 -189
- data/lib/aspera/cli/plugins/orchestrator.rb +71 -65
- data/lib/aspera/cli/plugins/preview.rb +131 -122
- data/lib/aspera/cli/plugins/server.rb +94 -93
- data/lib/aspera/cli/plugins/shares.rb +42 -28
- data/lib/aspera/cli/plugins/sync.rb +15 -14
- data/lib/aspera/cli/transfer_agent.rb +56 -52
- data/lib/aspera/cli/version.rb +2 -1
- data/lib/aspera/colors.rb +29 -28
- data/lib/aspera/command_line_builder.rb +50 -43
- data/lib/aspera/cos_node.rb +64 -38
- data/lib/aspera/data_repository.rb +1 -0
- data/lib/aspera/environment.rb +18 -8
- data/lib/aspera/fasp/agent_base.rb +26 -23
- data/lib/aspera/fasp/agent_connect.rb +35 -30
- data/lib/aspera/fasp/agent_direct.rb +68 -60
- data/lib/aspera/fasp/agent_httpgw.rb +71 -64
- data/lib/aspera/fasp/agent_node.rb +24 -23
- data/lib/aspera/fasp/agent_trsdk.rb +19 -20
- data/lib/aspera/fasp/error.rb +2 -1
- data/lib/aspera/fasp/error_info.rb +79 -68
- data/lib/aspera/fasp/installation.rb +122 -114
- data/lib/aspera/fasp/listener.rb +1 -0
- data/lib/aspera/fasp/parameters.rb +44 -41
- data/lib/aspera/fasp/resume_policy.rb +14 -11
- data/lib/aspera/fasp/transfer_spec.rb +6 -5
- data/lib/aspera/fasp/uri.rb +25 -24
- data/lib/aspera/faspex_gw.rb +83 -72
- data/lib/aspera/hash_ext.rb +10 -12
- data/lib/aspera/id_generator.rb +8 -7
- data/lib/aspera/keychain/encrypted_hash.rb +60 -45
- data/lib/aspera/keychain/macos_security.rb +26 -24
- data/lib/aspera/log.rb +34 -38
- data/lib/aspera/nagios.rb +14 -13
- data/lib/aspera/node.rb +19 -19
- data/lib/aspera/oauth.rb +121 -101
- data/lib/aspera/open_application.rb +6 -5
- data/lib/aspera/persistency_action_once.rb +9 -8
- data/lib/aspera/persistency_folder.rb +10 -9
- data/lib/aspera/preview/file_types.rb +261 -266
- data/lib/aspera/preview/generator.rb +74 -73
- data/lib/aspera/preview/image_error.png +0 -0
- data/lib/aspera/preview/options.rb +7 -6
- data/lib/aspera/preview/utils.rb +30 -33
- data/lib/aspera/preview/video_error.png +0 -0
- data/lib/aspera/proxy_auto_config.rb +25 -23
- data/lib/aspera/rest.rb +73 -74
- data/lib/aspera/rest_call_error.rb +1 -0
- data/lib/aspera/rest_error_analyzer.rb +11 -9
- data/lib/aspera/rest_errors_aspera.rb +5 -4
- data/lib/aspera/secret_hider.rb +68 -0
- data/lib/aspera/ssh.rb +12 -10
- data/lib/aspera/sync.rb +49 -47
- data/lib/aspera/temp_file_manager.rb +7 -5
- data/lib/aspera/timer_limiter.rb +9 -8
- data/lib/aspera/uri_reader.rb +11 -14
- data/lib/aspera/web_auth.rb +17 -15
- data.tar.gz.sig +0 -0
- metadata +117 -34
- metadata.gz.sig +2 -0
- data/bin/dascli +0 -13
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'aspera/log'
|
3
4
|
require 'singleton'
|
4
5
|
|
@@ -8,270 +9,264 @@ module Aspera
|
|
8
9
|
class FileTypes
|
9
10
|
include Singleton
|
10
11
|
# values for conversion_type : input format
|
11
|
-
CONVERSION_TYPES=[
|
12
|
-
:image,
|
13
|
-
:office,
|
14
|
-
:pdf,
|
15
|
-
:plaintext,
|
16
|
-
:video
|
17
|
-
]
|
12
|
+
CONVERSION_TYPES = %i[image office pdf plaintext video].freeze
|
18
13
|
|
19
14
|
# define how files are processed based on mime type
|
20
|
-
SUPPORTED_MIME_TYPES={
|
21
|
-
'application/json'
|
22
|
-
'application/mac-binhex40'
|
23
|
-
'application/msword'
|
24
|
-
'application/pdf'
|
25
|
-
'application/postscript'
|
26
|
-
'application/rtf'
|
27
|
-
'application/vnd.3gpp.pic-bw-small'
|
28
|
-
'application/vnd.hp-hpgl'
|
29
|
-
'application/vnd.hp-pcl'
|
30
|
-
'application/vnd.lotus-wordpro'
|
31
|
-
'application/vnd.mobius.msl'
|
32
|
-
'application/vnd.mophun.certificate'
|
33
|
-
'application/vnd.ms-excel'
|
34
|
-
'application/vnd.ms-excel.sheet.binary.macroenabled.12'
|
35
|
-
'application/vnd.ms-excel.sheet.macroenabled.12'
|
36
|
-
'application/vnd.ms-excel.template.macroenabled.12'
|
37
|
-
'application/vnd.ms-powerpoint'
|
38
|
-
'application/vnd.ms-powerpoint.presentation.macroenabled.12'
|
39
|
-
'application/vnd.ms-powerpoint.template.macroenabled.12'
|
40
|
-
'application/vnd.ms-word.document.macroenabled.12'
|
41
|
-
'application/vnd.ms-word.template.macroenabled.12'
|
42
|
-
'application/vnd.ms-works'
|
43
|
-
'application/vnd.oasis.opendocument.chart'
|
44
|
-
'application/vnd.oasis.opendocument.formula'
|
45
|
-
'application/vnd.oasis.opendocument.graphics'
|
46
|
-
'application/vnd.oasis.opendocument.graphics-template'
|
47
|
-
'application/vnd.oasis.opendocument.presentation'
|
48
|
-
'application/vnd.oasis.opendocument.presentation-template'
|
49
|
-
'application/vnd.oasis.opendocument.spreadsheet'
|
50
|
-
'application/vnd.oasis.opendocument.spreadsheet-template'
|
51
|
-
'application/vnd.oasis.opendocument.text'
|
52
|
-
'application/vnd.oasis.opendocument.text-template'
|
15
|
+
SUPPORTED_MIME_TYPES = {
|
16
|
+
'application/json' => :plaintext,
|
17
|
+
'application/mac-binhex40' => :office,
|
18
|
+
'application/msword' => :office,
|
19
|
+
'application/pdf' => :pdf,
|
20
|
+
'application/postscript' => :image,
|
21
|
+
'application/rtf' => :office,
|
22
|
+
'application/vnd.3gpp.pic-bw-small' => :image,
|
23
|
+
'application/vnd.hp-hpgl' => :image,
|
24
|
+
'application/vnd.hp-pcl' => :image,
|
25
|
+
'application/vnd.lotus-wordpro' => :office,
|
26
|
+
'application/vnd.mobius.msl' => :image,
|
27
|
+
'application/vnd.mophun.certificate' => :image,
|
28
|
+
'application/vnd.ms-excel' => :office,
|
29
|
+
'application/vnd.ms-excel.sheet.binary.macroenabled.12' => :office,
|
30
|
+
'application/vnd.ms-excel.sheet.macroenabled.12' => :office,
|
31
|
+
'application/vnd.ms-excel.template.macroenabled.12' => :office,
|
32
|
+
'application/vnd.ms-powerpoint' => :office,
|
33
|
+
'application/vnd.ms-powerpoint.presentation.macroenabled.12' => :office,
|
34
|
+
'application/vnd.ms-powerpoint.template.macroenabled.12' => :office,
|
35
|
+
'application/vnd.ms-word.document.macroenabled.12' => :office,
|
36
|
+
'application/vnd.ms-word.template.macroenabled.12' => :office,
|
37
|
+
'application/vnd.ms-works' => :office,
|
38
|
+
'application/vnd.oasis.opendocument.chart' => :office,
|
39
|
+
'application/vnd.oasis.opendocument.formula' => :office,
|
40
|
+
'application/vnd.oasis.opendocument.graphics' => :office,
|
41
|
+
'application/vnd.oasis.opendocument.graphics-template' => :office,
|
42
|
+
'application/vnd.oasis.opendocument.presentation' => :office,
|
43
|
+
'application/vnd.oasis.opendocument.presentation-template' => :office,
|
44
|
+
'application/vnd.oasis.opendocument.spreadsheet' => :office,
|
45
|
+
'application/vnd.oasis.opendocument.spreadsheet-template' => :office,
|
46
|
+
'application/vnd.oasis.opendocument.text' => :office,
|
47
|
+
'application/vnd.oasis.opendocument.text-template' => :office,
|
53
48
|
'application/vnd.openxmlformats-officedocument.presentationml.presentation' => :office,
|
54
|
-
'application/vnd.openxmlformats-officedocument.presentationml.slideshow'
|
55
|
-
'application/vnd.openxmlformats-officedocument.presentationml.template'
|
56
|
-
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
57
|
-
'application/vnd.openxmlformats-officedocument.spreadsheetml.template'
|
58
|
-
'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
|
59
|
-
'application/vnd.openxmlformats-officedocument.wordprocessingml.template'
|
60
|
-
'application/vnd.palm'
|
61
|
-
'application/vnd.sun.xml.calc'
|
62
|
-
'application/vnd.sun.xml.calc.template'
|
63
|
-
'application/vnd.sun.xml.draw'
|
64
|
-
'application/vnd.sun.xml.draw.template'
|
65
|
-
'application/vnd.sun.xml.impress'
|
66
|
-
'application/vnd.sun.xml.impress.template'
|
67
|
-
'application/vnd.sun.xml.math'
|
68
|
-
'application/vnd.sun.xml.writer'
|
69
|
-
'application/vnd.sun.xml.writer.template'
|
70
|
-
'application/vnd.wordperfect'
|
71
|
-
'application/x-abiword'
|
72
|
-
'application/x-director'
|
73
|
-
'application/x-font-type1'
|
74
|
-
'application/x-msmetafile'
|
75
|
-
'application/x-mspublisher'
|
76
|
-
'application/x-xfig'
|
77
|
-
'audio/ogg'
|
78
|
-
'font/ttf'
|
79
|
-
'image/bmp'
|
80
|
-
'image/cgm'
|
81
|
-
'image/gif'
|
82
|
-
'image/jpeg'
|
83
|
-
'image/png'
|
84
|
-
'image/sgi'
|
85
|
-
'image/svg+xml'
|
86
|
-
'image/tiff'
|
87
|
-
'image/vnd.adobe.photoshop'
|
88
|
-
'image/vnd.djvu'
|
89
|
-
'image/vnd.dxf'
|
90
|
-
'image/vnd.fpx'
|
91
|
-
'image/vnd.ms-photo'
|
92
|
-
'image/vnd.wap.wbmp'
|
93
|
-
'image/webp'
|
94
|
-
'image/x-cmx'
|
95
|
-
'image/x-freehand'
|
96
|
-
'image/x-icon'
|
97
|
-
'image/x-mrsid-image'
|
98
|
-
'image/x-pcx'
|
99
|
-
'image/x-pict'
|
100
|
-
'image/x-portable-anymap'
|
101
|
-
'image/x-portable-bitmap'
|
102
|
-
'image/x-portable-graymap'
|
103
|
-
'image/x-portable-pixmap'
|
104
|
-
'image/x-rgb'
|
105
|
-
'image/x-tga'
|
106
|
-
'image/x-xbitmap'
|
107
|
-
'image/x-xpixmap'
|
108
|
-
'image/x-xwindowdump'
|
109
|
-
'text/csv'
|
110
|
-
'text/html'
|
111
|
-
'text/plain'
|
112
|
-
'text/troff'
|
113
|
-
'video/h261'
|
114
|
-
'video/h263'
|
115
|
-
'video/h264'
|
116
|
-
'video/mp4'
|
117
|
-
'video/mpeg'
|
118
|
-
'video/quicktime'
|
119
|
-
'video/x-flv'
|
120
|
-
'video/x-m4v'
|
121
|
-
'video/x-matroska'
|
122
|
-
'video/x-mng'
|
123
|
-
'video/x-ms-wmv'
|
124
|
-
'video/x-msvideo'
|
49
|
+
'application/vnd.openxmlformats-officedocument.presentationml.slideshow' => :office,
|
50
|
+
'application/vnd.openxmlformats-officedocument.presentationml.template' => :office,
|
51
|
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => :office,
|
52
|
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.template' => :office,
|
53
|
+
'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => :office,
|
54
|
+
'application/vnd.openxmlformats-officedocument.wordprocessingml.template' => :office,
|
55
|
+
'application/vnd.palm' => :office,
|
56
|
+
'application/vnd.sun.xml.calc' => :office,
|
57
|
+
'application/vnd.sun.xml.calc.template' => :office,
|
58
|
+
'application/vnd.sun.xml.draw' => :office,
|
59
|
+
'application/vnd.sun.xml.draw.template' => :office,
|
60
|
+
'application/vnd.sun.xml.impress' => :office,
|
61
|
+
'application/vnd.sun.xml.impress.template' => :office,
|
62
|
+
'application/vnd.sun.xml.math' => :office,
|
63
|
+
'application/vnd.sun.xml.writer' => :office,
|
64
|
+
'application/vnd.sun.xml.writer.template' => :office,
|
65
|
+
'application/vnd.wordperfect' => :office,
|
66
|
+
'application/x-abiword' => :office,
|
67
|
+
'application/x-director' => :image,
|
68
|
+
'application/x-font-type1' => :image,
|
69
|
+
'application/x-msmetafile' => :image,
|
70
|
+
'application/x-mspublisher' => :office,
|
71
|
+
'application/x-xfig' => :image,
|
72
|
+
'audio/ogg' => :video,
|
73
|
+
'font/ttf' => :image,
|
74
|
+
'image/bmp' => :image,
|
75
|
+
'image/cgm' => :image,
|
76
|
+
'image/gif' => :image,
|
77
|
+
'image/jpeg' => :image,
|
78
|
+
'image/png' => :image,
|
79
|
+
'image/sgi' => :image,
|
80
|
+
'image/svg+xml' => :image,
|
81
|
+
'image/tiff' => :image,
|
82
|
+
'image/vnd.adobe.photoshop' => :image,
|
83
|
+
'image/vnd.djvu' => :image,
|
84
|
+
'image/vnd.dxf' => :office,
|
85
|
+
'image/vnd.fpx' => :image,
|
86
|
+
'image/vnd.ms-photo' => :image,
|
87
|
+
'image/vnd.wap.wbmp' => :image,
|
88
|
+
'image/webp' => :image,
|
89
|
+
'image/x-cmx' => :office,
|
90
|
+
'image/x-freehand' => :office,
|
91
|
+
'image/x-icon' => :image,
|
92
|
+
'image/x-mrsid-image' => :image,
|
93
|
+
'image/x-pcx' => :image,
|
94
|
+
'image/x-pict' => :office,
|
95
|
+
'image/x-portable-anymap' => :image,
|
96
|
+
'image/x-portable-bitmap' => :image,
|
97
|
+
'image/x-portable-graymap' => :image,
|
98
|
+
'image/x-portable-pixmap' => :image,
|
99
|
+
'image/x-rgb' => :image,
|
100
|
+
'image/x-tga' => :image,
|
101
|
+
'image/x-xbitmap' => :image,
|
102
|
+
'image/x-xpixmap' => :image,
|
103
|
+
'image/x-xwindowdump' => :image,
|
104
|
+
'text/csv' => :office,
|
105
|
+
'text/html' => :office,
|
106
|
+
'text/plain' => :plaintext,
|
107
|
+
'text/troff' => :image,
|
108
|
+
'video/h261' => :video,
|
109
|
+
'video/h263' => :video,
|
110
|
+
'video/h264' => :video,
|
111
|
+
'video/mp4' => :video,
|
112
|
+
'video/mpeg' => :video,
|
113
|
+
'video/quicktime' => :video,
|
114
|
+
'video/x-flv' => :video,
|
115
|
+
'video/x-m4v' => :video,
|
116
|
+
'video/x-matroska' => :video,
|
117
|
+
'video/x-mng' => :image,
|
118
|
+
'video/x-ms-wmv' => :video,
|
119
|
+
'video/x-msvideo' => :video}.freeze
|
125
120
|
|
126
121
|
# this is a way to add support for extensions that are otherwise not known by node api (mime type)
|
127
|
-
SUPPORTED_EXTENSIONS={
|
128
|
-
'aai'
|
129
|
-
'art'
|
130
|
-
'arw'
|
131
|
-
'avs'
|
132
|
-
'bmp2'
|
133
|
-
'bmp3'
|
134
|
-
'bpg'
|
135
|
-
'cals'
|
136
|
-
'cdr'
|
137
|
-
'cin'
|
138
|
-
'clipboard'
|
139
|
-
'cmyk'
|
140
|
-
'cmyka'
|
141
|
-
'cr2'
|
142
|
-
'crw'
|
143
|
-
'cur'
|
144
|
-
'cut'
|
145
|
-
'cwk'
|
146
|
-
'dbf'
|
147
|
-
'dcm'
|
148
|
-
'dcx'
|
149
|
-
'dds'
|
150
|
-
'dib'
|
151
|
-
'dif'
|
152
|
-
'divx'
|
153
|
-
'dng'
|
154
|
-
'docx'
|
155
|
-
'dpx'
|
156
|
-
'epdf'
|
157
|
-
'epi'
|
158
|
-
'eps2'
|
159
|
-
'eps3'
|
160
|
-
'epsf'
|
161
|
-
'epsi'
|
162
|
-
'ept'
|
163
|
-
'exr'
|
164
|
-
'fax'
|
165
|
-
'fb2'
|
166
|
-
'fits'
|
167
|
-
'fodg'
|
168
|
-
'fodp'
|
169
|
-
'fods'
|
170
|
-
'fodt'
|
171
|
-
'gplt'
|
172
|
-
'gray'
|
173
|
-
'hdr'
|
174
|
-
'hpw'
|
175
|
-
'hrz'
|
176
|
-
'info'
|
177
|
-
'inline'
|
178
|
-
'j2c'
|
179
|
-
'j2k'
|
180
|
-
'jbig'
|
181
|
-
'jng'
|
182
|
-
'jp2'
|
183
|
-
'jpt'
|
184
|
-
'jxr'
|
185
|
-
'key'
|
186
|
-
'log'
|
187
|
-
'mat'
|
188
|
-
'mcw'
|
189
|
-
'met'
|
190
|
-
'miff'
|
191
|
-
'mml'
|
192
|
-
'mono'
|
193
|
-
'mpr'
|
194
|
-
'mrsid'
|
195
|
-
'mrw'
|
196
|
-
'mtv'
|
197
|
-
'mvg'
|
198
|
-
'mw'
|
199
|
-
'mwd'
|
200
|
-
'mxf'
|
201
|
-
'nef'
|
202
|
-
'numbers'
|
203
|
-
'orf'
|
204
|
-
'otb'
|
205
|
-
'p7'
|
206
|
-
'pages'
|
207
|
-
'palm'
|
208
|
-
'pam'
|
209
|
-
'pcd'
|
210
|
-
'pcds'
|
211
|
-
'pdf'
|
212
|
-
'pef'
|
213
|
-
'picon'
|
214
|
-
'pict'
|
215
|
-
'pix'
|
216
|
-
'pm'
|
217
|
-
'pm6'
|
218
|
-
'pmd'
|
219
|
-
'png00'
|
220
|
-
'png24'
|
221
|
-
'png32'
|
222
|
-
'png48'
|
223
|
-
'png64'
|
224
|
-
'png8'
|
225
|
-
'ps2'
|
226
|
-
'ps3'
|
227
|
-
'ptif'
|
228
|
-
'pwp'
|
229
|
-
'rad'
|
230
|
-
'raf'
|
231
|
-
'rfg'
|
232
|
-
'rgba'
|
233
|
-
'rla'
|
234
|
-
'rle'
|
235
|
-
'sct'
|
236
|
-
'sfw'
|
237
|
-
'sgf'
|
238
|
-
'sgv'
|
239
|
-
'slk'
|
122
|
+
SUPPORTED_EXTENSIONS = {
|
123
|
+
'aai' => :image,
|
124
|
+
'art' => :image,
|
125
|
+
'arw' => :image,
|
126
|
+
'avs' => :image,
|
127
|
+
'bmp2' => :image,
|
128
|
+
'bmp3' => :image,
|
129
|
+
'bpg' => :image,
|
130
|
+
'cals' => :image,
|
131
|
+
'cdr' => :office,
|
132
|
+
'cin' => :image,
|
133
|
+
'clipboard' => :image,
|
134
|
+
'cmyk' => :image,
|
135
|
+
'cmyka' => :image,
|
136
|
+
'cr2' => :image,
|
137
|
+
'crw' => :image,
|
138
|
+
'cur' => :image,
|
139
|
+
'cut' => :image,
|
140
|
+
'cwk' => :office,
|
141
|
+
'dbf' => :office,
|
142
|
+
'dcm' => :image,
|
143
|
+
'dcx' => :image,
|
144
|
+
'dds' => :image,
|
145
|
+
'dib' => :image,
|
146
|
+
'dif' => :office,
|
147
|
+
'divx' => :video,
|
148
|
+
'dng' => :image,
|
149
|
+
'docx' => :office,
|
150
|
+
'dpx' => :image,
|
151
|
+
'epdf' => :image,
|
152
|
+
'epi' => :image,
|
153
|
+
'eps2' => :image,
|
154
|
+
'eps3' => :image,
|
155
|
+
'epsf' => :image,
|
156
|
+
'epsi' => :image,
|
157
|
+
'ept' => :image,
|
158
|
+
'exr' => :image,
|
159
|
+
'fax' => :image,
|
160
|
+
'fb2' => :office,
|
161
|
+
'fits' => :image,
|
162
|
+
'fodg' => :office,
|
163
|
+
'fodp' => :office,
|
164
|
+
'fods' => :office,
|
165
|
+
'fodt' => :office,
|
166
|
+
'gplt' => :image,
|
167
|
+
'gray' => :image,
|
168
|
+
'hdr' => :image,
|
169
|
+
'hpw' => :office,
|
170
|
+
'hrz' => :image,
|
171
|
+
'info' => :image,
|
172
|
+
'inline' => :image,
|
173
|
+
'j2c' => :image,
|
174
|
+
'j2k' => :image,
|
175
|
+
'jbig' => :image,
|
176
|
+
'jng' => :image,
|
177
|
+
'jp2' => :image,
|
178
|
+
'jpt' => :image,
|
179
|
+
'jxr' => :image,
|
180
|
+
'key' => :office,
|
181
|
+
'log' => :plaintext,
|
182
|
+
'mat' => :image,
|
183
|
+
'mcw' => :office,
|
184
|
+
'met' => :office,
|
185
|
+
'miff' => :image,
|
186
|
+
'mml' => :office,
|
187
|
+
'mono' => :image,
|
188
|
+
'mpr' => :image,
|
189
|
+
'mrsid' => :image,
|
190
|
+
'mrw' => :image,
|
191
|
+
'mtv' => :image,
|
192
|
+
'mvg' => :image,
|
193
|
+
'mw' => :office,
|
194
|
+
'mwd' => :office,
|
195
|
+
'mxf' => :video,
|
196
|
+
'nef' => :image,
|
197
|
+
'numbers' => :office,
|
198
|
+
'orf' => :image,
|
199
|
+
'otb' => :image,
|
200
|
+
'p7' => :image,
|
201
|
+
'pages' => :office,
|
202
|
+
'palm' => :image,
|
203
|
+
'pam' => :image,
|
204
|
+
'pcd' => :image,
|
205
|
+
'pcds' => :image,
|
206
|
+
'pdf' => :pdf,
|
207
|
+
'pef' => :image,
|
208
|
+
'picon' => :image,
|
209
|
+
'pict' => :image,
|
210
|
+
'pix' => :image,
|
211
|
+
'pm' => :office,
|
212
|
+
'pm6' => :office,
|
213
|
+
'pmd' => :office,
|
214
|
+
'png00' => :image,
|
215
|
+
'png24' => :image,
|
216
|
+
'png32' => :image,
|
217
|
+
'png48' => :image,
|
218
|
+
'png64' => :image,
|
219
|
+
'png8' => :image,
|
220
|
+
'ps2' => :image,
|
221
|
+
'ps3' => :image,
|
222
|
+
'ptif' => :image,
|
223
|
+
'pwp' => :image,
|
224
|
+
'rad' => :image,
|
225
|
+
'raf' => :image,
|
226
|
+
'rfg' => :image,
|
227
|
+
'rgba' => :image,
|
228
|
+
'rla' => :image,
|
229
|
+
'rle' => :image,
|
230
|
+
'sct' => :image,
|
231
|
+
'sfw' => :image,
|
232
|
+
'sgf' => :office,
|
233
|
+
'sgv' => :office,
|
234
|
+
'slk' => :office,
|
240
235
|
'sparse-color' => :image,
|
241
|
-
'sun'
|
242
|
-
'svm'
|
243
|
-
'sylk'
|
244
|
-
'tim'
|
245
|
-
'txt'
|
246
|
-
'uil'
|
247
|
-
'uof'
|
248
|
-
'uop'
|
249
|
-
'uos'
|
250
|
-
'uot'
|
251
|
-
'uyvy'
|
252
|
-
'vds'
|
253
|
-
'vdx'
|
254
|
-
'vicar'
|
255
|
-
'viff'
|
256
|
-
'vsdx'
|
257
|
-
'webm'
|
258
|
-
'wb2'
|
259
|
-
'wk1'
|
260
|
-
'wk3'
|
261
|
-
'wn'
|
262
|
-
'wpg'
|
263
|
-
'wq1'
|
264
|
-
'wq2'
|
265
|
-
'x'
|
266
|
-
'x3f'
|
267
|
-
'xcf'
|
268
|
-
'xlk'
|
269
|
-
'xlsx'
|
270
|
-
'xls'
|
271
|
-
'ycbcr'
|
272
|
-
'ycbcra'
|
273
|
-
'yuv'
|
274
|
-
'zabw'
|
236
|
+
'sun' => :image,
|
237
|
+
'svm' => :office,
|
238
|
+
'sylk' => :office,
|
239
|
+
'tim' => :image,
|
240
|
+
'txt' => :plaintext,
|
241
|
+
'uil' => :image,
|
242
|
+
'uof' => :office,
|
243
|
+
'uop' => :office,
|
244
|
+
'uos' => :office,
|
245
|
+
'uot' => :office,
|
246
|
+
'uyvy' => :image,
|
247
|
+
'vds' => :office,
|
248
|
+
'vdx' => :office,
|
249
|
+
'vicar' => :image,
|
250
|
+
'viff' => :image,
|
251
|
+
'vsdx' => :office,
|
252
|
+
'webm' => :video,
|
253
|
+
'wb2' => :office,
|
254
|
+
'wk1' => :office,
|
255
|
+
'wk3' => :office,
|
256
|
+
'wn' => :office,
|
257
|
+
'wpg' => :image,
|
258
|
+
'wq1' => :office,
|
259
|
+
'wq2' => :office,
|
260
|
+
'x' => :image,
|
261
|
+
'x3f' => :image,
|
262
|
+
'xcf' => :image,
|
263
|
+
'xlk' => :office,
|
264
|
+
'xlsx' => :office,
|
265
|
+
'xls' => :office,
|
266
|
+
'ycbcr' => :image,
|
267
|
+
'ycbcra' => :image,
|
268
|
+
'yuv' => :image,
|
269
|
+
'zabw' => :office}.freeze
|
275
270
|
|
276
271
|
private_constant :SUPPORTED_MIME_TYPES, :SUPPORTED_EXTENSIONS
|
277
272
|
|
@@ -279,7 +274,7 @@ module Aspera
|
|
279
274
|
attr_accessor :use_mimemagic
|
280
275
|
|
281
276
|
def initialize
|
282
|
-
@use_mimemagic=false
|
277
|
+
@use_mimemagic = false
|
283
278
|
end
|
284
279
|
|
285
280
|
# use mime magic to find mime type based on file content (magic numbers)
|
@@ -289,13 +284,13 @@ module Aspera
|
|
289
284
|
require 'mimemagic/version'
|
290
285
|
require 'mimemagic/overlay' if MimeMagic::VERSION.start_with?('0.3.')
|
291
286
|
# check magic number inside file (empty string if not found)
|
292
|
-
detected_mime=MimeMagic.by_magic(File.open(filepath)).to_s
|
287
|
+
detected_mime = MimeMagic.by_magic(File.open(filepath)).to_s
|
293
288
|
# check extension only
|
294
289
|
if !SUPPORTED_MIME_TYPES.has_key?(detected_mime)
|
295
290
|
Log.log.debug("no conversion for #{detected_mime}, trying extension")
|
296
|
-
detected_mime=MimeMagic.by_extension(File.extname(filepath)).to_s
|
291
|
+
detected_mime = MimeMagic.by_extension(File.extname(filepath)).to_s
|
297
292
|
end
|
298
|
-
detected_mime=nil if detected_mime.empty?
|
293
|
+
detected_mime = nil if detected_mime.empty?
|
299
294
|
Log.log.debug("mimemagic: #{detected_mime.class.name} [#{detected_mime}]")
|
300
295
|
return detected_mime
|
301
296
|
end
|
@@ -306,12 +301,12 @@ module Aspera
|
|
306
301
|
def conversion_type(filepath,mimetype)
|
307
302
|
Log.log.debug("conversion_type(#{filepath},m=#{mimetype},t=#{@use_mimemagic})")
|
308
303
|
# 1- get type from provided mime type, using local mapping
|
309
|
-
conv_type=SUPPORTED_MIME_TYPES[mimetype] if !mimetype.nil?
|
304
|
+
conv_type = SUPPORTED_MIME_TYPES[mimetype] if !mimetype.nil?
|
310
305
|
# 2- else, from computed mime type (if available)
|
311
306
|
if conv_type.nil? && @use_mimemagic
|
312
|
-
detected_mime=mime_from_file(filepath)
|
307
|
+
detected_mime = mime_from_file(filepath)
|
313
308
|
if !detected_mime.nil?
|
314
|
-
conv_type=SUPPORTED_MIME_TYPES[detected_mime]
|
309
|
+
conv_type = SUPPORTED_MIME_TYPES[detected_mime]
|
315
310
|
if !mimetype.nil?
|
316
311
|
if mimetype.eql?(detected_mime)
|
317
312
|
Log.log.debug('matching mime type per magic number')
|
@@ -324,7 +319,7 @@ module Aspera
|
|
324
319
|
end
|
325
320
|
# 3- else, from extensions, using local mapping
|
326
321
|
extension = File.extname(filepath.downcase)[1..-1]
|
327
|
-
conv_type=SUPPORTED_EXTENSIONS[extension] if conv_type.nil?
|
322
|
+
conv_type = SUPPORTED_EXTENSIONS[extension] if conv_type.nil?
|
328
323
|
Log.log.debug("conversion_type(#{extension}): #{conv_type.class.name} [#{conv_type}]")
|
329
324
|
return conv_type
|
330
325
|
end
|