1
0
Commit Graph

283 Commits

Author SHA1 Message Date
b8f6163cb8
Need to use RUnlock for RLock. 2024-06-18 19:50:56 +04:00
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
f265494ea8
Send only a response code without any text to Icecast and Ezstream. 2024-05-22 03:40:33 +04:00
8d3ec1a327
Since ListenersUpdate works with Icecast specifically, let's point it out in its name. 2024-05-16 01:59:26 +04:00
a728ea2164
Let's try to not add 5 seconds to Song.StartAt. 2024-05-16 01:44:45 +04:00
f266e4fcf7
Restructurised Statistics. 2024-05-15 23:51:10 +04:00
51a0ef167c
Do not log songs whose artist and title tags are empty. 2024-05-13 01:14:05 +04:00
40d2993b03
Remove commented out go func() {}. 2024-05-13 01:13:05 +04:00
d2db23be5d
Now that only current number of listeners is being shown, send just it instead of a whole ListenerCounter. 2024-05-12 03:57:54 +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
cf90bba297
Updated logic in DJ handlers. Also let's give a try to not run this updating code in a PlaylistNext() handler in a separate thread. Also funnier handling of audio tag missing. 2024-05-11 04:36:23 +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
84e23b5b85
Remove an http.Error() func call from an anonym func that is spawned in a separate thread because that w (http.ResponseWriter) could be not available. 2024-05-10 04:39:56 +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
71844a106d
Updated internal/http. 2024-05-10 00:07:07 +04:00
816a8d88a7
Introduce a statistics DB implemented in SQLite3. 2024-05-09 23:53:33 +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
0244f6afd5
A unified ServeAsset() func was introduced. AssetsGetFile() now will panic if a file doesn't exists, because it must not be the case. 2024-04-20 18:54:05 +04:00
7d4de3f6a6
Add 5 seconds to time.Now() to more accurately represent the time when a song actually starts to play. 2023-10-09 01:15:05 +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
f960d8516a
Since SongList.Current() now return a copy then this code is no longer needed. 2023-10-08 23:55:55 +04:00
e63f0aead3
Make a SongList.Current() return a copy of a current song. 2023-10-08 23:52:10 +04:00
04e09dd800
Removed debug fmt.Println from ListenersUpdate. 2023-10-08 23:07:04 +04:00
27affc5e73
Let's actually remove unused handlers. 2023-10-08 22:50:36 +04:00
dbf71f3f64
Fixed listeners number update, well, on-dis/connect in mount is for a SOURCE. To get listeners you need to use <authentication type="url">.
Also, disabled all listener handler, added POST /api/listener/icecast handler.
2023-10-08 22:17:56 +04:00
24ce8115e7
MostListenedDateFormat was changed. 2023-10-08 04:08:27 +04:00
83955866c9
Alter an artist tag to tell that there is nothing left to play, so a fallback song is used to fill a silence. 2023-10-08 02:56:19 +04:00
f0aa00b932
Added a fallback song option. Altered a PlaylistNext() header to use it. 2023-10-08 02:52:37 +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
b8afed6e1b
In PlaylistNext() CheckAndUpdateMostListenedSong() call was moved after songList.Add to avoid nil pointer dereferencing. 2023-10-07 05:34:50 +04:00
020676f113
While I want thread safety I also want a not set current song to not appear in a status JSON object. 2023-10-07 05:23:45 +04:00
07b0199193
In a PlaylistNext() handler pass a current song as a copy. 2023-10-07 05:20:27 +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
2f96976f19
In DJHandlers.Status in an anonymous struct removed a pointer to Song. 2023-10-05 18:54:44 +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