1
0
Commit Graph

136 Commits

Author SHA1 Message Date
88ecf675b6
And same for a Playlist. 2024-05-22 04:07:33 +04:00
baad7da10d
After a research on how mutexes work, a mutex bcame embedded. And locks should be invoke from outside. 2024-05-22 04:05:15 +04:00
c8f71b205b
For Song omit listeners and peak_listeners if they are zero. 2024-05-12 03:56:44 +04:00
056f2c022b
max_listeners -> peak_listeners. 2024-05-11 05:05:27 +04:00
872e8f4978
A MaxListeners field of a Song struct was renamed to a more logically appropriate PeakListeners. 2024-05-11 04:52:40 +04:00
4feeb518fc
Added methods for a ListenerCounter struct to access a current peak and overall numbers of listeners. 2024-05-11 04:42:06 +04:00
08203c4be0
Also return a current peak listeners number. 2024-05-11 04:38:08 +04:00
d94c029fda
In ListenerCounter struct also keep track of overall number of listeners for a song and its max simultaneous number of listeners. These parameters are being reset with a Reset() method that returns its values. 2024-05-11 04:21:00 +04:00
1682362779
Do not alter Song struct listeners with its methods, use a ListenerCounter to populate Listeners and MaxListeners. Eliminates the need for a mutex and SetFrom(), UpdateMaxListeners() and IncListeners() methods. 2024-05-11 04:18:28 +04:00
ec6c1df474
For Song struct a method SetFrom was added. 2024-05-10 00:08:59 +04:00
c1d64700ff
A separate MostListenedSong struct is not needed anymore. 2024-05-10 00:07:57 +04:00
9ef0771389
SongList struct was removed. A Song struct got UpdateMaxListeners() and IncListeners() methods. A mutex was Introduced for it. A Listeners field to store overall number of listeners during a song playing was introduced as well. A comment for the Song struct was removed. 2024-05-09 20:30:17 +04:00
ec5b6a028b
In ListenerCounter struct int -> int64. 2024-05-09 20:18:06 +04:00
c9e30f76e6
Let's actually hide RWMutex's methods to clean a namespace. 2023-10-09 00:21:44 +04:00
fb46a912f7
In song.go updated comments. 2023-10-09 00:05:28 +04:00
e63f0aead3
Make a SongList.Current() return a copy of a current song. 2023-10-08 23:52:10 +04:00
24ce8115e7
MostListenedDateFormat was changed. 2023-10-08 04:08:27 +04:00
0d8032da46
MostListenedSong was rewritten. 2023-10-08 00:52:40 +04:00
d84d985962
In ListenerCounter a sync.Mutex was replaced by a sync.RWMutex. 2023-10-07 23:21:00 +04:00
da4e97f1aa
In Playlist.load() a check for an empty file was added. 2023-10-07 23:17:42 +04:00
131ea35341
A reduntant method Song.ArtistTitle() was removed. 2023-10-07 21:31:00 +04:00
f53f30963d
sync.Mutex was replaced by sync.RWMutex for SongList. 2023-10-07 05:16:16 +04:00
1d50bbe790
In MarshalJSON() for Song a string field Duration was removed, just msec left. 2023-10-07 05:11:58 +04:00
9beb179cc0
SongList.Current() now returns a copy of Song instead of a pointer. 2023-10-05 18:52:18 +04:00
9b14d7846b
In CheckAndUpdateMostListenedSong() accept Song by value instead of a pointer. 2023-10-05 18:19:41 +04:00
c7f6b3072d
Embedded a sync.Mutex to a ListenerCounter. 2023-10-05 18:18:48 +04:00
eeadbc4f96
To a SongList a method UpdateCurrentMaxListeners() was added, it checks and updates max listeners for a current song in a thread safe manner. 2023-10-05 18:04:15 +04:00
b659464118
For Song.ArtistTitle() a comment was updated. 2023-10-05 18:02:33 +04:00
f8fd13f8ed
In playlist load() add an error message. 2023-10-05 17:36:02 +04:00
e0fa65fbd7
Decided to remove inotify watcher from playlist. 2023-10-05 17:31:12 +04:00
10bc3a3785
In Playlist embed a sync.Mutex instead. 2023-10-04 18:37:13 +04:00
1c6d288cd7
In song.go: added comments; embed sync.Mutex in SongList instead of having it as a field; changed a json field name duration_milliseconds to duration_msec; listMaxLen field was renamed to maxLen; Len() was renamed to MaxLen(). 2023-10-04 18:10:17 +04:00
0bf81f93c8
In Song.DurationString() updated format. 2023-10-02 18:08:57 +04:00
64c2868fcf
Updated CheckAndUpdateMostListenedSong() func. 2023-10-02 15:04:51 +04:00
29714b30ca
A file listeners.go was renamed to listener_counter.go. 2023-10-02 04:33:11 +04:00
9757f5f748
Oh, time.Duration works a little differently... 2023-10-02 03:55:17 +04:00
f1e2eca876
Added a DurationString() method for a Song that returns time in format 04:05 or 15:04:05 if a song is one hour or more long. 2023-10-02 03:52:26 +04:00
010774d775
Return a formatted string alongside with duration in milliseconds. 2023-10-02 03:48:31 +04:00
bd9b80076a
Updated CheckAndUpdateMostListenedSong() to work with a new Song struct. 2023-10-02 03:19:23 +04:00
f9d85d45f5
Song_ was renamed to Song. Also added Len() method to a SongList. 2023-10-02 03:18:30 +04:00
5e8e9943f9
Icecast-specific code was removed, because now it all is controled inside a service. 2023-10-02 03:15:05 +04:00
3ed0f7b62a
Added MarshalJSON() method to MostListenedSong. 2023-10-02 02:07:39 +04:00
ddf5f3d0f7
Added check if mostListened set. 2023-10-02 02:07:08 +04:00
c054c3b32e
Added a duration field to Song_ struct. 2023-10-02 01:26:22 +04:00
381da691a4
For ListenerCounter implemented MarshalJSON() method. 2023-10-01 22:03:26 +04:00
2be516236b
SongList.Current() will return nil if current song wasn't set yet. 2023-10-01 22:02:54 +04:00
dea283df27
Listeners struct was renamed to ListenerCounter. 2023-10-01 20:32:07 +04:00
dc3658d6de
Decided to implement an inotify watcher for a playlist file. Dunno if it works correctly, but it seems like, not tested yet. 2023-10-01 06:44:36 +04:00
4faf2a0309
In Playlist a method Load() was renamed into load(), and a public Reload() method created. 2023-10-01 06:40:05 +04:00
6ebe24fa5a
In SongList Add check if a current song wasn't set yet. 2023-10-01 06:37:47 +04:00