tdiary-contrib 3.2.2.20130518 → 3.2.2.20130614

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -3
  3. data/doc/ja/plugin/image_gps.txt +56 -17
  4. data/doc/ja/plugin/playstore.txt +31 -0
  5. data/js/socialbutton.js +8 -2
  6. data/lib/exifparser/README +6 -12
  7. data/lib/tdiary-contrib.rb +7 -6
  8. data/plugin/brow_si.rb +32 -0
  9. data/plugin/image_gps.rb +110 -56
  10. data/plugin/instagr.rb +1 -0
  11. data/plugin/playstore.rb +161 -0
  12. data/plugin/tweet_quote.rb +102 -48
  13. data/plugin/twitter_badge.rb +1 -1
  14. data/util/estraier-search/estraier-register.rb +2 -1
  15. data/util/estraier-search/estraier-search.rb +2 -1
  16. data/util/image-gallery/misc/plugin/recent_image.rb +1 -1
  17. metadata +7 -27
  18. data/doc/ja/plugin/image_detail.txt +0 -69
  19. data/doc/ja/plugin/image_gps2.txt +0 -41
  20. data/lib/exifparser/BUGS +0 -1
  21. data/lib/exifparser/ChangeLog +0 -169
  22. data/lib/exifparser/install.rb +0 -1015
  23. data/lib/exifparser/lib/exifparser/makernote/canon.rb +0 -502
  24. data/lib/exifparser/lib/exifparser/makernote/fujifilm.rb +0 -415
  25. data/lib/exifparser/lib/exifparser/makernote/minolta.rb +0 -84
  26. data/lib/exifparser/lib/exifparser/makernote/mk_nikonflensname.rb +0 -39
  27. data/lib/exifparser/lib/exifparser/makernote/nikon.rb +0 -267
  28. data/lib/exifparser/lib/exifparser/makernote/nikon2.rb +0 -581
  29. data/lib/exifparser/lib/exifparser/makernote/nikonflensname.rb +0 -438
  30. data/lib/exifparser/lib/exifparser/makernote/olympus.rb +0 -225
  31. data/lib/exifparser/lib/exifparser/makernote/prove.rb +0 -84
  32. data/lib/exifparser/lib/exifparser/makernote/sigma.rb +0 -237
  33. data/lib/exifparser/lib/exifparser/pre-setup.rb +0 -1
  34. data/lib/exifparser/lib/exifparser/scan.rb +0 -278
  35. data/lib/exifparser/lib/exifparser/tag.rb +0 -2298
  36. data/lib/exifparser/lib/exifparser/thumbnail.rb +0 -76
  37. data/lib/exifparser/lib/exifparser/utils.rb +0 -88
  38. data/lib/exifparser/lib/exifparser.rb +0 -265
  39. data/lib/exifparser/sample/exifview.rb +0 -279
  40. data/plugin/image_detail.rb +0 -143
