I can post my full code and platform, but I'm not really sure what the rest of that is to be honest.
Here is my full code:
Code: Select all
from gmusicapi import Mobileclient
import vlc
import time
class MusicStreamer():
def load_radio(this):
#Brandy
song_list = this.api.get_station_tracks("a118f758-a015-34bb-a5ec-b880645f602e",25,this.do_not_play)
#Come and get your love
#song_list = this.api.get_station_tracks("be7299d0-a644-38bb-bd30-790d94f6e002",25,this.do_not_play)
print("Loading Looping String")
for _ in range(50):
this.l.add_media(this.i.media_new(this.api.get_stream_url('f0477323-b624-32ea-acdb-463ca75d5f42')))
print("Loading Radio Sation")
for song in song_list:
print('Adding ' + song['title'] + " (" + song['artist'] + ")")
try:
this.plEnd = this.i.media_new(this.api.get_stream_url(song['storeId']))
this.l.add_media(this.plEnd)
this.do_not_play.append(song['storeId'])
except:
this.plEnd = this.i.media_new(this.api.get_stream_url(song['id']))
this.l.add_media(this.plEnd)
this.do_not_play.append(song['id'])
def __init__(this):
print("please wait")
this.api = Mobileclient()
#api.perform_oauth()
#api.oauth_login('57770f1077ccad9f72afbfea95bbb1c393285a3777bd7b3e0a4d5e2f3031f6d6')
this.api.oauth_login(Mobileclient.FROM_MAC_ADDRESS)
this.do_not_play = []
this.i=vlc.Instance()
this.l = this.i.media_list_new()
this.load_radio()
#print(this.l.count())
#print(this.l.item_at_index(0).get_mrl())
'''
for i in range(1,this.l.count()):
print(this.l.item_at_index(i).get_mrl()[77:(77+19)])
'''
p=this.i.media_list_player_new()
p.set_media_list(this.l)
p.play()
'''
print(this.plEnd.get_mrl()[77:(77+19)])
this.load_radio()
print(this.plEnd.get_mrl()[77:(77+19)])
'''
#p.next()
while (True):
print(p.get_state())
while (True):
cmd = input("Command:")
if cmd == "play":
p.play()
elif cmd == "next":
p.next()
if (p.get_media_player().get_media().get_mrl() == this.plEnd.get_mrl()):
print(True)
this.load_radio()
streamer = MusicStreamer()
I'm using the gmusic api to get mp3 files from Google Play Music and adding them to a vlc media list then trying to play all of them.
My code is far from done, but again, its entering the Ended state out of the blue so I need to fix that first.
I'm running Windows 10, but again I don't know where to find my version... not sure what the wrapper is or where any logs may be kept. I know I'm pretty naive about some of this, but I'd appreciate any help.
P.S. - I know its been a while, I'm just coming back to this project after basically giving up for a while.