Skip to content

Commit

Permalink
Fixed maxrave-dev#457 - No album in Playlist Songs
Browse files Browse the repository at this point in the history
  • Loading branch information
maxrave-dev committed Jul 28, 2024
1 parent f6f7b73 commit 15ee3c8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ import com.maxrave.kotlinytmusicscraper.models.SectionListRenderer
import com.maxrave.kotlinytmusicscraper.models.response.BrowseResponse
import com.maxrave.kotlinytmusicscraper.models.response.SearchResponse
import com.maxrave.kotlinytmusicscraper.pages.PodcastItem
import com.maxrave.simpmusic.R
import com.maxrave.simpmusic.data.db.entities.SetVideoIdEntity
import com.maxrave.simpmusic.data.model.browse.album.Track
import com.maxrave.simpmusic.data.model.browse.playlist.Author
import com.maxrave.simpmusic.data.model.browse.playlist.PlaylistBrowse
import com.maxrave.simpmusic.data.model.podcast.PodcastBrowse
import com.maxrave.simpmusic.data.model.searchResult.playlists.PlaylistsResult
import com.maxrave.simpmusic.data.model.searchResult.songs.Album
import com.maxrave.simpmusic.data.model.searchResult.songs.Artist
import com.maxrave.simpmusic.data.model.searchResult.songs.Thumbnail

Expand Down Expand Up @@ -105,7 +107,14 @@ fun parsePlaylistData(
val listTrack: MutableList<Track> = arrayListOf()
for (content in listContent){
val track = Track(
album = null,
album = content.musicResponsiveListItemRenderer?.menu?.menuRenderer?.items?.find {
it.menuNavigationItemRenderer?.icon?.iconType == "ALBUM"
}?.let {
Album(
id = it.menuNavigationItemRenderer?.navigationEndpoint?.browseEndpoint?.browseId ?: return null,
name = context.getString(R.string.album)
)
},
artists = content.musicResponsiveListItemRenderer?.let {
parseSongArtists(
it,
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/res/layout/fragment_album.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@
android:layout_height="wrap_content"
android:layout_marginTop="5sp"
android:fontFamily="@font/roboto"
android:text="@string/year_and_category"
android:textSize="15sp"
android:textStyle="normal" />

Expand Down Expand Up @@ -210,7 +209,6 @@
android:maxLines="10"
app:expandAction="More"
app:limitedMaxLines="3"
app:originalText="@string/demo_description"
android:fontFamily="@font/roboto"
android:textStyle="normal"
android:textSize="15sp" />
Expand All @@ -222,7 +220,6 @@
android:layout_marginTop="5sp"
android:layout_marginBottom="5sp"
android:fontFamily="@font/roboto"
android:text="@string/album_length"
android:textSize="15sp"
android:textStyle="bold" />
</LinearLayout>
Expand Down
4 changes: 0 additions & 4 deletions app/src/main/res/layout/fragment_playlist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
<TextView
android:id="@+id/tvTitle"
style="@style/album_name"
android:text="Playlist"
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
Expand Down Expand Up @@ -102,7 +101,6 @@
android:layout_height="wrap_content"
android:layout_marginTop="5sp"
android:fontFamily="@font/roboto"
android:text="@string/year_and_category"
android:textSize="15sp"
android:textStyle="normal" />

Expand Down Expand Up @@ -199,7 +197,6 @@
app:expandAction="@string/more"
app:expandActionColor="@color/md_theme_dark_outlineVariant"
app:limitedMaxLines="3"
app:originalText="@string/demo_description"
android:fontFamily="@font/roboto"
android:textStyle="normal"
android:textSize="15sp" />
Expand All @@ -211,7 +208,6 @@
android:layout_marginTop="5sp"
android:layout_marginBottom="5sp"
android:fontFamily="@font/roboto"
android:text="@string/album_length"
android:textSize="15sp"
android:textStyle="bold" />
</LinearLayout>
Expand Down

0 comments on commit 15ee3c8

Please sign in to comment.