Files
vrobbler/vrobbler/apps/scrobbles/context_processors.py
Colin Powell 6d45571e75
All checks were successful
build & deploy / test (push) Successful in 2m14s
build & deploy / build-and-deploy (push) Successful in 32s
[templates] Have some fun with CSS
2026-05-27 21:53:03 -04:00

42 lines
921 B
Python

import pytz
from django.utils import timezone
from scrobbles.constants import EXCLUDE_FROM_NOW_PLAYING
from scrobbles.models import Scrobble
MONTH_COLORS = [
"#db7a7a", # Jan
"#db847a", # Feb
"#b0db7a", # Mar
"#7adb82", # Apr
"#7adbb3", # May
"#7ab6db", # Jun
"#7a8edb", # Jul
"#977adb", # Aug
"#c47adb", # Sep
"#db7ac5", # Oct
"#db7a90", # Nov
"#db7a7a", # Dec
]
def month_color(request):
from datetime import date
return {"month_color": MONTH_COLORS[(date.today().month - 1) % 12]}
def now_playing(request):
user = request.user
now = timezone.now()
if not user.is_authenticated:
return {}
return {
"now_playing_list": Scrobble.objects.filter(
in_progress=True,
is_paused=False,
user=user,
).exclude(
media_type__in=EXCLUDE_FROM_NOW_PLAYING,
)
}