1
0
Commit Graph

136 Commits

Author SHA1 Message Date
8c1e46900a
Added a SongList and Song_ types. An underscore is temporary and is because there is an another Song type in an icecast.go file. 2023-10-01 05:42:55 +04:00
cbfc1549ed
Added a mutex for Listeners struct for thread safety. 2023-10-01 04:18:43 +04:00
2e6f9f27c4
Added a Playlist struct. 2023-10-01 00:47:07 +04:00
328dbc644e
A struct to hold a number of current and peak listeners was added. 2023-09-30 23:57:31 +04:00
4b8ab610d5
Added comments for separator* consts. 2023-09-17 19:18:18 +04:00
b1428812c8
Comment out log in a benchmark. 2023-09-15 04:24:12 +04:00
60045d4ca2
icecastLastPlayedSongs was replaced by icecastCurrentSong that fetch only one song at the very end of a playlist.log. Also added a benchmark for this func. 2023-09-15 04:19:28 +04:00
7bb91cfcbe
A little reorganisation in icecast.go. 2023-09-15 03:20:12 +04:00
e8ad10a16d
In CheckAndUpdateMostListenedSong pass cur and prev songs by pointer. 2023-09-15 03:17:44 +04:00
2cf6e1a6cb
append() was replaced with more efficient copy() (only 1 allocation with make). 2023-09-14 18:20:47 +04:00
978b4c6454
Removed unused error returning (error is always nil). 2023-09-14 17:59:14 +04:00
c020031127
Do not overwrite mostlistenedsong file if a song wasn't changed. 2023-09-10 18:23:06 +04:00
e082527edc
In case of an http error show Offline in a Now playing field. 2023-08-21 18:31:06 +04:00
9ac60e9f28
Don't show server start date and time on a page. 2023-08-21 18:30:21 +04:00
5c16576fa4
Removed one nesting level by removing select statement. 2023-08-21 06:08:21 +04:00
76b3e2e8ad
For some log messages changed capital letter to lowercase. 2023-08-21 05:45:12 +04:00
f9b2afdd50
Added log for failed attempts on retrieving songs from playlist.log. 2023-08-20 18:03:51 +04:00
48bbd32eb8
Remove a debug print accidenatlly commited. 2023-08-20 03:27:08 +04:00
075e171b40
Populate a freshly created cache with songs if there are any. 2023-08-20 03:26:14 +04:00
7df94bef12
Only then call make on cache if it is nil. 2023-08-20 03:20:49 +04:00
4cc4d0138a
Return an empty IcecastStatus struct instead of nil in case of an error. 2023-07-22 23:08:18 +04:00
38f04aa9f8
Removed code for liquidsoap. 2023-07-22 22:15:24 +04:00
3e513087ca
Let's dynamically calculate bufferSize with 320 bytes per line. 2023-05-21 23:11:15 +04:00
eb6b0c68b3
No need in preloading. Because in this moment liquidsoap starts and adds a new song that Icecast writes in playlist.log so IN_MODIFY is being triggered. 2023-03-13 05:35:39 +04:00
c02442ebcd
Okay, there is actually a new line at the end of file. Let's skip that. 2023-03-13 05:10:17 +04:00
8e0d5e4fb7
Date format was moved out to a const. 2023-03-13 02:12:21 +04:00
0fffbce646
First try to load currently playing song. 2023-03-13 01:53:52 +04:00
2e60f2bb8a
Check for empty prev song. 2023-03-13 01:42:24 +04:00
f24953ae7c
Amount of listeners of next song is actually how much listeners was by the end of a prev song. 2023-03-13 01:42:00 +04:00
e84a811a1d
Update most listened song. 2023-03-13 00:04:34 +04:00
8f16b5d96f
Implemented a functionality for storing and showing most listened song. 2023-03-13 00:03:59 +04:00
53d24c5781
Store current song in a separate variable. A base for most listened song functionality. 2023-03-12 22:25:58 +04:00
63fcb36e60
Nah, 3KiB should be enought to read. 2023-03-12 22:06:15 +04:00
d48972caa0
Okay, now let's return original idea of adding songs one by one. 2023-03-12 21:48:01 +04:00
517dd0e534
Fixed last songs displaying. 2023-03-12 21:31:18 +04:00
0409da3ca3
Oh, last commit led to loading of full list of prev songs. Let's remove this code. 2023-03-12 04:01:32 +04:00
10048c671e
Prevent reading latest song from a log right after a service started. 2023-03-12 03:53:09 +04:00
db02047268
Now lastPlayedCache's initial capacity is not hardcoded to 10. And it will be filled slowly, instead of initial read of last N songs from a playlist.log. 2023-03-12 02:19:07 +04:00
47e3ff37ba
Reduced bufferSize because 16KiB is more than enough for a max of 10 songs. 2023-03-12 02:16:55 +04:00
7e83be82cb
Calculate offset for ReadAt() instead of using Seek().
Fixed going out of bounds.
2022-09-21 04:56:06 +04:00
f631fdfa7c
Playlist log watcher was made into a struct. 2022-09-19 01:55:09 +04:00
3727f44381
lastPlayedSongs changed to icecastLastPlayedSongs. playlistFired changed to playlistChanged. 2022-09-19 01:37:47 +04:00
e8e3570a8f
Liquidsoap code moved to radio package. ErrNotRunning -> ErrLiquidsoapNotRunning. 2022-09-19 01:32:23 +04:00
73fc9861fd
Renamed Song() method to more clear name SongName(). 2022-08-31 00:52:50 +04:00
98b0a8085a
No, it skips 2 tracks instead of 1. Let's get back to -2. 2022-08-30 18:20:24 +04:00
0620f82940
lastPlayedSong was made into lastPlayedSongs. Now it retrieves up to n songs from a log. 2022-08-30 02:29:11 +04:00
64eed7ac7e
Oops, last line also has a newline. So the last one is empty. 2022-08-30 00:51:21 +04:00
1e6b51a2c0
IsRunning() method had no use. 2022-08-29 23:12:47 +04:00
f211602a4b
Implemented sane script validation. WTF did I think later..? 2022-08-29 23:10:39 +04:00
7dd517ea8f
Check if path is valid. Simplified error handling. 2022-08-29 22:20:05 +04:00
16e849eb65
Rewritten lastPlayedSong() in a sane way. Hope it will work. 2022-08-29 12:47:06 +04:00
d43b2fe897
Removed handling of imposible cases. 2022-08-29 09:19:35 +04:00
1996743470
Cache vars moved to the top of the file. 2022-08-29 09:08:08 +04:00
c935db8ce7
Implemented lastPlayedSong() function that retrieves one song from a playlist.log file that doesn't run external commands for it.
And now we start with an empty list.
2022-08-29 08:58:35 +04:00
0da8077ab7
Implemented a liquidsoap process launcher. 2022-08-29 07:20:36 +04:00
60dcf2c11c
ModMask replaced wuth ModIgnMask. Now IN_IGNORED being watched, it makes watcher to reinstantiate. 2022-05-24 23:20:19 +04:00
88e047d210
Moved time formats to constanst. 2022-04-02 04:29:23 +04:00
1b5dea899e
I found why time was being further altered. The reason is that slices are pointing to original array. Okay. The problem fixed. 2022-04-02 02:00:28 +04:00
c4532fea24
According to tests it is equal performance wise, so why not make a code shorter. 2022-04-01 23:20:04 +04:00
7d447be786
Initialise playlistFired at definition. 2022-04-01 22:35:30 +04:00
1ed81fdd36
Fixed deadlock caused by misunderstanding of how defer works. 2022-04-01 21:12:54 +04:00
21995ea4cd
Added mutex for lastPlayedCache. 2022-04-01 20:44:32 +04:00
0844b917dc
Now last played songs are consist of time, listeners and song name combined with artist. 2022-03-31 20:01:13 +04:00
4b5289223d
Remove whitespace in IcecastLastPlayedSongs. 2022-03-31 18:14:20 +04:00
a9b6e5a056
Compute lastPlayedCache length once a call. 2022-03-31 18:13:49 +04:00
d3563abba1
Remove inteermidiate variable and instantiate struct in return statement. 2022-03-31 18:11:04 +04:00
0d113d30a1
Replace Sprintf with way more performant simple concatenation. 2022-03-31 18:05:47 +04:00
b077fa053c
It is better to call here lastPlayedSongs directly. 2022-03-31 18:02:04 +04:00
0983a0f0c5
This conversion to UTC is excessive. 2022-03-31 17:58:42 +04:00
1dad2ffa5f
Removed another forgotten debug println. 2022-03-31 15:45:49 +04:00
b591346177
Removed forgotten debug println. 2022-03-31 15:44:17 +04:00
3b51fffa60
Added last played list cache with updating using Inotify watcher. 2022-03-31 15:35:04 +04:00
00c4b5a8b3
Added timezone for TZ converting purposes. 2022-03-31 02:55:05 +04:00
b4cbb236aa
Fixed an error in a time format. 2022-03-31 02:16:34 +04:00
942bad3b9d
It should be server_start_date. 2022-03-31 02:16:15 +04:00
c68c99e528
Return error for IcecastLastPlayedSongs. 2022-03-30 20:21:18 +04:00
4216c9c82a
Moved IcecastStatusDTO's method Song() under its struct. 2022-03-30 18:54:50 +04:00
6a61c56891
We are closer for working IcecastLastPlayedSongs(). 2022-03-10 00:10:00 +04:00
c4ea8aef8c
Debug Icecast. 2022-03-10 00:06:09 +04:00
637f7c0280
Oh, I found the problem. It's cut command. 2022-03-10 00:02:44 +04:00
65212103a3
Debug Icecast 2. 2022-03-10 00:00:52 +04:00
f756cedae7
Debugging Icecast. 2022-03-09 23:59:25 +04:00
9c2a2c67bb
Add debug println. 2022-03-09 23:53:35 +04:00
2ec461a90f
It may panic because of this. 2022-03-09 23:49:01 +04:00
1e1d614301
Debug println. 2022-03-08 03:41:19 +04:00
6ff024b25e
Initial commit. 2022-03-08 01:17:24 +04:00