-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevents.go
162 lines (126 loc) · 2.87 KB
/
events.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
package main
import (
"image"
"github.com/gdamore/tcell/v2"
)
type eventUpdate struct {
tcell.EventTime
}
type eventDisplayMessage struct {
tcell.EventTime
}
type eventRefitArt struct {
tcell.EventTime
}
type eventCheckDrawMode struct {
tcell.EventTime
}
type textEvents interface {
String() string
}
// new media item data, if null, previous playback will continue
type eventNewItem struct {
tcell.EventTime
album *album
}
func newItem(album *album) *eventNewItem {
return &eventNewItem{album: album}
}
func (event *eventNewItem) value() *album {
return event.album
}
type eventNewTagSearch struct {
tcell.EventTime
result *DiscoverResult
}
func newTagSearch(result *DiscoverResult) *eventNewTagSearch {
return &eventNewTagSearch{result: result}
}
func (event *eventNewTagSearch) value() *DiscoverResult {
return event.result
}
type eventAdditionalTagSearch struct {
tcell.EventTime
result *DiscoverResult
}
func newAdditionalTagSearch(result *DiscoverResult) *eventAdditionalTagSearch {
return &eventAdditionalTagSearch{result: result}
}
func (event *eventAdditionalTagSearch) value() *DiscoverResult {
return event.result
}
type eventNextTrack struct {
tcell.EventTime
}
// value unused
type eventNewTrack struct {
tcell.EventTime
track int
}
func newTrack(trackNumber int) *eventNewTrack {
return &eventNewTrack{track: trackNumber}
}
func (event *eventNewTrack) value() int {
return event.track
}
type eventCoverDownloaded struct {
tcell.EventTime
cover image.Image
url string
}
func newCoverDownloaded(cover image.Image, url string) *eventCoverDownloaded {
return &eventCoverDownloaded{cover: cover, url: url}
}
func (event *eventCoverDownloaded) value() image.Image {
return event.cover
}
func (event *eventCoverDownloaded) key() string {
return event.url
}
// cache key = track url
type eventTrackDownloaded struct {
tcell.EventTime
key string
}
func newTrackDownloaded(key string) *eventTrackDownloaded {
return &eventTrackDownloaded{key: key}
}
func (event *eventTrackDownloaded) value() string {
return event.key
}
type eventDebugMessage struct {
tcell.EventTime
message string
}
func newDebugMessage(text string) *eventDebugMessage {
var event tcell.EventTime
event.SetEventNow()
return &eventDebugMessage{event, text}
}
func (event *eventDebugMessage) String() string {
return event.message
}
type eventMessage struct {
tcell.EventTime
message string
}
func newMessage(text string) *eventMessage {
var event tcell.EventTime
event.SetEventNow()
return &eventMessage{event, text}
}
func (event *eventMessage) String() string {
return event.message
}
type eventErrorMessage struct {
tcell.EventTime
message error
}
func newErrorMessage(err error) *eventErrorMessage {
var event tcell.EventTime
event.SetEventNow()
return &eventErrorMessage{event, err}
}
func (event *eventErrorMessage) String() string {
return event.message.Error()
}