aspera-cli 4.7.0 → 4.9.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.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/README.md +1267 -999
  4. data/bin/ascli +20 -1
  5. data/bin/asession +37 -34
  6. data/docs/test_env.conf +7 -3
  7. data/examples/aoc.rb +13 -12
  8. data/examples/dascli +23 -0
  9. data/examples/faspex4.rb +34 -29
  10. data/examples/{transfer.rb → node.rb} +31 -59
  11. data/examples/server.rb +93 -0
  12. data/lib/aspera/aoc.rb +153 -143
  13. data/lib/aspera/ascmd.rb +56 -45
  14. data/lib/aspera/ats_api.rb +9 -6
  15. data/lib/aspera/cli/basic_auth_plugin.rb +18 -16
  16. data/lib/aspera/cli/extended_value.rb +33 -30
  17. data/lib/aspera/cli/formater.rb +105 -111
  18. data/lib/aspera/cli/info.rb +3 -2
  19. data/lib/aspera/cli/listener/line_dump.rb +1 -0
  20. data/lib/aspera/cli/listener/logger.rb +1 -0
  21. data/lib/aspera/cli/listener/progress.rb +13 -12
  22. data/lib/aspera/cli/listener/progress_multi.rb +21 -20
  23. data/lib/aspera/cli/main.rb +110 -90
  24. data/lib/aspera/cli/manager.rb +99 -88
  25. data/lib/aspera/cli/plugin.rb +98 -39
  26. data/lib/aspera/cli/plugins/alee.rb +6 -5
  27. data/lib/aspera/cli/plugins/aoc.rb +581 -450
  28. data/lib/aspera/cli/plugins/ats.rb +84 -83
  29. data/lib/aspera/cli/plugins/bss.rb +30 -27
  30. data/lib/aspera/cli/plugins/config.rb +488 -397
  31. data/lib/aspera/cli/plugins/console.rb +17 -15
  32. data/lib/aspera/cli/plugins/cos.rb +26 -35
  33. data/lib/aspera/cli/plugins/faspex.rb +206 -172
  34. data/lib/aspera/cli/plugins/faspex5.rb +109 -74
  35. data/lib/aspera/cli/plugins/node.rb +379 -189
  36. data/lib/aspera/cli/plugins/orchestrator.rb +71 -65
  37. data/lib/aspera/cli/plugins/preview.rb +131 -122
  38. data/lib/aspera/cli/plugins/server.rb +50 -150
  39. data/lib/aspera/cli/plugins/shares.rb +61 -27
  40. data/lib/aspera/cli/plugins/sync.rb +15 -14
  41. data/lib/aspera/cli/transfer_agent.rb +75 -64
  42. data/lib/aspera/cli/version.rb +2 -1
  43. data/lib/aspera/colors.rb +29 -28
  44. data/lib/aspera/command_line_builder.rb +50 -43
  45. data/lib/aspera/cos_node.rb +64 -38
  46. data/lib/aspera/data_repository.rb +1 -0
  47. data/lib/aspera/environment.rb +33 -10
  48. data/lib/aspera/fasp/agent_base.rb +35 -30
  49. data/lib/aspera/fasp/agent_connect.rb +35 -30
  50. data/lib/aspera/fasp/agent_direct.rb +68 -60
  51. data/lib/aspera/fasp/agent_httpgw.rb +71 -64
  52. data/lib/aspera/fasp/agent_node.rb +24 -23
  53. data/lib/aspera/fasp/agent_trsdk.rb +19 -20
  54. data/lib/aspera/fasp/error.rb +2 -1
  55. data/lib/aspera/fasp/error_info.rb +79 -68
  56. data/lib/aspera/fasp/installation.rb +130 -126
  57. data/lib/aspera/fasp/listener.rb +1 -0
  58. data/lib/aspera/fasp/parameters.rb +71 -60
  59. data/lib/aspera/fasp/parameters.yaml +69 -17
  60. data/lib/aspera/fasp/resume_policy.rb +14 -11
  61. data/lib/aspera/fasp/transfer_spec.rb +6 -5
  62. data/lib/aspera/fasp/uri.rb +25 -24
  63. data/lib/aspera/faspex_gw.rb +83 -72
  64. data/lib/aspera/hash_ext.rb +23 -13
  65. data/lib/aspera/id_generator.rb +16 -13
  66. data/lib/aspera/keychain/encrypted_hash.rb +61 -46
  67. data/lib/aspera/keychain/macos_security.rb +26 -24
  68. data/lib/aspera/log.rb +35 -39
  69. data/lib/aspera/nagios.rb +36 -28
  70. data/lib/aspera/node.rb +19 -19
  71. data/lib/aspera/oauth.rb +120 -100
  72. data/lib/aspera/open_application.rb +25 -22
  73. data/lib/aspera/persistency_action_once.rb +9 -8
  74. data/lib/aspera/persistency_folder.rb +13 -9
  75. data/lib/aspera/preview/file_types.rb +261 -266
  76. data/lib/aspera/preview/generator.rb +74 -73
  77. data/lib/aspera/preview/image_error.png +0 -0
  78. data/lib/aspera/preview/options.rb +7 -6
  79. data/lib/aspera/preview/utils.rb +30 -33
  80. data/lib/aspera/preview/video_error.png +0 -0
  81. data/lib/aspera/proxy_auto_config.rb +27 -23
  82. data/lib/aspera/rest.rb +73 -74
  83. data/lib/aspera/rest_call_error.rb +1 -0
  84. data/lib/aspera/rest_error_analyzer.rb +23 -19
  85. data/lib/aspera/rest_errors_aspera.rb +43 -40
  86. data/lib/aspera/secret_hider.rb +74 -0
  87. data/lib/aspera/ssh.rb +13 -10
  88. data/lib/aspera/sync.rb +49 -47
  89. data/lib/aspera/temp_file_manager.rb +7 -5
  90. data/lib/aspera/timer_limiter.rb +9 -8
  91. data/lib/aspera/uri_reader.rb +17 -18
  92. data/lib/aspera/web_auth.rb +17 -15
  93. data.tar.gz.sig +5 -0
  94. metadata +119 -35
  95. metadata.gz.sig +0 -0
  96. 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' => :plaintext,
