fourtrack 0.2.1 → 0.3.1

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
  SHA1:
3
- metadata.gz: 9ebbe01e30d229b4e2d5c2b996db4127dec33388
4
- data.tar.gz: a719617f6328f930c24cb0c97b3613733ea58dde
3
+ metadata.gz: 3370d738e793257af043fed74f17fdaa33206461
4
+ data.tar.gz: cea972d9d586177bafd5b03a9cc7e5016810ff22
5
5
  SHA512:
6
- metadata.gz: 8456813b285fab9ada3d6b88780458220a9a797956952eaf9b5e1f595631e39100659e02eca7ee1560560240f4988e25a7f57360aff1082bbc1a346e9a843a21
7
- data.tar.gz: f3e78874d0b329d52fab32e294766da05c759b4a4af8e85e12ca77eda337f85972a268e3b82ade63ca4808d677261091f18c1db3091b74ffbb13f7b795c5ce41
6
+ metadata.gz: 9d2eb21b384c47468b35cb240294f0fc260e24812af6bd7a835e9729c066e316c81b36eaf9f1fac3afcf3e9f2ddc7f3db283074c4023c3d87e474915ddd0429a
7
+ data.tar.gz: ba7643ebcbd3dca5c08f7fc6b0611f8802937c10de01bd8b09dcc653fb4c430854bf1ac2c303b22fac9358bb2f1e8cba68b2da4f1954343972330ef7fe96970a
@@ -1,5 +1,7 @@
1
+ dist: trusty # https://docs.travis-ci.com/user/trusty-ci-environment/
1
2
  sudo: false
2
- language: ruby
3
+ cache: bundler
4
+
3
5
  rvm:
4
6
  - 2.2.5
5
- before_install: gem install bundler -v 1.12.5
7
+ - 2.3.3
@@ -2,5 +2,6 @@ require "fourtrack/version"
2
2
  module Fourtrack
3
3
  require 'zlib'
4
4
  require_relative 'fourtrack/recorder'
5
+ require_relative 'fourtrack/rotating_recorder'
5
6
  require_relative 'fourtrack/player'
6
7
  end
@@ -14,6 +14,12 @@ class Fourtrack::Player
14
14
  break if @io.eof?
15
15
  zr = Zlib::GzipReader.new(@io)
16
16
  zr.each_line(&blk)
17
+ # TODO:
18
+ # this basically allocates a GIANT string if the file is big
19
+ # and the amount of data remaining is substantial.
20
+ # See
21
+ # https://github.com/ruby/ruby/blob/0adce993578ca4c40afbbc04c5f4679561bd7861/ext/zlib/zlib.c#L2948
22
+ # Something different is needed - maybe even streaming from commandline gunzip...
17
23
  unused_bytestr = zr.unused
18
24
  zr.finish
19
25
  if unused_bytestr && unused_bytestr.bytesize.nonzero?
@@ -14,7 +14,7 @@ class Fourtrack::Recorder
14
14
  @flush_every = flush_after
15
15
  # Attempt to open the file for writing,
16
16
  # which will raise an exception outright if we do not have access
17
- File.open(@output_path, 'a') {}
17
+ File.open(output_path, 'a') {}
18
18
  # and once we know we were able to open it, install an at_exit block for ourselves
19
19
  install_at_exit_hook!
20
20
  end
@@ -65,15 +65,18 @@ class Fourtrack::Recorder
65
65
  @buf.clear
66
66
  end
67
67
 
68
- @logger.debug { "%s: Flushing to %s, size before flush %d" % [self, @output_path, File.size(@output_path)] }
69
- File.open(@output_path, 'ab') { |f| f << io_buf.string }
70
- @logger.debug { "%s: After flush to %s size %d" % [self, @output_path, File.size(@output_path)] }
68
+ File.open(output_path, 'ab') { |f| f << io_buf.string }
69
+ @logger.debug { "%s: After flush to %s size %d" % [self, output_path, File.size(output_path)] }
71
70
 
72
71
  io_buf.truncate(0)
73
72
  end
74
73
 
75
74
  private
76
75
 
76
+ def output_path
77
+ @output_path
78
+ end
79
+
77
80
  def install_at_exit_hook!
78
81
  at_exit { flush! if pending? }
79
82
  end
@@ -0,0 +1,15 @@
1
+ # Can be used the same as a Recorder, but it will output path
2
+ # as the format argument for `Time#strftime`
3
+ class Fourtrack::RotatingRecorder < Fourtrack::Recorder
4
+ def initialize(output_pattern:, **options_for_recorder)
5
+ @output_path_pattern = output_pattern
6
+ first_file_path = Time.now.utc.strftime(@output_path_pattern)
7
+ super(output_path: first_file_path, **options_for_recorder)
8
+ end
9
+
10
+ private
11
+
12
+ def output_path
13
+ Time.now.utc.strftime(@output_path_pattern)
14
+ end
15
+ end
@@ -1,3 +1,3 @@
1
1
  module Fourtrack
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fourtrack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julik Tarkhanov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-07 00:00:00.000000000 Z
11
+ date: 2017-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -71,6 +71,7 @@ files:
71
71
  - lib/fourtrack.rb
72
72
  - lib/fourtrack/player.rb
73
73
  - lib/fourtrack/recorder.rb
74
+ - lib/fourtrack/rotating_recorder.rb
74
75
  - lib/fourtrack/version.rb
75
76
  homepage: https://github.com/WeTransfer/fourtrack
76
77
  licenses: