gtk2mp3 3.0.210920 → 3.2.230112

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 180114c8a9dc0eb5d6338b18adcf5285f3e689ad2e4c07f20f808bd87bc90c1c
4
- data.tar.gz: 1bccb9897a607bdcf6220c6430c602a42b5670cc97d66cc2852ef8073e50f389
3
+ metadata.gz: a7f31d4ae2d5af872d9c75141828b23b3636cf10ca4c6902fc77d37f41d00246
4
+ data.tar.gz: 217cf9c6ddcd6c07c920b6c2f5e33d1d22fd1f4072715183a359bcc21226d2e6
5
5
  SHA512:
6
- metadata.gz: 64fe65004af2cbc43a1267c9ec0058a00affcba1bf8c4d47a3cfb64987463dc4d5809e54022194db41742bda3f410ab021e5ff256dbd2253e0b8ad91674818e8
7
- data.tar.gz: 8ad3748d951f1153ba05c4eab525da74cd59357eb69bb1c8f62d32aa2d1cabd8a1437c63909789550cd836bbc91e3b6109a91a8f03cd4f63b5af2f12359631fa
6
+ metadata.gz: '079e757062dd079e5d8ce944c9f0762001e70a2b9d5214598bcd1627963473484453f67288a958b837f19d0ffd3e94b821b269ac783b7ed5a2cbe1bbe9d33e39'
7
+ data.tar.gz: cb8d058b4717cd924137bc0e3e938f29edf22e3ba20dd9c79e8c2c9f54a4270af2bc76bc3437ad7537b86ffec87bb92f6f668b21d72cf79c91d21e4182d7f456
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Gtk2Mp3
2
2
 
