vlcraptor 0.4.0 → 0.5.0
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/Gemfile.lock +1 -1
- data/lib/vlcraptor/player_controller.rb +25 -24
- data/lib/vlcraptor/queue.rb +9 -4
- data/lib/vlcraptor/version.rb +1 -1
- data/lib/vlcraptor.rb +4 -3
- 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: e68bc937ca2016f17771ea0b7db19729f0b91eb3a7cd94e8dae305e5d5feff9b
|
4
|
+
data.tar.gz: 3197d9195b81187bf3109e99440c61c906e5007095da0466098a15ad8d3b5fed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b64e6b465e12a323b47ef33cbc3132f0f3256cb7c87f2b56c514f70bb8254f901f8e4e581b5873d1d0d328fc5ddfa589a0c4c585e75ee45315356856fcab6d86
|
7
|
+
data.tar.gz: 7b32b59ca121f4e35a10cacf7766dcb5c6e76a1cf0f47f0522e91425d476645d24f415943b864aee295534f579285903ad53ab47ae0cfeeb60adeb50d659c637
|
data/Gemfile.lock
CHANGED
@@ -17,11 +17,11 @@ module Vlcraptor
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def next
|
20
|
-
return
|
21
|
-
return
|
22
|
-
return
|
23
|
-
return
|
24
|
-
return when_playing if @player.playing?
|
20
|
+
return on_play if @preferences.play? && @suspended
|
21
|
+
return on_pause if @preferences.pause? && !@suspended
|
22
|
+
return on_stop if @preferences.stop? && !@suspended
|
23
|
+
return build if @suspended
|
24
|
+
return when_playing if @track && @player.playing?
|
25
25
|
return when_auto if @preferences.continue?
|
26
26
|
|
27
27
|
when_manual
|
@@ -36,32 +36,24 @@ module Vlcraptor
|
|
36
36
|
private
|
37
37
|
|
38
38
|
def on_pause
|
39
|
-
|
39
|
+
suspend("Now Paused", :pause)
|
40
40
|
end
|
41
41
|
|
42
42
|
def on_stop
|
43
|
-
|
43
|
+
suspend("Now Stopped", :stop)
|
44
44
|
end
|
45
45
|
|
46
|
-
def
|
47
|
-
|
48
|
-
|
49
|
-
@player.send(method)
|
50
|
-
end
|
46
|
+
def suspend(status, method)
|
47
|
+
@player.fadeout
|
48
|
+
@player.send(method)
|
51
49
|
@status = status
|
52
50
|
@suspended = true
|
53
51
|
@notifiers.track_suspended
|
54
|
-
on_suspended
|
55
|
-
end
|
56
|
-
|
57
|
-
def on_suspended
|
58
52
|
build
|
59
53
|
end
|
60
54
|
|
61
55
|
def on_play
|
62
|
-
|
63
|
-
@player.fadein
|
64
|
-
end
|
56
|
+
@player.fadein
|
65
57
|
@suspended = false
|
66
58
|
@notifiers.track_resumed(@track, @player.time)
|
67
59
|
when_playing_track(@player.remaining)
|
@@ -115,12 +107,17 @@ module Vlcraptor
|
|
115
107
|
remaining_color = remaining < 30 ? 9 : 5
|
116
108
|
build(
|
117
109
|
[2, @track[:title]],
|
118
|
-
[0, "
|
110
|
+
[0, "\n"],
|
111
|
+
[0, "by "],
|
119
112
|
[11, @track[:artist]],
|
120
|
-
[0, "
|
113
|
+
[0, "\n"],
|
114
|
+
[0, "from "],
|
121
115
|
[6, @track[:album]],
|
122
|
-
[0, "
|
123
|
-
[remaining_color,
|
116
|
+
[0, "\n"],
|
117
|
+
[remaining_color, duration(remaining)],
|
118
|
+
[0, " of "],
|
119
|
+
[0, duration(@track[:length])],
|
120
|
+
[0, " remaining\n"],
|
124
121
|
)
|
125
122
|
end
|
126
123
|
|
@@ -152,9 +149,13 @@ module Vlcraptor
|
|
152
149
|
scrobble = @preferences[:scrobble] ? "+" : "-"
|
153
150
|
[
|
154
151
|
[0, display_time(Time.now)],
|
152
|
+
[0, "\n"],
|
155
153
|
[0, @status],
|
156
|
-
[0, "
|
154
|
+
[0, "\n"],
|
155
|
+
[0, "#{Vlcraptor::Queue.length} queued tracks"],
|
156
|
+
[0, "\n"],
|
157
157
|
[8, "#{autoplay}autoplay #{crossfade}crossfade #{scrobble}scrobble"],
|
158
|
+
[0, "\n"],
|
158
159
|
] + extra
|
159
160
|
end
|
160
161
|
end
|
data/lib/vlcraptor/queue.rb
CHANGED
@@ -65,15 +65,20 @@ module Vlcraptor
|
|
65
65
|
|
66
66
|
puts "adding #{path}"
|
67
67
|
tags = Vlcraptor::Ffmpeg.new(path)
|
68
|
-
|
68
|
+
enqueue(
|
69
69
|
title: tags.title,
|
70
70
|
artist: tags.artist,
|
71
71
|
album: tags.album,
|
72
72
|
length: tags.time,
|
73
|
-
path: File.expand_path(path)
|
74
|
-
|
73
|
+
path: File.expand_path(path)
|
74
|
+
)
|
75
|
+
end
|
76
|
+
|
77
|
+
def self.enqueue(track)
|
75
78
|
`mkdir -p /tmp/queue`
|
76
|
-
File.open("/tmp/queue/#{(Time.now.to_f * 1000).to_i}.yml", "w")
|
79
|
+
File.open("/tmp/queue/#{(Time.now.to_f * 1000).to_i}.yml", "w") do |file|
|
80
|
+
file.puts track.to_yaml
|
81
|
+
end
|
77
82
|
end
|
78
83
|
end
|
79
84
|
end
|
data/lib/vlcraptor/version.rb
CHANGED
data/lib/vlcraptor.rb
CHANGED
@@ -23,7 +23,9 @@ module Vlcraptor
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def self.history
|
26
|
-
|
26
|
+
history_path = "#{File.expand_path("~")}/.player_history"
|
27
|
+
`touch #{history_path}`
|
28
|
+
system("cat #{history_path}")
|
27
29
|
end
|
28
30
|
|
29
31
|
def self.list
|
@@ -78,7 +80,6 @@ module Vlcraptor
|
|
78
80
|
player_controller.next.each do |pair|
|
79
81
|
window.attron(Curses.color_pair(pair.first)) { window << pair.last }
|
80
82
|
Curses.clrtoeol
|
81
|
-
window << "\n"
|
82
83
|
end
|
83
84
|
(window.maxy - window.cury).times { window.deleteln }
|
84
85
|
window.refresh
|
@@ -96,7 +97,7 @@ module Vlcraptor
|
|
96
97
|
break
|
97
98
|
end
|
98
99
|
|
99
|
-
sleep 0.
|
100
|
+
sleep 0.2
|
100
101
|
end
|
101
102
|
ensure
|
102
103
|
player_controller.cleanup
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vlcraptor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Ryall
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-04-
|
11
|
+
date: 2022-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: curses
|