Add recently added radio, part of #1390
This commit is contained in:
parent
96fe772d96
commit
a8ab4eedfc
|
@ -5,11 +5,12 @@ from django.db import connection
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
from funkwhale_api.federation import models as federation_models
|
|
||||||
from funkwhale_api.federation import fields as federation_fields
|
from funkwhale_api.federation import fields as federation_fields
|
||||||
|
from funkwhale_api.federation import models as federation_models
|
||||||
from funkwhale_api.moderation import filters as moderation_filters
|
from funkwhale_api.moderation import filters as moderation_filters
|
||||||
from funkwhale_api.music.models import Artist, Library, Track, Upload
|
from funkwhale_api.music.models import Artist, Library, Track, Upload
|
||||||
from funkwhale_api.tags.models import Tag
|
from funkwhale_api.tags.models import Tag
|
||||||
|
|
||||||
from . import filters, models
|
from . import filters, models
|
||||||
from .registries import registry
|
from .registries import registry
|
||||||
|
|
||||||
|
@ -320,3 +321,10 @@ class LibraryRadio(RelatedObjectRadio):
|
||||||
|
|
||||||
def get_related_object_id_repr(self, obj):
|
def get_related_object_id_repr(self, obj):
|
||||||
return obj.uuid
|
return obj.uuid
|
||||||
|
|
||||||
|
|
||||||
|
@registry.register(name="recently-added")
|
||||||
|
class RecentlyAdded(SessionRadio):
|
||||||
|
def get_queryset(self, **kwargs):
|
||||||
|
qs = super().get_queryset(**kwargs)
|
||||||
|
return qs.filter(artist__content_category="music").order_by("-creation_date")
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Implemented awesome recently added radio (part of #1390)
|
|
@ -13,6 +13,7 @@
|
||||||
<radio-card v-if="isAuthenticated" :type="'actor-content'" :object-id="$store.state.auth.fullUsername"></radio-card>
|
<radio-card v-if="isAuthenticated" :type="'actor-content'" :object-id="$store.state.auth.fullUsername"></radio-card>
|
||||||
<radio-card v-if="isAuthenticated && hasFavorites" :type="'favorites'"></radio-card>
|
<radio-card v-if="isAuthenticated && hasFavorites" :type="'favorites'"></radio-card>
|
||||||
<radio-card :type="'random'"></radio-card>
|
<radio-card :type="'random'"></radio-card>
|
||||||
|
<radio-card :type="'recently-added'"></radio-card>
|
||||||
<radio-card v-if="$store.state.auth.authenticated" :type="'less-listened'"></radio-card>
|
<radio-card v-if="$store.state.auth.authenticated" :type="'less-listened'"></radio-card>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -27,6 +27,10 @@ export default {
|
||||||
'less-listened': {
|
'less-listened': {
|
||||||
name: 'Less listened',
|
name: 'Less listened',
|
||||||
description: "Listen to tracks you usually don't. It's time to restore some balance."
|
description: "Listen to tracks you usually don't. It's time to restore some balance."
|
||||||
|
},
|
||||||
|
'recently-added': {
|
||||||
|
name: 'Recently Added',
|
||||||
|
description: "Newest content on the network. Get some fresh air."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue