From 12ce97836d7ca9c66e480ec8d0a81e7d6718963f Mon Sep 17 00:00:00 2001 From: CappielloAntonio Date: Sun, 19 Dec 2021 12:03:31 +0100 Subject: [PATCH] Implemented the API call for song lyrics --- .../mediaretrieval/MediaRetrievalClient.java | 5 +++ .../mediaretrieval/MediaRetrievalService.java | 3 ++ .../play/subsonic/models/Lyrics.java | 43 +++---------------- 3 files changed, 15 insertions(+), 36 deletions(-) diff --git a/app/src/main/java/com/cappielloantonio/play/subsonic/api/mediaretrieval/MediaRetrievalClient.java b/app/src/main/java/com/cappielloantonio/play/subsonic/api/mediaretrieval/MediaRetrievalClient.java index 6a16c4c9..14b7a206 100644 --- a/app/src/main/java/com/cappielloantonio/play/subsonic/api/mediaretrieval/MediaRetrievalClient.java +++ b/app/src/main/java/com/cappielloantonio/play/subsonic/api/mediaretrieval/MediaRetrievalClient.java @@ -44,6 +44,11 @@ public class MediaRetrievalClient { return mediaRetrievalService.download(subsonic.getParams(), id); } + public Call getLyrics(String artist, String title) { + Log.d(TAG, "getLyrics()"); + return mediaRetrievalService.getLyrics(subsonic.getParams(), artist, title); + } + private OkHttpClient getOkHttpClient() { CacheUtil cacheUtil = new CacheUtil(context, 60, 60 * 60 * 24 * 30); diff --git a/app/src/main/java/com/cappielloantonio/play/subsonic/api/mediaretrieval/MediaRetrievalService.java b/app/src/main/java/com/cappielloantonio/play/subsonic/api/mediaretrieval/MediaRetrievalService.java index e75d9315..46ab5886 100644 --- a/app/src/main/java/com/cappielloantonio/play/subsonic/api/mediaretrieval/MediaRetrievalService.java +++ b/app/src/main/java/com/cappielloantonio/play/subsonic/api/mediaretrieval/MediaRetrievalService.java @@ -15,4 +15,7 @@ public interface MediaRetrievalService { @GET("download") Call download(@QueryMap Map params, @Query("id") String id); + + @GET("getLyrics") + Call getLyrics(@QueryMap Map params, @Query("artist") String artist, @Query("title") String title); } diff --git a/app/src/main/java/com/cappielloantonio/play/subsonic/models/Lyrics.java b/app/src/main/java/com/cappielloantonio/play/subsonic/models/Lyrics.java index 2cb016fb..20401b64 100644 --- a/app/src/main/java/com/cappielloantonio/play/subsonic/models/Lyrics.java +++ b/app/src/main/java/com/cappielloantonio/play/subsonic/models/Lyrics.java @@ -1,66 +1,37 @@ package com.cappielloantonio.play.subsonic.models; +import com.tickaroo.tikxml.annotation.Attribute; +import com.tickaroo.tikxml.annotation.Xml; + +@Xml public class Lyrics { + @Attribute(name = "value") protected String content; + @Attribute protected String artist; + @Attribute protected String title; - /** - * Gets the value of the content property. - * - * @return possible object is - * {@link String } - */ public String getContent() { return content; } - /** - * Sets the value of the content property. - * - * @param value allowed object is - * {@link String } - */ public void setContent(String value) { this.content = value; } - /** - * Gets the value of the artist property. - * - * @return possible object is - * {@link String } - */ public String getArtist() { return artist; } - /** - * Sets the value of the artist property. - * - * @param value allowed object is - * {@link String } - */ public void setArtist(String value) { this.artist = value; } - /** - * Gets the value of the title property. - * - * @return possible object is - * {@link String } - */ public String getTitle() { return title; } - /** - * Sets the value of the title property. - * - * @param value allowed object is - * {@link String } - */ public void setTitle(String value) { this.title = value; }