Virtual Radio Stations are now working!
It took me a lot of brain power to figure out how to get virtual live radio stations working the way I wanted. I probably tried a half dozen different methods before settling on what I have now.
First I parse all the MP3 files in a folder into a python deque list. (A basically a list that can be looped). So rather then trying to keep track of the index of the current song (Which breaks if the lists are different lengths), I instead just rotate the list so that the current song playing is index 0
If the metadata file calls for it, I can randomize the list at program load, or anytime if I want.
I then calculate the length of each song in the list, and the time since the program started. When you drop into a radio station it will drop into the correct song and time in that radio station based on time.
Even if you change the current radio station all the other stations will continue to virtually play in the background. The cool part is you can also change the song on the current station and it will continue "live" playback.
The tricky part comes when you jump into a station after listening to another after a few minutes. I have to figure out which song in the list is supposed to be playing based on the time that has past, then adjust the list of songs so that song is the current one, and then also jump into the proper spot in that song as if the station never stopped playing. This was by far the hardest feature to get working as the radio stations are all different lengths. Currently if you do drop into a station that is 10 minutes long, but 15 minutes have elapsed I just start the station over.
The code is updated on GIT hub, but as usual you have to drop in your own MP3s.