rubio-radio 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +27 -0
- data/LICENSE.txt +1 -1
- data/README.md +73 -2
- data/TODO.md +3 -0
- data/exe/rubio +33 -13
- data/lib/rubio/radio.rb +106 -62
- data/lib/rubio/version.rb +1 -1
- metadata +9 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfd627d6056a51e35b6ba16a55f6e87ad2e05820ffe16172862c2df5222242b7
|
4
|
+
data.tar.gz: 0bbdcb38795e7a55e00a0699bc0a30e5e2f53ed6b0a0defcaf43d81b0ea641c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d6682d2602e24709eabcf65f1110acaf04b6f543e516775f6b9b29661e1c886fbf3c3d647a7e33cba78b159a044aa42a823de0e1046b1cf37b749b778e98907
|
7
|
+
data.tar.gz: d5c4ae797ab9d3985fdeb56c135738f545226dcb0eb5ca199624a17d72a645f4ee4abfbdb0687492099edfa75137527e658d78f2df0414e737e55b5969304ea5
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
## 0.0.4
|
4
|
+
|
5
|
+
- Upgrade to glimmer-dsl-libui v0.5.18
|
6
|
+
- Replace `table` with new `refined_table` having pagination and filtering support across all columns (including language column)
|
7
|
+
- Request the top 10,000 radio stations upon starting the app
|
8
|
+
- Command option `--count` for configuring count of top radio stations (`10_000` by default)
|
9
|
+
- Command option `--per-page` for number of rows per page to display
|
10
|
+
- Command option `--page-count` for displaying page count ("of PAGE_COUNT pages")
|
11
|
+
- Command option `--width` for initial window width
|
12
|
+
- Command option `--height` for initial window height
|
13
|
+
- Command option `--no-menu` to remove the top menu bar and save screen space when not needed (on Mac it is always on because the menu bar does not take application screen space)
|
14
|
+
- Help menu About menu item to display message box with application license
|
15
|
+
- If `--per-page` is specified and `--height` is not specified, attempt to calculate intial window height for each platform automatically based on number of rows per page
|
16
|
+
|
17
|
+
## 0.0.3
|
18
|
+
|
19
|
+
- Fix bug
|
20
|
+
|
21
|
+
## 0.0.2
|
22
|
+
|
23
|
+
- Support Mac and Windows
|
24
|
+
|
25
|
+
## 0.0.1
|
26
|
+
|
27
|
+
- Initial implementation of rubio-radio
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,17 @@
|
|
1
1
|
# rubio-radio
|
2
2
|
[![Gem Version](https://badge.fury.io/rb/rubio-radio.svg)](https://badge.fury.io/rb/rubio-radio)
|
3
3
|
|
4
|
-
|
4
|
+
Linux
|
5
|
+
|
6
|
+
![linux screenshot](screenshots/rubio-radio-linux.png)
|
7
|
+
|
8
|
+
Mac
|
9
|
+
|
10
|
+
![mac screenshot](screenshots/rubio-radio-mac.png)
|
11
|
+
|
12
|
+
Windows
|
13
|
+
|
14
|
+
![windows screenshot](screenshots/rubio-radio-windows.png)
|
5
15
|
|
6
16
|
:bowtie: Alpha
|
7
17
|
|
@@ -29,21 +39,82 @@ gem install rubio-radio
|
|
29
39
|
|
30
40
|
## Usage
|
31
41
|
|
42
|
+
Run with this command:
|
43
|
+
|
32
44
|
```
|
33
45
|
rubio
|
34
46
|
```
|
35
47
|
|
48
|
+
The top 10,000 [Radio Browser](https://www.radio-browser.info/) stations are displayed by default. But, you can customize the count (note that currently, there are only about 32,000 [Radio Browser](https://www.radio-browser.info/) stations total).
|
49
|
+
|
50
|
+
```
|
51
|
+
rubio --count 20000
|
52
|
+
```
|
53
|
+
|
36
54
|
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.
|
37
55
|
|
38
56
|
```
|
39
57
|
rubio --backend mpg123
|
40
58
|
```
|
41
59
|
|
60
|
+
Learn more about `rubio` options:
|
61
|
+
|
62
|
+
```
|
63
|
+
rubio --help
|
64
|
+
```
|
65
|
+
|
66
|
+
```
|
67
|
+
Usage: rubio [options]
|
68
|
+
--vlc [STR] use VLC interface STR on the backend [dummy]
|
69
|
+
--mpg123 use mpg123 on the backend
|
70
|
+
-b, --backend STR command to use as backend player ['vlc -I dummy']
|
71
|
+
-c, --count INT number of stations to fetch from radio-browser [10000]
|
72
|
+
--per-page INT number of stations per page [20]
|
73
|
+
--[no-]page-count show/hide page count
|
74
|
+
-w, --width INT main window width
|
75
|
+
-h, --height INT main window height
|
76
|
+
--[no-]menu show/hide menu
|
77
|
+
--debug output status of monitored threads
|
78
|
+
--help show this help message
|
79
|
+
--version show the rubio version number
|
80
|
+
```
|
81
|
+
|
82
|
+
Examples:
|
83
|
+
|
42
84
|
```
|
43
85
|
rubio --vlc # `vlc -I rc` (interactive command line interface)
|
44
86
|
rubio --mpg123 # `rubio --backend mpg123`
|
87
|
+
rubio --count 1000 # Displays the top 1,000 Radio Browser stations
|
88
|
+
```
|
89
|
+
|
90
|
+
Small Screen Example:
|
91
|
+
|
92
|
+
```
|
93
|
+
rubio --per-page 6 --no-menu
|
94
|
+
```
|
95
|
+
|
96
|
+
![small screen linux screenshot](screenshots/rubio-radio-linux-example-small.png)
|
97
|
+
|
98
|
+
Page Count Example:
|
99
|
+
|
45
100
|
```
|
101
|
+
rubio --page-count
|
102
|
+
```
|
103
|
+
|
104
|
+
![page count mac screenshot](screenshots/rubio-radio-mac-example-page-count.png)
|
105
|
+
|
106
|
+
## Links
|
107
|
+
|
108
|
+
* [Ruby](https://github.com/ruby/ruby)
|
109
|
+
* spawn
|
110
|
+
* [Radio Browser](https://www.radio-browser.info/)
|
111
|
+
* [Radio Browser API](https://de1.api.radio-browser.info/)
|
112
|
+
* [Glimmer DSL for LibUI](https://github.com/AndyObtiva/glimmer-dsl-libui)
|
113
|
+
|
114
|
+
## Change Log
|
115
|
+
|
116
|
+
[CHANGELOG.md](CHANGELOG.md)
|
46
117
|
|
47
118
|
## LICENSE
|
48
119
|
|
49
|
-
MIT
|
120
|
+
[MIT](LICENSE.txt)
|
data/TODO.md
ADDED
data/exe/rubio
CHANGED
@@ -2,29 +2,49 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
require 'rubio'
|
5
|
-
|
6
5
|
require 'optparse'
|
7
|
-
|
8
|
-
|
6
|
+
|
7
|
+
options = { backend: 'vlc -I dummy' }
|
8
|
+
|
9
9
|
opt = OptionParser.new
|
10
|
-
opt.
|
11
|
-
opt.on('--
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
opt.summary_width = 23
|
11
|
+
opt.on('--vlc [STR]', 'use VLC interface STR on the backend [dummy]') do |i|
|
12
|
+
i ||= 'dummy'
|
13
|
+
options[:backend] = "vlc -I #{i}"
|
14
|
+
end
|
15
|
+
opt.on('--mpg123', 'use mpg123 on the backend') { options[:backend] = 'mpg123' }
|
16
|
+
opt.on('-b', '--backend STR', String, 'command to use as backend player [\'vlc -I dummy\']') do |b|
|
17
|
+
options[:backend] = b
|
18
|
+
end
|
19
|
+
opt.on('-c', '--count INT', Numeric, 'number of stations to fetch from radio-browser [10000]') do |c|
|
20
|
+
options[:radio_station_count] = c
|
21
|
+
end
|
22
|
+
opt.on('--per-page INT', Numeric, 'number of stations per page [20]') { |c| options[:table_per_page] = c }
|
23
|
+
opt.on('--[no-]page-count', TrueClass, 'show/hide page count') { |b| options[:show_page_count] = b }
|
24
|
+
opt.on('-w', '--width INT', Numeric, 'main window width') { |w| options[:initial_width] = w }
|
25
|
+
opt.on('-h', '--height INT', Numeric, 'main window height') { |h| options[:initial_height] = h }
|
26
|
+
opt.on('--[no-]menu', TrueClass, 'show/hide menu') { |b| options[:visible_menu] = b }
|
27
|
+
opt.on('--debug', 'output status of monitored threads') { options[:debug] = true }
|
28
|
+
opt.on('--help', 'show this help message') do
|
15
29
|
puts opt
|
16
30
|
exit
|
17
31
|
end
|
18
|
-
opt.on('--version') do
|
32
|
+
opt.on('--version', 'show the rubio version number') do
|
19
33
|
puts Rubio::VERSION
|
20
34
|
exit
|
21
35
|
end
|
22
|
-
opt.parse!(ARGV)
|
23
36
|
|
24
|
-
radio = Rubio::Radio.new(backend, debug: debug)
|
25
37
|
begin
|
26
|
-
|
38
|
+
opt.parse!(ARGV)
|
39
|
+
rescue OptionParser::InvalidOption, OptionParser::AmbiguousOption => e
|
40
|
+
puts e.message
|
41
|
+
puts opt
|
42
|
+
exit
|
43
|
+
end
|
44
|
+
|
45
|
+
begin
|
46
|
+
Rubio::Radio.launch(**options)
|
27
47
|
rescue StandardError => e
|
28
|
-
|
48
|
+
Rubio::Radio.launched_application&.player&.stop_all
|
29
49
|
raise e
|
30
50
|
end
|
data/lib/rubio/radio.rb
CHANGED
@@ -4,35 +4,105 @@ require 'glimmer-dsl-libui'
|
|
4
4
|
|
5
5
|
module Rubio
|
6
6
|
class Radio
|
7
|
-
include Glimmer
|
7
|
+
include Glimmer::LibUI::Application
|
8
|
+
|
9
|
+
options :backend, :initial_width, :initial_height
|
10
|
+
option :radio_station_count, default: 10_000
|
11
|
+
option :debug, default: false
|
12
|
+
option :visible_menu, default: true
|
13
|
+
option :show_page_count, default: false
|
14
|
+
option :table_per_page, default: 20
|
8
15
|
|
9
16
|
attr_reader :stations, :player
|
10
17
|
|
11
|
-
|
12
|
-
@stations_all, @table = RadioBrowser.topvote(
|
18
|
+
before_body do
|
19
|
+
@stations_all, @table = RadioBrowser.topvote(radio_station_count)
|
13
20
|
@stations = @stations_all.dup
|
14
21
|
@station_uuid = nil
|
15
22
|
@player = Player.new(backend)
|
23
|
+
@initial_width = (initial_width || 400).to_i
|
24
|
+
@initial_height = (initial_height || calculate_initial_height).to_i
|
16
25
|
|
17
26
|
monitor_thread(debug)
|
18
27
|
end
|
19
28
|
|
20
|
-
|
21
|
-
|
22
|
-
p @player.history if debug
|
23
|
-
next if @station_uuid.nil? || @player.alive?
|
29
|
+
body do
|
30
|
+
radio_menu_bar
|
24
31
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
32
|
+
window('Rubio', @initial_width, @initial_height) do
|
33
|
+
vertical_box do
|
34
|
+
horizontal_box do
|
35
|
+
@station_table = refined_table(
|
36
|
+
table_columns: {
|
37
|
+
'Play' => { button: {
|
38
|
+
on_clicked: lambda { |row|
|
39
|
+
station = @station_table.paginated_model_array[row]
|
40
|
+
select_station(station)
|
41
|
+
}
|
42
|
+
} },
|
43
|
+
'name' => :text,
|
44
|
+
'language' => :text
|
45
|
+
},
|
46
|
+
model_array: stations,
|
47
|
+
per_page: table_per_page.to_i,
|
48
|
+
visible_page_count: show_page_count
|
49
|
+
)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
on_closing do
|
54
|
+
@player.stop_all
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def radio_menu_bar
|
60
|
+
return unless OS.mac? || visible_menu
|
61
|
+
|
62
|
+
menu('Radio') do
|
63
|
+
menu_item('Stop') do
|
64
|
+
on_clicked do
|
65
|
+
stop_uuid(@station_uuid)
|
66
|
+
@station_uuid = nil
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
if OS.mac?
|
71
|
+
about_menu_item do
|
72
|
+
on_clicked do
|
73
|
+
about_message_box
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
quit_menu_item do
|
79
|
+
on_clicked do
|
80
|
+
@player.stop_all
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
menu('Help') do
|
86
|
+
menu_item('About') do
|
87
|
+
on_clicked do
|
88
|
+
about_message_box
|
89
|
+
end
|
90
|
+
end
|
29
91
|
end
|
30
92
|
end
|
31
93
|
|
32
|
-
def
|
33
|
-
|
94
|
+
def about_message_box
|
95
|
+
license = begin
|
96
|
+
File.read(File.expand_path('../../LICENSE.txt', __dir__))
|
97
|
+
rescue StandardError
|
98
|
+
''
|
99
|
+
end
|
100
|
+
product = "rubio-radio #{Rubio::VERSION}"
|
101
|
+
message_box(product, "#{product}\n\n#{license}")
|
102
|
+
end
|
34
103
|
|
35
|
-
|
104
|
+
def select_station(station)
|
105
|
+
station_uuid = station.stationuuid
|
36
106
|
stop_uuid(@station_uuid)
|
37
107
|
if @station_uuid == station_uuid
|
38
108
|
@station_uuid = nil
|
@@ -60,57 +130,31 @@ module Rubio
|
|
60
130
|
station.playing = false
|
61
131
|
end
|
62
132
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
end
|
75
|
-
end
|
133
|
+
private
|
134
|
+
|
135
|
+
def calculate_initial_height
|
136
|
+
if OS.linux?
|
137
|
+
107 + (visible_menu ? 26 : 0) + 24 * table_per_page.to_i
|
138
|
+
elsif OS.mac? && OS.host_cpu == 'arm64'
|
139
|
+
90 + 24 * table_per_page.to_i
|
140
|
+
elsif OS.mac?
|
141
|
+
85 + 19 * table_per_page.to_i
|
142
|
+
else # Windows
|
143
|
+
95 + 19 * table_per_page.to_i
|
76
144
|
end
|
77
|
-
window('Rubio', 400, 200) do
|
78
|
-
vertical_box do
|
79
|
-
horizontal_box do
|
80
|
-
stretchy false
|
81
|
-
search_entry do |se|
|
82
|
-
on_changed do
|
83
|
-
filter_value = se.text
|
84
|
-
if filter_value.empty?
|
85
|
-
@stations.replace @stations_all.dup
|
86
|
-
else
|
87
|
-
@stations.replace(@stations_all.filter do |row_data|
|
88
|
-
row_data.name.downcase.include?(filter_value.downcase)
|
89
|
-
end)
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
94
|
-
horizontal_box do
|
95
|
-
table do
|
96
|
-
button_column('Play') do
|
97
|
-
on_clicked do |row|
|
98
|
-
selected_station_at(row)
|
99
|
-
end
|
100
|
-
end
|
101
|
-
text_column('name')
|
102
|
-
text_column('language')
|
103
|
-
cell_rows <= [self, :stations]
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
on_closing do
|
108
|
-
@player.stop_all
|
109
|
-
end
|
110
|
-
end.show
|
111
145
|
end
|
112
146
|
|
113
|
-
|
147
|
+
def monitor_thread(debug)
|
148
|
+
Glimmer::LibUI.timer(1) do
|
149
|
+
p @player.history if debug
|
150
|
+
next if @station_uuid.nil? || @player.alive?
|
151
|
+
|
152
|
+
message_box("player '#{@player.backend}' stopped!", @player.thr.to_s)
|
153
|
+
stop_uuid(@station_uuid)
|
154
|
+
@station_uuid = nil
|
155
|
+
true
|
156
|
+
end
|
157
|
+
end
|
114
158
|
|
115
159
|
def uuid_to_station(uuid)
|
116
160
|
idx = @table[uuid]
|
data/lib/rubio/version.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,30 @@
|
|
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.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kojix2
|
8
|
+
- Andy Maleh
|
8
9
|
autorequire:
|
9
10
|
bindir: exe
|
10
11
|
cert_chain: []
|
11
|
-
date: 2022-
|
12
|
+
date: 2022-08-05 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: glimmer-dsl-libui
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
16
17
|
requirements:
|
17
|
-
- -
|
18
|
+
- - '='
|
18
19
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
20
|
+
version: 0.5.18
|
20
21
|
type: :runtime
|
21
22
|
prerelease: false
|
22
23
|
version_requirements: !ruby/object:Gem::Requirement
|
23
24
|
requirements:
|
24
|
-
- -
|
25
|
+
- - '='
|
25
26
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
27
|
+
version: 0.5.18
|
27
28
|
description: Rubio is a simple radio player written in Ruby.
|
28
29
|
email:
|
29
30
|
- 2xijok@gmail.com
|
@@ -32,8 +33,10 @@ executables:
|
|
32
33
|
extensions: []
|
33
34
|
extra_rdoc_files: []
|
34
35
|
files:
|
36
|
+
- CHANGELOG.md
|
35
37
|
- LICENSE.txt
|
36
38
|
- README.md
|
39
|
+
- TODO.md
|
37
40
|
- exe/rubio
|
38
41
|
- lib/rubio.rb
|
39
42
|
- lib/rubio/player.rb
|