[tracks] Use todays date for creating monthly playlists
All checks were successful
build / test (push) Successful in 2m3s
All checks were successful
build / test (push) Successful in 2m3s
This commit is contained in:
@ -659,7 +659,8 @@ def add_track_to_mopidy_monthly_playlist(scrobble):
|
|||||||
if not mopidy_uri:
|
if not mopidy_uri:
|
||||||
return
|
return
|
||||||
|
|
||||||
playlist_name = DateFormat(scrobble.timestamp).format(pattern)
|
now = now_user_timezone(profile)
|
||||||
|
playlist_name = DateFormat(now).format(pattern)
|
||||||
if not playlist_name:
|
if not playlist_name:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@ -35,6 +35,7 @@ from django.http import (
|
|||||||
from django.shortcuts import get_object_or_404, redirect
|
from django.shortcuts import get_object_or_404, redirect
|
||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
from django.utils.dateformat import DateFormat
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
from django.views.decorators.http import require_POST
|
from django.views.decorators.http import require_POST
|
||||||
from django.views.generic import DetailView, FormView, TemplateView
|
from django.views.generic import DetailView, FormView, TemplateView
|
||||||
@ -1051,13 +1052,12 @@ def add_to_mopidy_monthly_playlist(request, uuid):
|
|||||||
)
|
)
|
||||||
return redirect("scrobbles:detail", uuid=uuid)
|
return redirect("scrobbles:detail", uuid=uuid)
|
||||||
|
|
||||||
|
now = now_user_timezone(profile)
|
||||||
|
playlist_name = DateFormat(now).format(pattern)
|
||||||
|
|
||||||
from scrobbles.utils import add_track_to_mopidy_monthly_playlist
|
from scrobbles.utils import add_track_to_mopidy_monthly_playlist
|
||||||
|
|
||||||
add_track_to_mopidy_monthly_playlist(scrobble)
|
add_track_to_mopidy_monthly_playlist(scrobble)
|
||||||
|
|
||||||
from django.utils.dateformat import DateFormat
|
|
||||||
|
|
||||||
playlist_name = DateFormat(scrobble.timestamp).format(pattern)
|
|
||||||
messages.add_message(
|
messages.add_message(
|
||||||
request,
|
request,
|
||||||
messages.SUCCESS,
|
messages.SUCCESS,
|
||||||
|
|||||||
Reference in New Issue
Block a user