3
- * [VERSION 3.0.210920](https://github.com/carlosjhr64/gtk2mp3/releases)
3
+ * [VERSION 3.2.230112](https://github.com/carlosjhr64/gtk2mp3/releases)
4
4
  * [github](https://www.github.com/carlosjhr64/gtk2mp3)
5
5
  * [rubygems](https://rubygems.org/gems/gtk2mp3)
6
6
 
@@ -16,6 +16,10 @@ $ gtk2mp3
16
16
  ```console
17
17
  $ gem install gtk2mp3
18
18
  ```
19
+ ## SCREENSHOT
20
+
21
+ ![Screenshot](img/screenshot.png)
22
+
19
23
  ## HELP
20
24
  ```console
21
25
  $ gtk2mp3 --help
@@ -32,11 +36,19 @@ Options:
32
36
  # Requires MPD/MPC.
33
37
  # See https://www.musicpd.org/clients/mpc/.
34
38
  ```
39
+ ## MORE:
40
+
41
+ You can add your own custom buttons.
42
+ See:
43
+
44
+ * [Picard](lib/gtk2mp3/picard_button.rb) button hook.
45
+ * [Trash](lib/gtk2mp3/trash_button.rb) button hook.
46
+
35
47
  ## LICENSE:
36
48
 
37
49
  (The MIT License)
38
50
 
39
- Copyright (c) 2021 CarlosJHR64
51
+ Copyright (c) 2023 CarlosJHR64
40
52
 
41
53
  Permission is hereby granted, free of charge, to any person obtaining
42
54
  a copy of this software and associated documentation files (the
@@ -3,9 +3,8 @@ class Gtk2Mp3
3
3
  extend Rafini::Empty # for s0,a0,h0
4
4
 
5
5
  CONFIG = {
6
- TOOLBOX: [:horizontal],
7
- toolbox: h0,
8
- toolbox!: [:TOOLBOX,:toolbox],
6
+ MonkeyPatch: s0,
7
+ BUTTONS: [:next_button!, :stop_button!],
9
8
 
10
9
  NEXT_BUTTON: [label: 'Next!'],
11
10
  next_button: h0,
@@ -19,12 +18,16 @@ class Gtk2Mp3
19
18
  id_label: {set_selectable: true},
20
19
  id_label!: [:ID_LABEL, :id_label],
21
20
 
21
+ TOOLBOX: [:horizontal],
22
+ toolbox: h0,
23
+ toolbox!: [:TOOLBOX,:toolbox],
24
+
22
25
  HelpFile: 'https://github.com/carlosjhr64/gtk2mp3',
23
26
  Logo: "#{UserSpace::XDG['data']}/gtk3app/gtk2mp3/logo.png",
24
27
  about_dialog: {
25
28
  set_program_name: 'Gtk2Mp3',
26
29
  set_version: VERSION.semantic(0..1),
27
- set_copyright: '(c) 2021 CarlosJHR64',
30
+ set_copyright: '(c) 2023 CarlosJHR64',
28
31
  set_comments: 'A MPD/MPC "Next!" Button',
29
32
  set_website: 'https://github.com/carlosjhr64/gtk2mp3',
30
33
  set_website_label: 'See it at GitHub!',
data/lib/gtk2mp3/gui.rb CHANGED
@@ -3,10 +3,12 @@ class Gtk2Mp3
3
3
  @label.text = text
4
4
  end
5
5
 
6
+ # gui = Gtk2Mp3.new(stage, toolbar, options){Gtk2Mp3.mpc_command _1}
6
7
  def initialize(stage, toolbar, options, &block)
7
8
  @toolbox = Such::Box.new toolbar, :toolbox!
8
- Such::Button.new(@toolbox, :next_button!){block.call :next}
9
- Such::Button.new(@toolbox, :stop_button!){block.call :stop}
9
+ CONFIG[:BUTTONS].each do |button|
10
+ Such::Button.new(@toolbox, button){block.call button}
11
+ end
10
12
  @label = Such::Label.new(stage, :id_label!)
11
13
  build_logo_menu(block)
12
14
  end
@@ -15,9 +17,9 @@ class Gtk2Mp3
15
17
  Gtk3App.logo_press_event do |button|
16
18
  case button
17
19
  when 1
18
- block.call :next
20
+ block.call :next_button!
19
21
  when 2
20
- block.call :stop
22
+ block.call :stop_button!
21
23
  when 3
22
24
  # Gtk3App's main menu
23
25
  end
data/lib/gtk2mp3/mpd.rb CHANGED
@@ -25,23 +25,27 @@ class Gtk2Mp3
25
25
 
26
26
  def Gtk2Mp3.mpc_command(command)
27
27
  case command
28
- when :next
29
- current = `mpc current`.strip
30
- if current.empty?
31
- system 'mpc play'
32
- else
33
- # On my system, if I don't pause first, the sound fails.
34
- system 'mpc pause'
28
+ when :next_button!
29
+ if system 'mpc pause-if-playing'
30
+ sleep 0.25
35
31
  system 'mpc next'
32
+ else
33
+ system 'mpc play'
36
34
  end
37
- when :stop
35
+ when :stop_button!
38
36
  system 'mpc stop'
37
+ else
38
+ Gtk2Mp3.hook(command)
39
39
  end
40
40
  end
41
41
 
42
+ def Gtk2Mp3.hook(command)
43
+ # You can monkey-patch this function
44
+ end
45
+
42
46
  def Gtk2Mp3.mpc_idleloop(gui)
43
47
  Thread.new do
44
- IO.popen('mpc idleloop', 'r') do |pipe|
48
+ IO.popen('mpc idleloop player', 'r') do |pipe|
45
49
  while line = pipe.gets
46
50
  gui.set_label File.basename(`mpc current`.strip, '.*')
47
51
  end
@@ -0,0 +1,25 @@
1
+ # [Picard](https://musicbrainz.org/doc/Picard_Linux_Install)
2
+ # To activate this hook, edit your current configuration file:
3
+ # ~/.config/gtk3app/gtk2mp3/config-?.?.rbon
4
+ # Set:
5
+ # MonkeyPatch: "gtk2mp3/picard_button",
6
+ class Gtk2Mp3
7
+ extend Rafini::Empty
8
+
9
+ CONFIG[:BUTTONS].push :picard_button!
10
+ CONFIG[:PICARD_BUTTON] = [label: 'Picard']
11
+ CONFIG[:picard_button] = h0,
12
+ CONFIG[:picard_button!] = [:PICARD_BUTTON,:picard_button,'clicked']
13
+ # If your music is not in ~/Music, edit your config file:
14
+ CONFIG[:Music] ||= File.expand_path '~/Music'
15
+
16
+ def Gtk2Mp3.hook(command)
17
+ case command
18
+ when :picard_button!
19
+ if current = `mpc --format '%file%' current`.strip
20
+ file = File.join(CONFIG[:Music], current)
21
+ spawn "picard #{file}"
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,28 @@
1
+ # Trash:
2
+ # Uses `gio trash file`.
3
+ # To activate this hook, edit your current configuration file:
4
+ # ~/.config/gtk3app/gtk2mp3/config-?.?.rbon
5
+ # Set:
6
+ # MonkeyPatch: "gtk2mp3/trash_button",
7
+ class Gtk2Mp3
8
+ extend Rafini::Empty
9
+
10
+ CONFIG[:BUTTONS].push :trash_button!
11
+ CONFIG[:TRASH_BUTTON] = [label: 'Trash!']
12
+ CONFIG[:trash_button] = h0,
13
+ CONFIG[:trash_button!] = [:TRASH_BUTTON,:trash_button,'clicked']
14
+ # If your music is not in ~/Music, edit your config file:
15
+ CONFIG[:Music] ||= File.expand_path '~/Music'
16
+
17
+ def Gtk2Mp3.hook(command)
18
+ case command
19
+ when :trash_button!
20
+ if position_file = `mpc --format '%position% %file%' current`.strip
21
+ position,file = position_file.split(' ',2)
22
+ if system('mpc','del',position)
23
+ system('gio','trash',File.join(CONFIG[:Music],file))
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
data/lib/gtk2mp3.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  class Gtk2Mp3
2
- VERSION = '3.0.210920'
2
+ VERSION = '3.2.230112'
3
3
  HELP = <<~HELP
4
4
  Usage:
5
5
  gtk2mp3 [:options+]
@@ -28,6 +28,7 @@ class Gtk2Mp3
28
28
  require_relative 'gtk2mp3/config'
29
29
  require_relative 'gtk2mp3/gui'
30
30
  Gtk3App.run(klass:Gtk2Mp3) do |stage, toolbar, options|
31
+ require CONFIG[:MonkeyPatch] unless CONFIG[:MonkeyPatch].empty?
31
32
  gui = Gtk2Mp3.new(stage, toolbar, options){Gtk2Mp3.mpc_command _1}
32
33
  Gtk2Mp3.mpc_idleloop(gui)
33
34
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gtk2mp3
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.210920
4
+ version: 3.2.230112
5
5
  platform: ruby
6
6
  authors:
7
7
  - CarlosJHR64
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-20 00:00:00.000000000 Z
11
+ date: 2023-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gtk3app
@@ -16,20 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '5.3'
19
+ version: '5.4'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 5.3.210919
22
+ version: 5.4.230109
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: '5.3'
29
+ version: '5.4'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 5.3.210919
32
+ version: 5.4.230109
33
33
  description: 'A "Next!" button gui for [MPD/MPC](https://www.musicpd.org/).
34
34
 
35
35
  '
@@ -39,7 +39,6 @@ executables:
39
39
  extensions: []
40
40
  extra_rdoc_files: []
41
41
  files:
42
- - LICENSE
43
42
  - README.md
44
43
  - bin/gtk2mp3
45
44
  - data/logo.png
@@ -47,11 +46,13 @@ files:
47
46
  - lib/gtk2mp3/config.rb
48
47
  - lib/gtk2mp3/gui.rb
49
48
  - lib/gtk2mp3/mpd.rb
49
+ - lib/gtk2mp3/picard_button.rb
50
+ - lib/gtk2mp3/trash_button.rb
50
51
  homepage: https://github.com/carlosjhr64/gtk2mp3
51
52
  licenses:
52
53
  - MIT
53
54
  metadata: {}
54
- post_install_message:
55
+ post_install_message:
55
56
  rdoc_options: []
56
57
  require_paths:
57
58
  - lib
@@ -66,10 +67,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
66
67
  - !ruby/object:Gem::Version
67
68
  version: '0'
68
69
  requirements:
69
- - 'ruby: ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux]'
70
- - 'mpd: Music Player Daemon 0.22.11 (0.22.11)'
71
- rubygems_version: 3.2.22
72
- signing_key:
70
+ - 'ruby: ruby 3.2.0 (2022-12-25 revision a528908271) [aarch64-linux]'
71
+ - 'mpd: Music Player Daemon 0.22.6 (0.22.6)'
72
+ rubygems_version: 3.4.3
73
+ signing_key:
73
74
  specification_version: 4
74
75
  summary: A "Next!" button gui for [MPD/MPC](https://www.musicpd.org/).
75
76
  test_files: []
data/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2018 carlosjhr64
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.