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.
- checksums.yaml +4 -4
 - data/bin/rumu +24 -19
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: b10238932023ff15c41d24d35b464e641ab0296e3585b7b0810dfa2236af0667
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 4ca176a03fff38fb7ba458451cf55501dc54815521091678886faab1c853ebfc
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 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. 
     | 
| 
      
 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 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
            mode 
     | 
| 
       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 -  
     | 
| 
      
 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} <  
     | 
| 
      
 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 
     | 
    
         
            -
             
     | 
| 
       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
         
     |