mpg123_remote 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +23 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +40 -0
- data/Rakefile +2 -0
- data/bin/mpg123_parse +36 -0
- data/bin/mpg123_play +7 -0
- data/bin/mpg123_remote +7 -0
- data/bin/mpg123_somafm +7 -0
- data/bin/mpg123_state +10 -0
- data/lib/mpg123_remote.rb +22 -0
- data/lib/mpg123_remote/version.rb +3 -0
- data/mpg123_remote.gemspec +22 -0
- metadata +90 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1ac8d65c125a821353d18888b4269632427ef5e8
|
4
|
+
data.tar.gz: 7ce942c101935134b0635b2cfaf9dfdfd074a010
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2b1489c5301550a926d429bd24e139327569f91cedcbed89cdf7323aef12176ab8efe5b4e31a5daa2938946c2c32a7bebb9388847fcd89a934af4c6ce0f7d542
|
7
|
+
data.tar.gz: 8d95b77641acd59e177116bda981a2e49380b96df099a0b9800d10ad2a8ad8921ac7f92efeb3bd53f0844a9de3cdb1b6730f25aa9bd6c1a08829b5a142bc2626
|
data/.gitignore
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
debug.log
|
2
|
+
*.gem
|
3
|
+
*.rbc
|
4
|
+
.bundle
|
5
|
+
.config
|
6
|
+
.yardoc
|
7
|
+
Gemfile.lock
|
8
|
+
InstalledFiles
|
9
|
+
_yardoc
|
10
|
+
coverage
|
11
|
+
doc/
|
12
|
+
lib/bundler/man
|
13
|
+
pkg
|
14
|
+
rdoc
|
15
|
+
spec/reports
|
16
|
+
test/tmp
|
17
|
+
test/version_tmp
|
18
|
+
tmp
|
19
|
+
*.bundle
|
20
|
+
*.so
|
21
|
+
*.o
|
22
|
+
*.a
|
23
|
+
mkmf.log
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Mark Ryall
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# Mpg123Remote
|
2
|
+
|
3
|
+
This is a set of console commands to simplify remote interaction with mpg123.
|
4
|
+
|
5
|
+
## Preparation
|
6
|
+
|
7
|
+
This requires that mpg123 is installed and some fifo pipes have been created.
|
8
|
+
|
9
|
+
On mac os x using homebrew, run:
|
10
|
+
|
11
|
+
brew install mpg123
|
12
|
+
mkfifo /tmp/mpg123in
|
13
|
+
mkfifo /tmp/mpg123out
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
In one console:
|
18
|
+
|
19
|
+
(mpg123 --remote --fifo /tmp/mpg123in 2> /dev/null > /tmp/mpg123out &) && bin/mpg123_parse
|
20
|
+
|
21
|
+
This console will now show the current player status, current track, seconds remaining, etc.
|
22
|
+
|
23
|
+
The player can now be controller from any other console with the following commands:
|
24
|
+
|
25
|
+
mpg123_remote load track01.mp3
|
26
|
+
mpg123_remote pause
|
27
|
+
mpg123_remote stop
|
28
|
+
mpg123_remote pitch +0.20
|
29
|
+
mpg123_remote pitch -0.20
|
30
|
+
mpg123_remote volume 20
|
31
|
+
mpg123_remote volume 80
|
32
|
+
mpg123_somafm secretagent
|
33
|
+
|
34
|
+
## Contributing
|
35
|
+
|
36
|
+
1. Fork it ( https://github.com/[my-github-username]/mpg123_remote/fork )
|
37
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
38
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
39
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
40
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/mpg123_parse
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
class Console
|
4
|
+
LENGTH=50
|
5
|
+
|
6
|
+
def change s
|
7
|
+
print "\b" * LENGTH unless @first
|
8
|
+
@first = false
|
9
|
+
print s.rjust LENGTH
|
10
|
+
end
|
11
|
+
|
12
|
+
def write s
|
13
|
+
puts unless @first
|
14
|
+
@first = true
|
15
|
+
puts s
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
console = Console.new
|
20
|
+
|
21
|
+
File.open('/tmp/mpg123out') do |f|
|
22
|
+
while line=f.gets
|
23
|
+
case line
|
24
|
+
when /^@F (\d+) (\d+) ([\d\.]+) ([\d\.]+)$/
|
25
|
+
frames, frames_left, seconds, seconds_left = $1, $2, $3, $4
|
26
|
+
console.change "#{seconds} seconds (#{seconds_left} remaining)"
|
27
|
+
when /@I ICY-META: StreamTitle='(.*) - (.*)';StreamUrl='http:\/\/SomaFM.com\/(.*)\/';/
|
28
|
+
artist, track, station = $1, $2, $3
|
29
|
+
console.write "#{track} by #{artist} (#{station} on somafm)"
|
30
|
+
when /@P (\d)/
|
31
|
+
File.open('/tmp/mpg123state', 'w') {|s| s.puts $1 }
|
32
|
+
else
|
33
|
+
File.open('debug.log', 'w+') {|d| d.puts line } if ENV['DEBUG']
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/bin/mpg123_play
ADDED
data/bin/mpg123_remote
ADDED
data/bin/mpg123_somafm
ADDED
data/bin/mpg123_state
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'mpg123_remote/version'
|
2
|
+
|
3
|
+
class Mpg123Remote::Player
|
4
|
+
def initialize path='/tmp/mpg123in'
|
5
|
+
@path = path
|
6
|
+
end
|
7
|
+
|
8
|
+
def somafm station
|
9
|
+
station ||= 'secretagent'
|
10
|
+
execute 'loadlist', 0, "http://somafm.com/startstream=#{station}.pls"
|
11
|
+
end
|
12
|
+
|
13
|
+
def play path
|
14
|
+
execute "LOAD #{Dir.pwd}/#{path}"
|
15
|
+
end
|
16
|
+
|
17
|
+
def execute *args
|
18
|
+
File.open(@path, 'w') do |f|
|
19
|
+
f.puts args.join ' '
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'mpg123_remote/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "mpg123_remote"
|
8
|
+
spec.version = Mpg123Remote::VERSION
|
9
|
+
spec.authors = ["Mark Ryall"]
|
10
|
+
spec.email = ["mark@ryall.name"]
|
11
|
+
spec.summary = %q{simple remote control for mpg123}
|
12
|
+
spec.homepage = "http://github.com/markryall/mpg123_remote"
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0")
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
21
|
+
spec.add_development_dependency "rake"
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mpg123_remote
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mark Ryall
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-06-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description:
|
42
|
+
email:
|
43
|
+
- mark@ryall.name
|
44
|
+
executables:
|
45
|
+
- mpg123_parse
|
46
|
+
- mpg123_play
|
47
|
+
- mpg123_remote
|
48
|
+
- mpg123_somafm
|
49
|
+
- mpg123_state
|
50
|
+
extensions: []
|
51
|
+
extra_rdoc_files: []
|
52
|
+
files:
|
53
|
+
- ".gitignore"
|
54
|
+
- Gemfile
|
55
|
+
- LICENSE.txt
|
56
|
+
- README.md
|
57
|
+
- Rakefile
|
58
|
+
- bin/mpg123_parse
|
59
|
+
- bin/mpg123_play
|
60
|
+
- bin/mpg123_remote
|
61
|
+
- bin/mpg123_somafm
|
62
|
+
- bin/mpg123_state
|
63
|
+
- lib/mpg123_remote.rb
|
64
|
+
- lib/mpg123_remote/version.rb
|
65
|
+
- mpg123_remote.gemspec
|
66
|
+
homepage: http://github.com/markryall/mpg123_remote
|
67
|
+
licenses:
|
68
|
+
- MIT
|
69
|
+
metadata: {}
|
70
|
+
post_install_message:
|
71
|
+
rdoc_options: []
|
72
|
+
require_paths:
|
73
|
+
- lib
|
74
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
requirements: []
|
85
|
+
rubyforge_project:
|
86
|
+
rubygems_version: 2.2.2
|
87
|
+
signing_key:
|
88
|
+
specification_version: 4
|
89
|
+
summary: simple remote control for mpg123
|
90
|
+
test_files: []
|