22
- 'application/mac-binhex40' => :office,
23
- 'application/msword' => :office,
24
- 'application/pdf' => :pdf,
25
- 'application/postscript' => :image,
26
- 'application/rtf' => :office,
27
- 'application/vnd.3gpp.pic-bw-small' => :image,
28
- 'application/vnd.hp-hpgl' => :image,
29
- 'application/vnd.hp-pcl' => :image,
30
- 'application/vnd.lotus-wordpro' => :office,
31
- 'application/vnd.mobius.msl' => :image,
32
- 'application/vnd.mophun.certificate' => :image,
33
- 'application/vnd.ms-excel' => :office,
34
- 'application/vnd.ms-excel.sheet.binary.macroenabled.12' => :office,
35
- 'application/vnd.ms-excel.sheet.macroenabled.12' => :office,
36
- 'application/vnd.ms-excel.template.macroenabled.12' => :office,
37
- 'application/vnd.ms-powerpoint' => :office,
38
- 'application/vnd.ms-powerpoint.presentation.macroenabled.12' => :office,
39
- 'application/vnd.ms-powerpoint.template.macroenabled.12' => :office,
40
- 'application/vnd.ms-word.document.macroenabled.12' => :office,
41
- 'application/vnd.ms-word.template.macroenabled.12' => :office,
42
- 'application/vnd.ms-works' => :office,
43
- 'application/vnd.oasis.opendocument.chart' => :office,
44
- 'application/vnd.oasis.opendocument.formula' => :office,
45
- 'application/vnd.oasis.opendocument.graphics' => :office,
46
- 'application/vnd.oasis.opendocument.graphics-template' => :office,
47
- 'application/vnd.oasis.opendocument.presentation' => :office,
48
- 'application/vnd.oasis.opendocument.presentation-template' => :office,
49
- 'application/vnd.oasis.opendocument.spreadsheet' => :office,
50
- 'application/vnd.oasis.opendocument.spreadsheet-template' => :office,
51
- 'application/vnd.oasis.opendocument.text' => :office,
52
- 'application/vnd.oasis.opendocument.text-template' => :office,
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' => :office,
55
- 'application/vnd.openxmlformats-officedocument.presentationml.template' => :office,
56
- 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => :office,
57
- 'application/vnd.openxmlformats-officedocument.spreadsheetml.template' => :office,
58
- 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => :office,
59
- 'application/vnd.openxmlformats-officedocument.wordprocessingml.template' => :office,
60
- 'application/vnd.palm' => :office,
61
- 'application/vnd.sun.xml.calc' => :office,
62
- 'application/vnd.sun.xml.calc.template' => :office,
63
- 'application/vnd.sun.xml.draw' => :office,
64
- 'application/vnd.sun.xml.draw.template' => :office,
65
- 'application/vnd.sun.xml.impress' => :office,
66
- 'application/vnd.sun.xml.impress.template' => :office,
67
- 'application/vnd.sun.xml.math' => :office,
68
- 'application/vnd.sun.xml.writer' => :office,
69
- 'application/vnd.sun.xml.writer.template' => :office,
70
- 'application/vnd.wordperfect' => :office,
71
- 'application/x-abiword' => :office,
72
- 'application/x-director' => :image,
73
- 'application/x-font-type1' => :image,
74
- 'application/x-msmetafile' => :image,
75
- 'application/x-mspublisher' => :office,
76
- 'application/x-xfig' => :image,
77
- 'audio/ogg' => :video,
78
- 'font/ttf' => :image,
79
- 'image/bmp' => :image,
80
- 'image/cgm' => :image,
81
- 'image/gif' => :image,
82
- 'image/jpeg' => :image,
83
- 'image/png' => :image,
84
- 'image/sgi' => :image,
85
- 'image/svg+xml' => :image,
86
- 'image/tiff' => :image,
87
- 'image/vnd.adobe.photoshop' => :image,
88
- 'image/vnd.djvu' => :image,
89
- 'image/vnd.dxf' => :office,
90
- 'image/vnd.fpx' => :image,
91
- 'image/vnd.ms-photo' => :image,
92
- 'image/vnd.wap.wbmp' => :image,
93
- 'image/webp' => :image,
94
- 'image/x-cmx' => :office,
95
- 'image/x-freehand' => :office,
96
- 'image/x-icon' => :image,
97
- 'image/x-mrsid-image' => :image,
98
- 'image/x-pcx' => :image,
99
- 'image/x-pict' => :office,
100
- 'image/x-portable-anymap' => :image,
101
- 'image/x-portable-bitmap' => :image,
102
- 'image/x-portable-graymap' => :image,
103
- 'image/x-portable-pixmap' => :image,
104
- 'image/x-rgb' => :image,
105
- 'image/x-tga' => :image,
106
- 'image/x-xbitmap' => :image,
107
- 'image/x-xpixmap' => :image,
108
- 'image/x-xwindowdump' => :image,
109
- 'text/csv' => :office,
110
- 'text/html' => :office,
111
- 'text/plain' => :plaintext,
112
- 'text/troff' => :image,
113
- 'video/h261' => :video,
114
- 'video/h263' => :video,
115
- 'video/h264' => :video,
116
- 'video/mp4' => :video,
117
- 'video/mpeg' => :video,
118
- 'video/quicktime' => :video,
119
- 'video/x-flv' => :video,
120
- 'video/x-m4v' => :video,
121
- 'video/x-matroska' => :video,
122
- 'video/x-mng' => :image,
123
- 'video/x-ms-wmv' => :video,
124
- 'video/x-msvideo' => :video}
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' => :image,
129
- 'art' => :image,
130
- 'arw' => :image,
131
- 'avs' => :image,
132
- 'bmp2' => :image,
133
- 'bmp3' => :image,
134
- 'bpg' => :image,
135
- 'cals' => :image,
136
- 'cdr' => :office,
137
- 'cin' => :image,
138
- 'clipboard' => :image,
139
- 'cmyk' => :image,
140
- 'cmyka' => :image,
141
- 'cr2' => :image,
142
- 'crw' => :image,
143
- 'cur' => :image,
144
- 'cut' => :image,
145
- 'cwk' => :office,
146
- 'dbf' => :office,
147
- 'dcm' => :image,
148
- 'dcx' => :image,
149
- 'dds' => :image,
150
- 'dib' => :image,
151
- 'dif' => :office,
152
- 'divx' => :video,
153
- 'dng' => :image,
154
- 'docx' => :office,
155
- 'dpx' => :image,
156
- 'epdf' => :image,
157
- 'epi' => :image,
158
- 'eps2' => :image,
159
- 'eps3' => :image,
160
- 'epsf' => :image,
161
- 'epsi' => :image,
162
- 'ept' => :image,
163
- 'exr' => :image,
164
- 'fax' => :image,
165
- 'fb2' => :office,
166
- 'fits' => :image,
167
- 'fodg' => :office,
168
- 'fodp' => :office,
169
- 'fods' => :office,
170
- 'fodt' => :office,
171
- 'gplt' => :image,
172
- 'gray' => :image,
173
- 'hdr' => :image,
174
- 'hpw' => :office,
175
- 'hrz' => :image,
176
- 'info' => :image,
177
- 'inline' => :image,
178
- 'j2c' => :image,
179
- 'j2k' => :image,
180
- 'jbig' => :image,
181
- 'jng' => :image,
182
- 'jp2' => :image,
183
- 'jpt' => :image,
184
- 'jxr' => :image,
185
- 'key' => :office,
186
- 'log' => :plaintext,
187
- 'mat' => :image,
188
- 'mcw' => :office,
189
- 'met' => :office,
190
- 'miff' => :image,
191
- 'mml' => :office,
192
- 'mono' => :image,
193
- 'mpr' => :image,
194
- 'mrsid' => :image,
195
- 'mrw' => :image,
196
- 'mtv' => :image,
197
- 'mvg' => :image,
198
- 'mw' => :office,
199
- 'mwd' => :office,
200
- 'mxf' => :video,
201
- 'nef' => :image,
202
- 'numbers' => :office,
203
- 'orf' => :image,
204
- 'otb' => :image,
205
- 'p7' => :image,
206
- 'pages' => :office,
207
- 'palm' => :image,
208
- 'pam' => :image,
209
- 'pcd' => :image,
210
- 'pcds' => :image,
211
- 'pdf' => :pdf,
212
- 'pef' => :image,
213
- 'picon' => :image,
214
- 'pict' => :image,
215
- 'pix' => :image,
216
- 'pm' => :office,
217
- 'pm6' => :office,
218
- 'pmd' => :office,
219
- 'png00' => :image,
220
- 'png24' => :image,
221
- 'png32' => :image,
222
- 'png48' => :image,
223
- 'png64' => :image,
224
- 'png8' => :image,
225
- 'ps2' => :image,
226
- 'ps3' => :image,
227
- 'ptif' => :image,
228
- 'pwp' => :image,
229
- 'rad' => :image,
230
- 'raf' => :image,
231
- 'rfg' => :image,
232
- 'rgba' => :image,
233
- 'rla' => :image,
234
- 'rle' => :image,
235
- 'sct' => :image,
236
- 'sfw' => :image,
237
- 'sgf' => :office,
238
- 'sgv' => :office,
239
- 'slk' => :office,
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' => :image,
242
- 'svm' => :office,
243
- 'sylk' => :office,
244
- 'tim' => :image,
245
- 'txt' => :plaintext,
246
- 'uil' => :image,
247
- 'uof' => :office,
248
- 'uop' => :office,
249
- 'uos' => :office,
250
- 'uot' => :office,
251
- 'uyvy' => :image,
252
- 'vds' => :office,
253
- 'vdx' => :office,
254
- 'vicar' => :image,
255
- 'viff' => :image,
256
- 'vsdx' => :office,
257
- 'webm' => :video,
258
- 'wb2' => :office,
259
- 'wk1' => :office,
260
- 'wk3' => :office,
261
- 'wn' => :office,
262
- 'wpg' => :image,
263
- 'wq1' => :office,
264
- 'wq2' => :office,
265
- 'x' => :image,
266
- 'x3f' => :image,
267
- 'xcf' => :image,
268
- 'xlk' => :office,
269
- 'xlsx' => :office,
270
- 'xls' => :office,
271
- 'ycbcr' => :image,
272
- 'ycbcra' => :image,
273
- 'yuv' => :image,
274
- 'zabw' => :office}
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