rumu 0.3.0 → 0.3.5

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 (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/rumu +33 -28
  3. metadata +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2ce3ca00e1302fb06489bdc6cc1bdba2b7ae0b63e7f708cda2bd5f44b703ac7b
4
- data.tar.gz: 3863590d73009b330208e26393785958221e8c0bbb278fa69b5c4a98141949d1
3
+ metadata.gz: d06d25705c6b4da13ff00b1825e53739188fd5e2412c3135d0ce4a6586d4a7cb
4
+ data.tar.gz: 31c076843b5894506d1e706277309933ed13e2e70f9c9170225f5ddec58269ba
5
5
  SHA512:
6
- metadata.gz: 9f0cf8ec4200de7b176b1fd1d94f64ecc8ef5ee013e5f1ad05d44770b41637e7ca1eb8339a05621541d2089c2fb7a1dc0e06ab327947c020c0d09f73f0828e72
7
- data.tar.gz: b9d3550542d9854ec5ac8cbe003fb2c75c617a10152025ad1bed3c04fc8866cd3a131dd3c3b6763e7a106a3f829a77fcdbc3143d470b7ff9a38bda776dd6deda
6
+ metadata.gz: fdcda38fa11055f5edea07c3bb83dad0a518ba6c97add5f281413b650451ed84c73e1354ed48248ab0d6a2837649a16aa94892b0a7b80d4da342a4ec183a8cc2
7
+ data.tar.gz: 6345879a1a65267e661cd755d1241d40c1f8ef297a6e8505ec675d14847cb3ab72ac761c1cb232487225bf2500f8ccfd93555b60fe0c11b6cdea45cf8761c6ca
data/bin/rumu CHANGED
@@ -5,22 +5,17 @@ require 'io/console'
5
5
  require 'pathname'
6
6
 
7
7
  pkg='rumu'
8
- ver='0.3'
8
+ ver='0.3.5'
9
9
  pkgd="#{Dir.home}/.config/#{pkg}"
10
10
 
11
- word=4
12
- rate=44100
13
- chan=2
14
- cycle=0
15
-
16
- ff_exe="ffmpeg -hide_banner"
11
+ chan,rate,word=2,44100,4
17
12
  ff_fmt="-ac #{chan} -ar #{rate} -f f#{word*8}le"
18
- ff_out="-f pulse default"
19
13
 
20
- list=[]
21
- list_i=0
22
- mode=:load
23
- toff=''
14
+ Dir.mkdir(pkgd) unless File.directory?(pkgd)
15
+ File.write(pkgd+"/dev","-f pulse default") unless File.file?("#{pkgd}/dev")
16
+ ff_out=File.read(pkgd+"/dev")
17
+
18
+ list,list_i,cycle,mode,ssoff,help=[],0,0,:load,'',''
24
19
  if ARGV.length==0
25
20
  if File.file?("#{pkgd}/list")
26
21
  list=File.read("#{pkgd}/list").split("\n")
@@ -39,10 +34,11 @@ else
39
34
  list=ARGV.map{|x|Pathname(x).realpath.to_s}
40
35
  end
41
36
  prefix=/\A(.*).*(\n\1.*)*\Z/.match(list.join("\n"))[1]
37
+ puts prefix
42
38
 
43
39
  ii,io,ie,it=nil,nil,nil,nil
44
- oi,oo,oe,ot=Open3.popen3("#{ff_exe} #{ff_fmt} -i - #{ff_out}")
45
- [oo,oe].each{|x|x.close}
40
+ oi,oo,oe,ot=Open3.popen3("ffmpeg -loglevel -8 #{ff_fmt} -i - #{ff_out}")
41
+ oo.close
46
42
 
47
43
  pt=Thread.new{
48
44
  until :quit == mode
@@ -52,42 +48,51 @@ pt=Thread.new{
52
48
  end
53
49
  case mode
54
50
  when :load #load new track
55
- io.close unless !io or io.closed?
56
- ii,io,ie,it = Open3.popen3 "#{ff_exe} -i #{Shellwords.escape(list[list_i])} #{ssoff} #{ff_fmt} -"
57
- [ii,ie].each{|x|x.close}
51
+ [io,ie].each{|x|x.close} unless !io or io.closed?
52
+ ii,io,ie,it = Open3.popen3 "ffmpeg -loglevel -8 -i #{Shellwords.escape(list[list_i])} #{ssoff} #{ff_fmt} -"
53
+ ii.close
58
54
  cycle=0 unless ssoff.length > 0
59
- puts
55
+ puts "#{' '*help.length}\r#{list[list_i][prefix.length..-1]}"
56
+ ssoff=''
57
+ help=''
60
58
  mode=:play
61
59
  when :play
62
60
  oi.write(io.read(word*chan*rate))
63
61
  cycle+=1
64
62
  end
65
63
  end
64
+ [oi,oe].each{|x|x.close}
66
65
  }
67
66
 
68
67
  until :quit == mode
69
- print "\r#{list[list_i][prefix.length..-1]} [#{cycle/60}:#{"%02d"%(cycle%60)}] [N]ext #{list_i>0?"[P]rev ":""}[Q]uit > "
70
- case IO.console.raw{|c|c.read_nonblock(1) rescue ''}
68
+ print "\r#{cycle/60}:#{"%02d"%(cycle%60)} > "
69
+ case ch=IO.console.raw{|c|c.read_nonblock(1) rescue ''}.downcase
71
70
  when 'n'
72
71
  list_i+=1
73
72
  mode= list_i<list.count ? :load : :quit
73
+ when 'r'
74
+ mode=:load
74
75
  when 'p'
75
76
  if list_i>0
76
77
  list_i-=1
77
78
  mode=:load
78
79
  end
80
+ when 's'
81
+ print "Seek to: "
82
+ ti=(ts=IO.console.readline.chomp).split(':')
83
+ ssoff="-ss #{ts}"
84
+ cycle=(ti[-1].to_f + ti[-2].to_f*60 + ti[-3].to_f*60*60).to_i
85
+ mode=:load
79
86
  when 'q'
80
87
  mode=:quit
81
- else
88
+ File.write(pkgd+"/list",list.join("\n"))
89
+ File.write(pkgd+"/pos",list_i.to_s+"\n"+cycle.to_s)
90
+ when ''
82
91
  sleep rand
92
+ else
93
+ print (help="#{ch} < #{list_i>0?"[P]rev ":""}[R]estart [S]eek [N]ext [Q]uit")
83
94
  end
84
95
  end
85
96
 
86
- if list_i<list.count
87
- Dir.mkdir(pkgd) unless File.directory?(pkgd)
88
- File.write(pkgd+"/list",list.join("\n"))
89
- File.write(pkgd+"/pos",list_i.to_s+"\n"+cycle.to_s)
90
- end
91
-
92
- puts " ] #{pkg} ✝ v#{ver} [ "
97
+ puts "\r ] #{pkg} ✝ v#{ver} [ "
93
98
  pt.join
metadata CHANGED
@@ -1,18 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rumu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Cook
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-27 00:00:00.000000000 Z
11
+ date: 2021-03-30 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: rum is an aggressively minimized audio player that plays a playlist gaplessly
14
- leveraging command-line ffmpeg and pipes. After a quit, it will return to where
15
- it left off when run next.
13
+ description: rumu is an aggressively minimized audio player that plays a playlist
14
+ gaplessly leveraging command-line ffmpeg and pipes. After a quit, it will return
15
+ to where it left off when run next.
16
16
  email: root@baryon.it
17
17
  executables:
18
18
  - rumu