Apply 12 suggestion(s) to 4 file(s)

Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale/-/merge_requests/2658>
environments/review-docs-2079-tp5oqz/deployments/19381
Ciarán Ainsworth 2024-04-08 12:03:31 +00:00
rodzic 1b15fea1ab
commit 97e24bcaa6
4 zmienionych plików z 14 dodań i 14 usunięć

Wyświetl plik

@ -309,11 +309,11 @@ Called by the task manager to trigger listening sync
""" """
FAVORITE_CREATED = "favorite_created" FAVORITE_CREATED = "favorite_created"
""" """
Called when a track is being liked Called when a track is being favorited
""" """
FAVORITE_DELETED = "favorite_deleted" FAVORITE_DELETED = "favorite_deleted"
""" """
Called when a favorite track is being unliked Called when a favorited track is being unfavorited
""" """
FAVORITE_SYNC = "favorite_sync" FAVORITE_SYNC = "favorite_sync"
""" """

Wyświetl plik

@ -34,24 +34,24 @@ PLUGIN = plugins.get_plugin_config(
"type": "boolean", "type": "boolean",
"default": False, "default": False,
"label": "Enable listenings sync", "label": "Enable listenings sync",
"help": "If enable, your listening from Listenbrainz will be imported into Funkwhale. This means they \ "help": "If enabled, your listening from ListenBrainz will be imported into Funkwhale. This means they \
will be used has any other funkwhale listenings to filter out recently listened content or \ will be used along with Funkwhale listenings to filter out recently listened content or \
generate recommendations", generate recommendations",
}, },
{ {
"name": "sync_facorites", "name": "sync_favorites",
"type": "boolean", "type": "boolean",
"default": False, "default": False,
"label": "Enable favorite sync", "label": "Enable favorite sync",
"help": "If enable, your favorites from Listenbrainz will be imported into Funkwhale. This means they \ "help": "If enabled, your favorites from ListenBrainz will be imported into Funkwhale. This means they \
will be used has any other funkwhale favorites (Ui display, federatipon activity)", will be used along with Funkwhale favorites (UI display, federation activity)",
}, },
{ {
"name": "submit_favorites", "name": "submit_favorites",
"type": "boolean", "type": "boolean",
"default": False, "default": False,
"label": "Enable favorite submission to Listenbrainz services", "label": "Enable favorite submission to ListenBrainz services",
"help": "If enable, your favorites from Funkwhale will be submit to Listenbrainz", "help": "If enabled, your favorites from Funkwhale will be submitted to ListenBrainz",
}, },
], ],
) )

Wyświetl plik

@ -90,12 +90,12 @@ def add_lb_listenings_to_db(listens, user):
) )
if not mbid: if not mbid:
logger.info("Received listening doesn't have a mbid. Skipping...") logger.info("Received listening that doesn't have a mbid. Skipping...")
try: try:
track = music_models.Track.objects.get(mbid=mbid) track = music_models.Track.objects.get(mbid=mbid)
except music_models.Track.DoesNotExist: except music_models.Track.DoesNotExist:
logger.info("Received listening doesn't exist in fw database. Skipping...") logger.info("Received listening that doesn't exist in fw database. Skipping...")
continue continue
user = user user = user
@ -139,7 +139,7 @@ def add_lb_feedback_to_db(feedbacks, user):
track = music_models.Track.objects.get(mbid=feedback["recording_mbid"]) track = music_models.Track.objects.get(mbid=feedback["recording_mbid"])
except music_models.Track.DoesNotExist: except music_models.Track.DoesNotExist:
logger.info( logger.info(
"Received feedback track doesn't exist in fw database. Skipping..." "Received feedback track that doesn't exist in fw database. Skipping..."
) )
continue continue
@ -160,4 +160,4 @@ def add_lb_feedback_to_db(feedbacks, user):
except favorites_models.TrackFavorite.DoesNotExist: except favorites_models.TrackFavorite.DoesNotExist:
continue continue
elif feedback["score"] == -1: elif feedback["score"] == -1:
logger.info("Funkwhale doesn't support hate yet <3") logger.info("Funkwhale doesn't support disliked tracks")

Wyświetl plik

@ -25,7 +25,7 @@ def test_listenbrainz_submit_listen(logged_in_client, mocker, factories):
"listenbrainz", "listenbrainz",
{ {
"sync_listenings": True, "sync_listenings": True,
"sync_facorites": True, "sync_favorites": True,
"submit_favorites": True, "submit_favorites": True,
"sync_favorites": True, "sync_favorites": True,
"user_token": "blablabla", "user_token": "blablabla",