-
-
Notifications
You must be signed in to change notification settings - Fork 324
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix artist items continuation (#1689)
* add `gridContinuation` support to show all albums on `ArtistItemsScreen` * fix artist songs continuation * removed duplicate and unused code from `ArtistItemsContinuationPage`
- Loading branch information
Showing
5 changed files
with
50 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 1 addition & 39 deletions
40
innertube/src/main/java/com/zionhuang/innertube/pages/ArtistItemsContinuationPage.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,8 @@ | ||
package com.zionhuang.innertube.pages | ||
|
||
import com.zionhuang.innertube.models.Album | ||
import com.zionhuang.innertube.models.Artist | ||
import com.zionhuang.innertube.models.MusicResponsiveListItemRenderer | ||
import com.zionhuang.innertube.models.SongItem | ||
import com.zionhuang.innertube.models.YTItem | ||
import com.zionhuang.innertube.models.oddElements | ||
import com.zionhuang.innertube.utils.parseTime | ||
|
||
data class ArtistItemsContinuationPage( | ||
val items: List<YTItem>, | ||
val continuation: String?, | ||
) { | ||
companion object { | ||
fun fromMusicResponsiveListItemRenderer(renderer: MusicResponsiveListItemRenderer): SongItem? { | ||
return SongItem( | ||
id = renderer.playlistItemData?.videoId ?: return null, | ||
title = renderer.flexColumns.firstOrNull() | ||
?.musicResponsiveListItemFlexColumnRenderer?.text | ||
?.runs?.firstOrNull()?.text ?: return null, | ||
artists = renderer.flexColumns.getOrNull(1)?.musicResponsiveListItemFlexColumnRenderer?.text?.runs?.oddElements()?.map { | ||
Artist( | ||
name = it.text, | ||
id = it.navigationEndpoint?.browseEndpoint?.browseId | ||
) | ||
} ?: return null, | ||
album = renderer.flexColumns.getOrNull(2)?.musicResponsiveListItemFlexColumnRenderer?.text?.runs?.firstOrNull()?.let { | ||
Album( | ||
name = it.text, | ||
id = it.navigationEndpoint?.browseEndpoint?.browseId ?: return null | ||
) | ||
}, | ||
duration = renderer.fixedColumns?.firstOrNull() | ||
?.musicResponsiveListItemFlexColumnRenderer?.text | ||
?.runs?.firstOrNull() | ||
?.text?.parseTime() ?: return null, | ||
thumbnail = renderer.thumbnail?.musicThumbnailRenderer?.getThumbnailUrl() ?: return null, | ||
explicit = renderer.badges?.find { | ||
it.musicInlineBadgeRenderer?.icon?.iconType == "MUSIC_EXPLICIT_BADGE" | ||
} != null, | ||
endpoint = renderer.overlay?.musicItemThumbnailOverlayRenderer?.content?.musicPlayButtonRenderer?.playNavigationEndpoint?.watchEndpoint | ||
) | ||
} | ||
} | ||
} | ||
) |