@@ -1,278 +0,0 @@
1
- #
2
- # exifparser/scan.rb
3
- #
4
- # Copyright (C) 2002 Ryuichi Tamura (r-tam@fsinet.or.jp)
5
- #
6
- # $Revision: 1.2 $
7
- # $Date: 2003/04/20 19:58:31 $
8
- #
9
- #
10
- require 'exifparser/utils'
11
- require 'exifparser/tag'
12
- require 'exifparser/makernote/prove'
13
-
14
- module Exif
15
-
16
- class Scanner
17
-
18
- def initialize(fin)
19
- @fin = fin.binmode
20
- @result = {}
21
- @tiffHeader0 = nil # origin at which TIFF header begins
22
- @byteOrder_module = nil
23
- end
24
- attr_reader :result
25
-
26
- def finish
27
- @fin.close
28
- end
29
-
30
- def scan
31
- tic = Time.now if $DEBUG
32
- #
33
- # check soi (start of image)
34
- #
35
- @fin.pos = 0
36
- unless get_soi == 0xFFD8
37
- raise RuntimeError, 'not JPEG format'
38
- end
39
-
40
- #
41
- # seek app1 (EXIF signature)
42
- #
43
- begin
44
- marker = get_marker
45
- break if (marker == 0xFFE1)
46
- size = get_marker_datasize
47
- @fin.seek(size - 2, IO::SEEK_CUR)
48
- end while (!@fin.eof?)
49
-
50
- if marker != 0xFFE1
51
- raise RuntimeError, 'not EXIF format'
52
- end
53
-
54
- #
55
- # get app1 Data size
56
- #
57
- @result[:app1DataSize] = get_marker_datasize()
58
- curpos = @fin.pos
59
- @result[:app1Data] = fin_read_n(@result[:app1DataSize])
60
- @fin.pos = curpos
61
-
62
- #
63
- # EXIF header must be exactly "Exif\000\000", but some model
64
- # does not provide correct one. So we relax the condition.
65
- #
66
- if (h = exif_identifier()) !~ /\AExif\000/
67
- raise RuntimeError, "Invalid EXIF header: #{h}"
68
- end
69
-
70
- #
71
- # examine TIFF header
72
- #
73
- @tiffHeader0, tiff_header = get_tiff_header()
74
-
75
- #
76
- # get byte order
77
- #
78
- case tiff_header[0,2]
79
- when "MM"
80
- @byteOrder_module = Utils::Decode::Motorola
81
- when "II"
82
- @byteOrder_module = Utils::Decode::Intel
83
- else
84
- raise RuntimeError, "Unknown byte order"
85
- end
86
- self.extend @byteOrder_module
87
- @result[:offset_IFD0] = decode_ulong(tiff_header[4..-1])
88
-
89
- #
90
- # IFD0
91
- #
92
- @fin.pos = @tiffHeader0 + @result[:offset_IFD0]
93
- @result[:IFD0] = []
94
- scan_IFD(Tag::IFD0Table, Tag::IFD0Table.name) do |tag|
95
- @result[:IFD0].push tag
96
- end
97
-
98
- #
99
- # IFD1
100
- #
101
- @result[:IFD1] = []
102
- next_ifd = decode_ulong(fin_read_n(4))
103
- if next_ifd > 0
104
- @fin.pos = @tiffHeader0 + next_ifd
105
- scan_IFD(Tag::IFD1Table, Tag::IFD1Table.name) do |tag|
106
- @result[:IFD1].push tag
107
- end
108
- end
109
-
110
- #
111
- # GPS IFD
112
- #
113
- @result[:GPS] = []
114
- found = @result[:IFD0].find{ |e|
115
- e.class == Tag::GPSIFDPointer
116
- }
117
- if found
118
- @result[:offset_GPS] = found.processData
119
- @fin.pos = @tiffHeader0 + @result[:offset_GPS]
120
- scan_IFD(Tag::GPSIFDTable, Tag::GPSIFDTable.name) do |tag|
121
- @result[:GPS].push tag
122
- end
123
- end
124
-
125
- #
126
- # Exif IFD
127
- #
128
- @result[:Exif] = []
129
- found = @result[:IFD0].find{ |e|
130
- e.class == Tag::ExifIFDPointer
131
- }
132
- if found
133
- @result[:offset_Exif] = found.processData
134
- @fin.pos = @tiffHeader0 + @result[:offset_Exif]
135
- scan_IFD(Tag::ExifIFDTable, Tag::ExifIFDTable.name) do |tag|
136
- @result[:Exif].push tag
137
- end
138
- end
139
-
140
- #
141
- # Interoperability subIFD
142
- #
143
- @result[:Interoperability] = []
144
- found = @result[:Exif].find {|e|
145
- e.class == Tag::InteroperabilityIFDPointer
146
- }
147
- if found
148
- @result[:offset_InteroperabilityIFD] = found.processData
149
- @fin.pos = @tiffHeader0 + @result[:offset_InteroperabilityIFD]
150
- scan_IFD(Tag::InteroperabilityIFDTable, Tag::InteroperabilityIFDTable.name) do |tag|
151
- @result[:Interoperability].push tag
152
- end
153
- end
154
-
155
- #
156
- # MakerNote subIFD
157
- #
158
- @result[:MakerNote]=[]
159
- found = @result[:Exif].find {|e| e.class == Tag::Exif::MakerNote }
160
- if (found)
161
- begin
162
- # Because some vendors do not put any identifier in the header,
163
- # we try to find which model is by seeing Tag::TIFF::Make, Tag::TIFF::Model.
164
- make = @result[:IFD0].find {|e| e.class == Tag::TIFF::Make}
165
- model = @result[:IFD0].find {|e| e.class == Tag::TIFF::Model}
166
- # prove the maker
167
- makernote_class = Exif::MakerNote.prove(found.data, make, model)
168
- # set file pointer to the position where the tag was found.
169
- @fin.pos = found.pos
170
- makernote = makernote_class.new(@fin, @tiffHeader0, found.dataPos, @byteOrder_module)
171
- makernote.scan_IFD do |tag|
172
- @result[:MakerNote].push tag
173
- end
174
- rescue MakerNote::NotSupportedError
175
- rescue Exception # what to do?
176
- if $DEBUG
177
- raise $!
178
- end
179
- end
180
- end
181
-
182
- #
183
- # get thumbnail
184
- #
185
- if !@result[:IFD1].empty?
186
- format = @result[:IFD1].find do |e|
187
- e.class == Tag::TIFF::Compression
188
- end.value
189
- unless format == 6
190
- raise NotImplementedError, "Sorry, thumbnail of other than JPEG format is not supported."
191
- end
192
- thumbStart = @result[:IFD1].find do |e|
193
- e.class == Exif::Tag::TIFF::JpegInterchangeFormat
194
- end.value
195
- thumbLen = @result[:IFD1].find do |e|
196
- e.class == Exif::Tag::TIFF::JpegInterchangeFormatLength
197
- end.value
198
- @fin.pos = @tiffHeader0 + thumbStart
199
- # check JPEG soi maker
200
- if get_soi != 0xFFD8
201
- raise RuntimeError, 'not JPEG format'
202
- end
203
- @fin.pos = @fin.pos - 2
204
- # now read thumbnail image
205
- @result[:Thumbnail] = @fin.read(thumbLen)
206
- end
207
-
208
- # turn on if $DEBUG
209
- toc = Time.now if $DEBUG
210
- puts(sprintf("scan time: %1.4f sec.", toc-tic)) if $DEBUG
211
- end
212
-
213
- private
214
-
215
- def fin_read_n(n)
216
- @fin.read(n)
217
- end
218
-
219
- def scan_IFD(tagTable, ifdname)
220
- num_dirs = decode_ushort(fin_read_n(2))
221
- 1.upto(num_dirs) {
222
- curpos_tag = @fin.pos
223
- tag = parseTagID(fin_read_n(2))
224
- tagclass = Tag.find(tag.hex, tagTable)
225
- unit, formatter = Tag::Format::Unit[decode_ushort(fin_read_n(2))]
226
- count = decode_ulong(fin_read_n(4))
227
- tagdata = fin_read_n(4)
228
- next if formatter == nil
229
- obj = tagclass.new(tag, ifdname, count)
230
- obj.extend formatter, @byteOrder_module
231
- obj.pos = curpos_tag
232
- if unit * count > 4
233
- curpos = @fin.pos
234
- begin
235
- @fin.pos = @tiffHeader0 + decode_ulong(tagdata)
236
- obj.dataPos = @fin.pos
237
- obj.data = fin_read_n(unit*count)
238
- ensure
239
- @fin.pos = curpos
240
- end
241
- else
242
- obj.dataPos = @fin.pos - 4
243
- obj.data = tagdata
244
- end
245
- obj.processData
246
- yield obj
247
- }
248
- end
249
-
250
- def get_soi
251
- (@fin.read(1).unpack("C*")[0]) << 8 | (@fin.read(1).unpack("C*")[0])
252
- end
253
-
254
- def get_marker
255
- (@fin.read(1).unpack("C*")[0]) << 8 | (@fin.read(1).unpack("C*")[0])
256
- end
257
-
258
- def get_marker_datasize
259
- (@fin.read(1).unpack("C*")[0]) << 8 | (@fin.read(1).unpack("C*")[0])
260
- end
261
-
262
- def exif_identifier
263
- @fin.read(6)
264
- end
265
-
266
- def get_tiff_header
267
- pos = @fin.pos
268
- [pos, fin_read_n(8)]
269
- end
270
-
271
- def eoi
272
- @fin.seek(-2, IO::SEEK_END)
273
- @fin.read(2)
274
- end
275
-
276
- end
277
-
278
- end