Archived
Fixed size. Fixed caching on first time run.
This commit is contained in:
1 parent
1f91259972
commit
33923721a7
2 files changed
+12
-13
No files matched your search
@@ -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
|
||||
|
||||
@@ -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 = []
|
||||
|
||||
Reference in new issue
Block a user