rumu 0.3.1 → 0.3.2

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 +24 -19
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: caa90367efb46acc18ef760c9c8aaa7b419c76647e5363b298820e75f6470c5e
4
- data.tar.gz: 8a2f3f3bf5538bdba349ddfbc87976305bbf5dc0f5c8c2f4804f2a1c24dd0c87
3
+ metadata.gz: b10238932023ff15c41d24d35b464e641ab0296e3585b7b0810dfa2236af0667
4
+ data.tar.gz: 4ca176a03fff38fb7ba458451cf55501dc54815521091678886faab1c853ebfc
5
5
  SHA512:
6
- metadata.gz: c7d7101a7a9d234e418c973b20790291eb719199bea093255c6c5c09da3e11520c5806c293c513caaa574c73edd5c79a29c4aec4f907191146b6c857c3588df0
7
- data.tar.gz: d1d6370be84e12e1b693eabb6381ac4e2497a46fd56bd694c5366a2fb5083a4e4e1c09adb706c75a7fc445d9849071f530d8cfe471f4169df3ee41178eb05313
6
+ metadata.gz: aaae6228959f26c275844f2082b67f95c49a312a867e6d1f3e4c6a5a8faa065b0e79631792b80462a4311910c8d3264c3fd7383749041a13689ba8937a497f88
7
+ data.tar.gz: 72671d72da7b9572091257497f8a26132d8cf1ef1fba6e42a271302c1b505735ead974a7b31a2e88f93f04c76eba499bd6c2b26742c1730fb9fcb3fac3a33b3a
data/bin/rumu CHANGED
@@ -5,19 +5,16 @@ require 'io/console'
5
5
  require 'pathname'
6
6
 
7
7
  pkg='rumu'
8
- ver='0.3.1'
8
+ ver='0.3.2'
9
9
  pkgd="#{Dir.home}/.config/#{pkg}"
10
10
 
11
- word=4
12
- rate=44100
13
- chan=2
11
+ chan,rate,word=2,44100,4
14
12
  ff_fmt="-ac #{chan} -ar #{rate} -f f#{word*8}le"
15
13
 
16
- cycle=0
17
- list=[]
18
- list_i=0
19
- mode=:load
20
- ssoff=''
14
+ File.write(pkgd+"/dev","-f pulse default") unless File.file?("#{pkgd}/dev")
15
+ ff_out=File.read(pkgd+"/dev")
16
+
17
+ list,list_i,cycle,mode,ssoff,help=[],0,0,:load,'',''
21
18
  if ARGV.length==0
22
19
  if File.file?("#{pkgd}/list")
23
20
  list=File.read("#{pkgd}/list").split("\n")
@@ -36,9 +33,10 @@ else
36
33
  list=ARGV.map{|x|Pathname(x).realpath.to_s}
37
34
  end
38
35
  prefix=/\A(.*).*(\n\1.*)*\Z/.match(list.join("\n"))[1]
36
+ puts prefix
39
37
 
40
38
  ii,io,ie,it=nil,nil,nil,nil
41
- oi,oo,oe,ot=Open3.popen3("ffmpeg #{ff_fmt} -i - -f pulse default")
39
+ oi,oo,oe,ot=Open3.popen3("ffmpeg #{ff_fmt} -i - #{ff_out}")
42
40
  oo.close
43
41
 
44
42
  pt=Thread.new{
@@ -51,6 +49,8 @@ pt=Thread.new{
51
49
  when :load #load new track
52
50
  [io,ie].each{|x|x.close} unless !io or io.closed?
53
51
  ii,io,ie,it = Open3.popen3 "ffmpeg -i #{Shellwords.escape(list[list_i])} #{ssoff} #{ff_fmt} -"
52
+ print ' '*help.length
53
+ help=''
54
54
  puts "\r#{list[list_i][prefix.length..-1]}"
55
55
  ii.close
56
56
  cycle=0 unless ssoff.length > 0
@@ -65,29 +65,34 @@ pt=Thread.new{
65
65
 
66
66
  until :quit == mode
67
67
  print "\r#{cycle/60}:#{"%02d"%(cycle%60)} > "
68
- case ch=IO.console.raw{|c|c.read_nonblock(1) rescue ''}
68
+ case ch=IO.console.raw{|c|c.read_nonblock(1) rescue ''}.downcase
69
69
  when 'n'
70
70
  list_i+=1
71
71
  mode= list_i<list.count ? :load : :quit
72
+ when 'r'
73
+ mode=:load
72
74
  when 'p'
73
75
  if list_i>0
74
76
  list_i-=1
75
77
  mode=:load
76
78
  end
79
+ when 's'
80
+ print "Seek to: "
81
+ ti=(ts=IO.console.readline.chomp).split(':')
82
+ ssoff="-ss #{ts}"
83
+ cycle=(ti[-1].to_f + ti[-2].to_f*60 + ti[-3].to_f*60*60).to_i
84
+ mode=:load
77
85
  when 'q'
78
86
  mode=:quit
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)
79
90
  when ''
80
91
  sleep rand
81
92
  else
82
- print "#{ch} < [N]ext #{list_i>0?"[P]rev ":""}[Q]uit"
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 "\r ] #{pkg} ✝ v#{ver} [ "
97
+ puts "\r ] #{pkg} ✝ v#{ver} [ "
93
98
  pt.join
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rumu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Cook