format_parser 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: db8e4506635f3537372a808c9ab1fae08aba28a80cd5671616be56728f472b15
4
- data.tar.gz: 6ba88eeff2cba9e3d77cb2bf3a5af25cc73dbff384a6c92104a2f7f669313c7c
3
+ metadata.gz: 90c91543dad4ef03fec136ae3b8fd3385ee518e5bbbebbba867a75142a1780f0
4
+ data.tar.gz: 5e7d286eefc1170391b6ff896d20e24f39682d2e5e4dc8a7c0b4c67df82eac92
5
5
  SHA512:
6
- metadata.gz: 74f4bfce599ad2a9897009b9cb4f443dc00233ac0aff1eec104f71cdb820e5e4b63cfa82ca92ac67c44e3092a307801512fc275af86d60283ea1c9c604175712
7
- data.tar.gz: ce6b0972fa92c85d04a8a6c3cfa42d1834a1c3bb63e157021c694a8e390922f8d61d51f7072ed818805a8ac7b1358401a1a1d8ee7866c34c8698446dd6b386ed
6
+ metadata.gz: 864c0a272275c3d877ecf6fac7b2d7a080876074ee8e7b5858270da1418737cca3b8abc7290649a41f662209c2cf953f714334dc1adb6dabd68187fa3e2fcd25
7
+ data.tar.gz: cb04914d011588f6b53976fa5123f13b6ef9f5eb10c40bae1ea4e7c13ba51f382f10721d865164a4f8460554cb28881db7c8f4ff2217d4b1d0a115dbe5fbdf5e
data/lib/audio.rb CHANGED
@@ -11,12 +11,11 @@ module FormatParser
11
11
  # and for video files with embedded sound
12
12
  attr_accessor :num_audio_channels
13
13
 
14
- # SampeThe number of audio channels for sound files that are muxed
15
- # and for video files with embedded sound
14
+ # The sample rate of the audio file in hertz, as an Integer
16
15
  attr_accessor :audio_sample_rate_hz
17
16
 
18
- # Duration of the media object (be it audio or video) in seconds,
19
- # as a Float
17
+ # Duration of the media object (be it audio or video)
18
+ # in seconds, as a Float
20
19
  attr_accessor :media_duration_seconds
21
20
 
22
21
  # Duration of the media object in addressable frames or samples,
@@ -1,3 +1,3 @@
1
1
  module FormatParser
2
- VERSION = '0.5.1'
2
+ VERSION = '0.5.2'
3
3
  end
@@ -98,6 +98,9 @@ class FormatParser::JPEGParser
98
98
  @height = scanner.height
99
99
  end
100
100
  end
101
+ rescue EXIFR::MalformedJPEG
102
+ # Not a JPEG or the Exif headers contain invalid data, or
103
+ # an APP1 marker was detected in a file that is not a JPEG
101
104
  end
102
105
 
103
106
  def read_frame
@@ -7,4 +7,10 @@ describe 'Parsing esoteric files and files causing ambiguous detection' do
7
7
  expect(result).not_to be_nil
8
8
  expect(result.nature).to eq(:document)
9
9
  end
10
+
11
+ it 'does not return a result for a Keynote file when it mistakes it for a JPEG, and does not raise any errors' do
12
+ jpeg_path = fixtures_dir + '/JPEG/keynote_recognized_as_jpeg.key'
13
+ result = FormatParser.parse(File.open(jpeg_path, 'rb'))
14
+ expect(result).to be_nil
15
+ end
10
16
  end
@@ -48,4 +48,11 @@ describe FormatParser::JPEGParser do
48
48
  expect(result.height_px).to eq(1280)
49
49
  expect(result.intrinsics).to eq(exif_pixel_x_dimension: 8214, exif_pixel_y_dimension: 5476)
50
50
  end
51
+
52
+ it 'fails correctly (with the right exception being raised) on a Keynote file' do
53
+ jpeg_path = fixtures_dir + '/JPEG/keynote_recognized_as_jpeg.key'
54
+ expect {
55
+ subject.call(File.open(jpeg_path, 'rb'))
56
+ }.to raise_error(FormatParser::IOUtils::InvalidRead)
57
+ end
51
58
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: format_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Noah Berman
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2018-04-10 00:00:00.000000000 Z
12
+ date: 2018-04-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ks