mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-04 00:39:16 +02:00
Resolve "The "radio - random" function also plays podcasts"
This commit is contained in:
parent
e58edad80d
commit
71318d66c3
2 changed files with 8 additions and 3 deletions
|
@ -102,7 +102,7 @@ class SessionRadio(SimpleRadio):
|
||||||
class RandomRadio(SessionRadio):
|
class RandomRadio(SessionRadio):
|
||||||
def get_queryset(self, **kwargs):
|
def get_queryset(self, **kwargs):
|
||||||
qs = super().get_queryset(**kwargs)
|
qs = super().get_queryset(**kwargs)
|
||||||
return qs.order_by("?")
|
return qs.filter(artist__content_category="music").order_by("?")
|
||||||
|
|
||||||
|
|
||||||
@registry.register(name="favorites")
|
@registry.register(name="favorites")
|
||||||
|
@ -116,7 +116,7 @@ class FavoritesRadio(SessionRadio):
|
||||||
def get_queryset(self, **kwargs):
|
def get_queryset(self, **kwargs):
|
||||||
qs = super().get_queryset(**kwargs)
|
qs = super().get_queryset(**kwargs)
|
||||||
track_ids = kwargs["user"].track_favorites.all().values_list("track", flat=True)
|
track_ids = kwargs["user"].track_favorites.all().values_list("track", flat=True)
|
||||||
return qs.filter(pk__in=track_ids)
|
return qs.filter(pk__in=track_ids, artist__content_category="music")
|
||||||
|
|
||||||
|
|
||||||
@registry.register(name="custom")
|
@registry.register(name="custom")
|
||||||
|
@ -271,7 +271,11 @@ class LessListenedRadio(SessionRadio):
|
||||||
def get_queryset(self, **kwargs):
|
def get_queryset(self, **kwargs):
|
||||||
qs = super().get_queryset(**kwargs)
|
qs = super().get_queryset(**kwargs)
|
||||||
listened = self.session.user.listenings.all().values_list("track", flat=True)
|
listened = self.session.user.listenings.all().values_list("track", flat=True)
|
||||||
return qs.exclude(pk__in=listened).order_by("?")
|
return (
|
||||||
|
qs.filter(artist__content_category="music")
|
||||||
|
.exclude(pk__in=listened)
|
||||||
|
.order_by("?")
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@registry.register(name="actor_content")
|
@registry.register(name="actor_content")
|
||||||
|
|
1
changes/changelog.d/1140.bugfix
Normal file
1
changes/changelog.d/1140.bugfix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Fix random radio so that podcast content is not picked up (#1140)
|
Loading…
Add table
Add a link
Reference in a new issue