rumu 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/bin/rumu +93 -0
  3. metadata +46 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2ce3ca00e1302fb06489bdc6cc1bdba2b7ae0b63e7f708cda2bd5f44b703ac7b
4
+ data.tar.gz: 3863590d73009b330208e26393785958221e8c0bbb278fa69b5c4a98141949d1
5
+ SHA512:
6
+ metadata.gz: 9f0cf8ec4200de7b176b1fd1d94f64ecc8ef5ee013e5f1ad05d44770b41637e7ca1eb8339a05621541d2089c2fb7a1dc0e06ab327947c020c0d09f73f0828e72
7
+ data.tar.gz: b9d3550542d9854ec5ac8cbe003fb2c75c617a10152025ad1bed3c04fc8866cd3a131dd3c3b6763e7a106a3f829a77fcdbc3143d470b7ff9a38bda776dd6deda
data/bin/rumu ADDED
@@ -0,0 +1,93 @@
1
+ #!/usr/bin/env ruby
2
+ require 'open3'
3
+ require 'shellwords'
4
+ require 'io/console'
5
+ require 'pathname'
6
+
7
+ pkg='rumu'
8
+ ver='0.3'
9
+ pkgd="#{Dir.home}/.config/#{pkg}"
10
+
11
+ word=4
12
+ rate=44100
13
+ chan=2
14
+ cycle=0
15
+
16
+ ff_exe="ffmpeg -hide_banner"
17
+ ff_fmt="-ac #{chan} -ar #{rate} -f f#{word*8}le"
18
+ ff_out="-f pulse default"
19
+
20
+ list=[]
21
+ list_i=0
22
+ mode=:load
23
+ toff=''
24
+ if ARGV.length==0
25
+ if File.file?("#{pkgd}/list")
26
+ list=File.read("#{pkgd}/list").split("\n")
27
+ if File.file?("#{pkgd}/pos")
28
+ pos=File.read("#{pkgd}/pos").split("\n")
29
+ list_i=pos[0].to_i
30
+ cycle=pos[1].to_i
31
+ cycle-=3 if cycle>3
32
+ ssoff="-ss #{cycle} " if cycle>0
33
+ end
34
+ else
35
+ puts "Usage: #{pkg} files_to_play"
36
+ exit 1
37
+ end
38
+ else
39
+ list=ARGV.map{|x|Pathname(x).realpath.to_s}
40
+ end
41
+ prefix=/\A(.*).*(\n\1.*)*\Z/.match(list.join("\n"))[1]
42
+
43
+ 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}
46
+
47
+ pt=Thread.new{
48
+ until :quit == mode
49
+ if io and io.eof?
50
+ list_i+=1
51
+ mode=list_i>=list.count ? :quit : :load
52
+ end
53
+ case mode
54
+ 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}
58
+ cycle=0 unless ssoff.length > 0
59
+ puts
60
+ mode=:play
61
+ when :play
62
+ oi.write(io.read(word*chan*rate))
63
+ cycle+=1
64
+ end
65
+ end
66
+ }
67
+
68
+ 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 ''}
71
+ when 'n'
72
+ list_i+=1
73
+ mode= list_i<list.count ? :load : :quit
74
+ when 'p'
75
+ if list_i>0
76
+ list_i-=1
77
+ mode=:load
78
+ end
79
+ when 'q'
80
+ mode=:quit
81
+ else
82
+ sleep rand
83
+ end
84
+ end
85
+
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} [ "
93
+ pt.join
metadata ADDED
@@ -0,0 +1,46 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rumu
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
5
+ platform: ruby
6
+ authors:
7
+ - Benjamin Cook
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-03-27 00:00:00.000000000 Z
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.
16
+ email: root@baryon.it
17
+ executables:
18
+ - rumu
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - bin/rumu
23
+ homepage: https://github.com/Canar/rumu
24
+ licenses: []
25
+ metadata: {}
26
+ post_install_message:
27
+ rdoc_options: []
28
+ require_paths:
29
+ - lib
30
+ required_ruby_version: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '2.7'
35
+ required_rubygems_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ requirements:
41
+ - ffmpeg
42
+ rubygems_version: 3.2.13
43
+ signing_key:
44
+ specification_version: 4
45
+ summary: "(ru)by (mu)usic - a minimal ffmpeg-based gapless audio playlist player"
46
+ test_files: []