]>
code.octet-stream.net Git - broadcaster/blob - broadcaster-server/playlist.go
f0a6c899e583564e26a4a31a244f83660243dac1
7 type Playlists
struct {
9 playlistMutex sync
.Mutex
12 var playlists Playlists
14 func InitPlaylists() {
15 playlists
.changeWait
= make(chan bool)
18 func (p
*Playlists
) GetPlaylists() []Playlist
{
19 p
.playlistMutex
.Lock()
20 defer p
.playlistMutex
.Unlock()
21 return db
.GetPlaylists()
24 func (p
*Playlists
) WatchForChanges() ([]Playlist
, chan bool) {
25 p
.playlistMutex
.Lock()
26 defer p
.playlistMutex
.Unlock()
27 return db
.GetPlaylists(), p
.changeWait
30 func (p
*Playlists
) NotifyChanges() {
31 p
.playlistMutex
.Lock()
32 defer p
.playlistMutex
.Unlock()
34 p
.changeWait
= make(chan bool)