diff --git a/oliver_screen/templates/public/now_playing.html b/oliver_screen/templates/public/now_playing.html index d670206..f079f58 100644 --- a/oliver_screen/templates/public/now_playing.html +++ b/oliver_screen/templates/public/now_playing.html @@ -17,8 +17,8 @@ var player; function onYouTubePlayerAPIReady() { player = new YT.Player('player', { - width: '1280', - height: '720', + width: '1200', + height: '675', videoId: '{{ now_playing.video.videoId }}', playerVars: { controls: 0, // no controls diff --git a/oliver_screen/tracks/views.py b/oliver_screen/tracks/views.py index 9c4ec2a..387d129 100644 --- a/oliver_screen/tracks/views.py +++ b/oliver_screen/tracks/views.py @@ -66,18 +66,17 @@ def get_now_playing(request): def cache_current(now_playing): # Fetch the one CurrentTrack entry in the db and update it with the current track. - current = CurrentTrack.objects.get(pk=1) - if not current is None: + current = [] + try: + current = CurrentTrack.objects.get(pk=1) + except: #update - current.artist = now_playing['artist'] - current.title = now_playing['title'] - current.image = now_playing['image'] - current.retries = 0 - current.save() - else: - # First time running? Then creat it. - current = CurrentTrack(artist=now_playing.artist, title=now_playing.title, image=now_playing.image, retries=0) - current.save() + current = CurrentTrack(artist="", title="", image="", retries=0) + current.artist = now_playing['artist'] + current.title = now_playing['title'] + current.image = now_playing['image'] + current.retries = 0 + current.save() def get_current_from_cache(): current = []