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 +4 -4
- data/.travis.yml +4 -2
- data/lib/fourtrack.rb +1 -0
- data/lib/fourtrack/player.rb +6 -0
- data/lib/fourtrack/recorder.rb +7 -4
- data/lib/fourtrack/rotating_recorder.rb +15 -0
- data/lib/fourtrack/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3370d738e793257af043fed74f17fdaa33206461
|
4
|
+
data.tar.gz: cea972d9d586177bafd5b03a9cc7e5016810ff22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d2eb21b384c47468b35cb240294f0fc260e24812af6bd7a835e9729c066e316c81b36eaf9f1fac3afcf3e9f2ddc7f3db283074c4023c3d87e474915ddd0429a
|
7
|
+
data.tar.gz: ba7643ebcbd3dca5c08f7fc6b0611f8802937c10de01bd8b09dcc653fb4c430854bf1ac2c303b22fac9358bb2f1e8cba68b2da4f1954343972330ef7fe96970a
|
data/.travis.yml
CHANGED
data/lib/fourtrack.rb
CHANGED
data/lib/fourtrack/player.rb
CHANGED
@@ -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?
|
data/lib/fourtrack/recorder.rb
CHANGED
@@ -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(
|
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
|
-
|
69
|
-
|
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
|
data/lib/fourtrack/version.rb
CHANGED
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.
|
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-
|
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:
|