rubio-radio 0.0.1 → 0.0.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/README.md +27 -5
- data/exe/rubio +2 -2
- data/lib/rubio/player.rb +5 -5
- data/lib/rubio/radio.rb +17 -5
- data/lib/rubio/station.rb +6 -7
- data/lib/rubio/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c84b293c3df7c60cb6c872ae7937795231e2342fce23e820e48d8fa5d735d64b
|
4
|
+
data.tar.gz: 3edbde25ee11784f71f798369458c71bd100c89cdb67120219507f127d95e968
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71c135dd2408f0ae936053509f9c23891aaaa3501599fb94bedcd167a1b3ca5a839db0f5e00b8a6a090ada073cae63e1487ef8ea909a4eaad70a88e3e0378e33
|
7
|
+
data.tar.gz: 399b6dd00ddfca35a3533384c43dce3a862d274c94c36228b4bf8e29f1624976b75d5dd73054ca63438f6119a33abf2a197f70819c79f95826acb882e4e49f73
|
data/README.md
CHANGED
@@ -1,27 +1,49 @@
|
|
1
|
-
#
|
1
|
+
# rubio-radio
|
2
|
+
[](https://badge.fury.io/rb/rubio-radio)
|
2
3
|
|
3
4
|

|
4
5
|
|
5
6
|
:bowtie: Alpha
|
6
|
-
## installation
|
7
7
|
|
8
|
-
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
### Requirements:
|
11
|
+
|
12
|
+
**[VLC](https://github.com/videolan/vlc)**
|
13
|
+
|
14
|
+
`rubio` uses the `vlc -I dummy` as the audio playback backend.
|
15
|
+
|
16
|
+
On Mac, it is recommended that you install VLC via [Homebrew](https://brew.sh/) to ensure the `vlc` command is added to the PATH environment variable automatically:
|
17
|
+
|
18
|
+
```
|
19
|
+
brew install vlc
|
20
|
+
```
|
21
|
+
|
22
|
+
On Windows, install VLC using the [Windows installer](https://www.videolan.org/vlc/download-windows.html), and then add the installed VLC app directory to the PATH environment variable (e.g. `C:\Program Files (x86)\VideoLAN\VLC`) to make the `vlc` command available.
|
23
|
+
|
24
|
+
### Ruby Gem:
|
9
25
|
|
10
26
|
```
|
11
27
|
gem install rubio-radio
|
12
28
|
```
|
29
|
+
|
13
30
|
## Usage
|
14
31
|
|
15
32
|
```
|
16
33
|
rubio
|
17
34
|
```
|
18
35
|
|
19
|
-
Default player is `
|
36
|
+
Default player is `vlc -I dummy`. But, you can use any command line player that can take URL of radio station as its first argument.
|
20
37
|
|
21
38
|
```
|
22
39
|
rubio --backend mpg123
|
23
40
|
```
|
24
41
|
|
42
|
+
```
|
43
|
+
rubio --vlc # `vlc -I rc` (interactive command line interface)
|
44
|
+
rubio --mpg123 # `rubio --backend mpg123`
|
45
|
+
```
|
46
|
+
|
25
47
|
## LICENSE
|
26
48
|
|
27
|
-
MIT
|
49
|
+
MIT
|
data/exe/rubio
CHANGED
@@ -4,10 +4,10 @@
|
|
4
4
|
require 'rubio'
|
5
5
|
|
6
6
|
require 'optparse'
|
7
|
-
backend = '
|
7
|
+
backend = 'vlc -I dummy'
|
8
8
|
debug = false
|
9
9
|
opt = OptionParser.new
|
10
|
-
opt.on('--vlc') { backend = '
|
10
|
+
opt.on('--vlc') { backend = 'vlc -I rc' }
|
11
11
|
opt.on('--mpg123') { backend = 'mpg123' }
|
12
12
|
opt.on('--backend CMD') { |b| backend = b }
|
13
13
|
opt.on('--debug') { debug = true }
|
data/lib/rubio/player.rb
CHANGED
@@ -4,7 +4,7 @@ module Rubio
|
|
4
4
|
class Player
|
5
5
|
attr_accessor :backend, :pid, :thr, :status, :history
|
6
6
|
|
7
|
-
def initialize(backend = 'cvlc')
|
7
|
+
def initialize(backend = OS.linux? ? 'cvlc' : 'vlc -I rc')
|
8
8
|
raise unless backend.is_a?(String)
|
9
9
|
|
10
10
|
@backend = backend
|
@@ -25,11 +25,11 @@ module Rubio
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def play(url)
|
28
|
-
#
|
28
|
+
# Do not include spaces in the command line
|
29
29
|
# if a space exist :
|
30
30
|
# * sh -c command url # this process with @pid will be killed
|
31
31
|
# * cmmand url # will not be killd because pid is differennt
|
32
|
-
# if no space :
|
32
|
+
# if no space :
|
33
33
|
# * cmmand url # will be killed by @pid
|
34
34
|
raise if url.match(/\s/)
|
35
35
|
|
@@ -42,7 +42,7 @@ module Rubio
|
|
42
42
|
def stop
|
43
43
|
return unless alive?
|
44
44
|
|
45
|
-
r = Process.kill(:TERM, pid)
|
45
|
+
r = Process.kill(OS.windows? ? :KILL : :TERM, pid)
|
46
46
|
@thr = nil
|
47
47
|
@pid = nil
|
48
48
|
r
|
@@ -50,7 +50,7 @@ module Rubio
|
|
50
50
|
|
51
51
|
def stop_all
|
52
52
|
@history.each do |pid, thr|
|
53
|
-
Process.kill(:TERM, pid) if thr.alive?
|
53
|
+
Process.kill(OS.windows? ? :KILL : :TERM, pid) if thr.alive?
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
data/lib/rubio/radio.rb
CHANGED
@@ -9,7 +9,7 @@ module Rubio
|
|
9
9
|
attr_reader :stations, :player
|
10
10
|
|
11
11
|
def initialize(backend, debug: false)
|
12
|
-
@stations_all, @table = RadioBrowser.topvote(
|
12
|
+
@stations_all, @table = RadioBrowser.topvote(500)
|
13
13
|
@stations = @stations_all.dup
|
14
14
|
@station_uuid = nil
|
15
15
|
@player = Player.new(backend)
|
@@ -36,19 +36,18 @@ module Rubio
|
|
36
36
|
stop_uuid(@station_uuid)
|
37
37
|
if @station_uuid == station_uuid
|
38
38
|
@station_uuid = nil
|
39
|
-
|
40
|
-
play_uuid(station_uuid)
|
39
|
+
elsif (station_uuid)
|
41
40
|
@station_uuid = station_uuid
|
42
41
|
end
|
43
42
|
end
|
44
43
|
|
45
|
-
def
|
44
|
+
def (station_uuid)
|
46
45
|
station = uuid_to_station(station_uuid)
|
47
46
|
begin
|
48
47
|
@player.play(station.url)
|
49
48
|
rescue StandardError => e
|
50
49
|
message_box(e.message)
|
51
|
-
|
50
|
+
return false
|
52
51
|
end
|
53
52
|
station.playing = true
|
54
53
|
end
|
@@ -62,6 +61,19 @@ module Rubio
|
|
62
61
|
end
|
63
62
|
|
64
63
|
def launch
|
64
|
+
menu('Radio') do
|
65
|
+
menu_item('Stop') do
|
66
|
+
on_clicked do
|
67
|
+
stop_uuid(@station_uuid)
|
68
|
+
@station_uuid = nil
|
69
|
+
end
|
70
|
+
end
|
71
|
+
quit_menu_item do
|
72
|
+
on_clicked do
|
73
|
+
@player.stop_all
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
65
77
|
window('Rubio', 400, 200) do
|
66
78
|
vertical_box do
|
67
79
|
horizontal_box do
|
data/lib/rubio/station.rb
CHANGED
@@ -1,18 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Rubio
|
4
|
-
|
5
|
-
|
6
|
-
class Station < BaseStation
|
7
|
-
attr_accessor :playing
|
4
|
+
Station = Struct.new(:stationuuid, :name, :language, :url, :play) do
|
5
|
+
attr_reader :playing
|
8
6
|
|
9
7
|
def initialize(*args, **kwargs)
|
10
8
|
super(*args, **kwargs)
|
11
|
-
|
9
|
+
self.playing = false
|
12
10
|
end
|
13
11
|
|
14
|
-
def
|
15
|
-
|
12
|
+
def playing=(value)
|
13
|
+
self.play = value ? '■' : '▶'
|
14
|
+
@playing = value
|
16
15
|
end
|
17
16
|
end
|
18
17
|
end
|
data/lib/rubio/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubio-radio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kojix2
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-06-
|
11
|
+
date: 2022-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: glimmer-dsl-libui
|