Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disliked filter for playlists, albums and home songs #5221

Merged
merged 49 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
f188151
album dislike filter
aneesh1122 Jan 12, 2025
da8c55a
local playlist dislike filter
aneesh1122 Jan 12, 2025
f289218
home songs dislike filter
aneesh1122 Jan 12, 2025
599be9a
fixing playnext in home songs
aneesh1122 Jan 12, 2025
fc0f2ca
added messages for disliked songs
aneesh1122 Jan 12, 2025
5078113
added messages when collection exist in disliked
aneesh1122 Jan 13, 2025
2513784
online playlists dislike filter
aneesh1122 Jan 13, 2025
5637813
fixed some minot bugs about dislike filters and modern landscape play…
aneesh1122 Jan 13, 2025
178411e
fixed shuffle for floating shuffle button
aneesh1122 Jan 13, 2025
a6e942a
fixed dislike filter for radio button
aneesh1122 Jan 13, 2025
5788c10
stops mesh gradient when app is put on background and restarts when t…
aneesh1122 Jan 14, 2025
a954150
added an option to disable swipe in modern player
aneesh1122 Jan 14, 2025
799de98
added control buttons in new lyrics layout for landscape mode
aneesh1122 Jan 14, 2025
e54913c
added control buttons in new lyrics layout for landscape mode
aneesh1122 Jan 14, 2025
f62af10
fixed only for landscape condition
aneesh1122 Jan 14, 2025
f9a7ff1
fixed button rotation in controls
aneesh1122 Jan 15, 2025
3b95d35
added an option to delete songs which are not in the library
aneesh1122 Jan 17, 2025
700db66
added an option to delete songs which are not in the library
aneesh1122 Jan 17, 2025
2a2758e
Merge branch 'fast4x:master' into delete-disliked-songs-from-radio
aneesh1122 Jan 17, 2025
03052dc
Added a dialog box which shows the live progress of songs deletion.
aneesh1122 Jan 17, 2025
d131d30
Added a dialog box which shows the live progress of songs deletion.
aneesh1122 Jan 17, 2025
3da8e5e
minor change in the string
aneesh1122 Jan 17, 2025
9583ea0
Merge branch 'master' into delete-disliked-songs-from-radio
aneesh1122 Jan 18, 2025
a9524df
fixing conflicts
aneesh1122 Jan 18, 2025
059763d
youtube radio fixes
aneesh1122 Jan 18, 2025
486e22e
youtube radio fixes
aneesh1122 Jan 18, 2025
5b03b78
added a message when there are no songs to delete
aneesh1122 Jan 18, 2025
7df6fbf
fixing pinned icon
aneesh1122 Jan 18, 2025
c8d3b3d
get Album Version
aneesh1122 Jan 18, 2025
2e38bdc
the function will always replace videos on the basis of their positio…
aneesh1122 Jan 18, 2025
5bfdfb3
added a dialog when songs are being matched in a local playlist
aneesh1122 Jan 18, 2025
19b60c1
delete song from the playlist instead of the database
aneesh1122 Jan 18, 2025
2bfcbc4
added some filter conditions for improved song matching
aneesh1122 Jan 18, 2025
0095e07
clean prefix title for matching
aneesh1122 Jan 18, 2025
e66fb4e
clean prefix title for matching
aneesh1122 Jan 18, 2025
a937483
improved matching
aneesh1122 Jan 19, 2025
023598e
improved matching and code cleanup
aneesh1122 Jan 19, 2025
1e43a3c
minor fixes
aneesh1122 Jan 19, 2025
fe16138
minor fixes
aneesh1122 Jan 19, 2025
d67177a
minor fixes
aneesh1122 Jan 20, 2025
255b624
Merge branch 'fast4x:master' into delete-disliked-songs-from-radio
aneesh1122 Jan 20, 2025
4421b17
more fixes
aneesh1122 Jan 20, 2025
9b0b524
Merge remote-tracking branch 'origin/delete-disliked-songs-from-radio…
aneesh1122 Jan 20, 2025
02ce8b5
1)new sorting option
aneesh1122 Jan 20, 2025
53a6837
added lazy column to individual song matching
aneesh1122 Jan 21, 2025
88054bc
minor fixes
aneesh1122 Jan 21, 2025
3374e30
minor fixes
aneesh1122 Jan 21, 2025
b792947
added explicit icon in song matching dialog box
aneesh1122 Jan 21, 2025
17d438a
added like icon in song matching dialog box
aneesh1122 Jan 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions composeApp/src/androidMain/kotlin/it/fast4x/rimusic/Database.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1341,6 +1341,9 @@ interface Database {
@Query("SELECT likedAt FROM Song WHERE id = :songId")
fun likedAt(songId: String): Flow<Long?>

@Query("SELECT likedAt FROM Song WHERE id = :songId")
fun getLikedAt(songId: String): Long?

@Query("UPDATE Album SET bookmarkedAt = :bookmarkedAt WHERE id = :id")
fun bookmarkAlbum(id: String, bookmarkedAt: Long?): Int

Expand Down Expand Up @@ -1988,6 +1991,18 @@ interface Database {
""")
fun sortSongsFromPlaylistByDuration( id: Long ): Flow<List<SongEntity>>

@Query("""
SELECT DISTINCT S.*, Album.title as albumTitle, Format.contentLength as contentLength
FROM Song S
INNER JOIN songplaylistmap SP ON S.id = SP.songId
LEFT JOIN SongAlbumMap ON SongAlbumMap.songId = S.id
LEFT JOIN Album ON Album.id = SongAlbumMap.albumId
LEFT JOIN Format ON Format.songId = S.id
WHERE SP.playlistId = :id
ORDER BY S.thumbnailUrl
""")
fun sortSongsFromPlaylistByUrl( id: Long ): Flow<List<SongEntity>>

@Query("""
SELECT DISTINCT S.*, A.title as albumTitle, Format.contentLength as contentLength
FROM Song S
Expand Down Expand Up @@ -2050,6 +2065,7 @@ interface Database {
PlaylistSongSortBy.Duration -> sortSongsFromPlaylistByDuration( id )
PlaylistSongSortBy.DateLiked -> sortSongsFromPlaylistByLikedAt( id )
PlaylistSongSortBy.DateAdded -> sortSongsFromPlaylistByRowId( id )
PlaylistSongSortBy.UnmatchedSongs -> sortSongsFromPlaylistByUrl(id)
}.map {
it.run {
if( sortOrder == SortOrder.Descending )
Expand All @@ -2067,6 +2083,10 @@ interface Database {
@Query("SELECT SP.position FROM Song S INNER JOIN songplaylistmap SP ON S.id=SP.songId WHERE SP.playlistId=:id AND S.id NOT LIKE '$LOCAL_KEY_PREFIX%' ORDER BY SP.position")
fun songsPlaylistMap(id: Long): Flow<List<Int>>

@Transaction
@Query("SELECT id FROM SONG WHERE likedAt IS NOT NULL AND likedAt < 0")
fun dislikedSongsById(): Flow<List<String>>

@SuppressWarnings(RoomWarnings.QUERY_MISMATCH)
@Transaction
@Query("SELECT id, name, browseId, (SELECT COUNT(*) FROM SongPlaylistMap WHERE playlistId = id) as songCount FROM Playlist WHERE id=:id")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ enum class PlaylistSongSortBy(

DateLiked( R.string.sort_date_liked, R.drawable.heart ),

DateAdded( R.string.sort_date_added, R.drawable.time );
DateAdded( R.string.sort_date_added, R.drawable.time ),

UnmatchedSongs( R.string.unmatched, R.drawable.alert );

override val titleId: Int
get() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,11 @@ fun SwipeableQueueItem(
val onFavourite: () -> Unit = {
mediaItemToggleLike(mediaItem)
val message: String
if( likedAt != null ) {
val mTitle: String = mediaItem.mediaMetadata.title?.toString() ?: ""
val mArtist: String = mediaItem.mediaMetadata.artist?.toString() ?: ""

val mTitle: String = mediaItem.mediaMetadata.title?.toString() ?: ""
val mArtist: String = mediaItem.mediaMetadata.artist?.toString() ?: ""
if(likedAt == -1L) {
message = "\"$mTitle - $mArtist\" ${context.resources.getString(R.string.removed_from_disliked)}"
} else if( likedAt != null ) {
message = "\"$mTitle - $mArtist\" ${context.resources.getString(R.string.removed_from_favorites)}"
} else
message = context.resources.getString(R.string.added_to_favorites)
Expand Down Expand Up @@ -251,10 +252,11 @@ fun SwipeablePlaylistItem(
val onFavourite: () -> Unit = {
mediaItemToggleLike(mediaItem)
val message: String
if( likedAt != null ) {
val mTitle: String = mediaItem.mediaMetadata.title?.toString() ?: ""
val mArtist: String = mediaItem.mediaMetadata.artist?.toString() ?: ""

val mTitle: String = mediaItem.mediaMetadata.title?.toString() ?: ""
val mArtist: String = mediaItem.mediaMetadata.artist?.toString() ?: ""
if(likedAt == -1L) {
message = "\"$mTitle - $mArtist\" ${context.resources.getString(R.string.removed_from_disliked)}"
} else if ( likedAt != null ) {
message = "\"$mTitle - $mArtist\" ${context.resources.getString(R.string.removed_from_favorites)}"
} else
message = context.resources.getString(R.string.added_to_favorites)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import it.fast4x.rimusic.ui.components.themed.SmartMessage
import it.fast4x.rimusic.appContext
import it.fast4x.rimusic.ui.components.tab.toolbar.Descriptive
import it.fast4x.rimusic.ui.components.tab.toolbar.MenuIcon
import it.fast4x.rimusic.utils.formatAsDuration

class ImportSongsFromCSV private constructor(
private val launcher: ManagedActivityResultLauncher<Array<String>, Uri?>
Expand All @@ -38,18 +39,19 @@ class ImportSongsFromCSV private constructor(
Database.asyncTransaction {
beforeTransaction( index, row )
/**/
val mediaId = row["MediaId"]
val title = row["Title"]
val explicitPrefix = if (row["Explicit"] == "true") "e:" else ""
val pseudoMediaId = (row["Track Name"]+row["Artist Name(s)"]).filter { it.isLetterOrDigit() }
val title = row["Title"] ?: row["Track Name"] ?: return@asyncTransaction
val mediaId = row["MediaId"] ?: pseudoMediaId
val artistsText = row["Artists"] ?: row["Artist Name(s)"] ?: ""
val durationText = row["Duration"] ?: formatAsDuration(row["Track Duration (ms)"]?.toLong() ?: 0L)

if( mediaId == null || title == null)
return@asyncTransaction

val song = Song (
val song = Song(
id = mediaId,
title = title,
artistsText = row["Artists"],
durationText = row["Duration"],
thumbnailUrl = row["ThumbnailUrl"],
title = explicitPrefix+title,
artistsText = artistsText,
durationText = durationText,
thumbnailUrl = row["ThumbnailUrl"] ?: "",
totalPlayTimeMs = 1L
)
afterTransaction( index, song )
Expand Down
Loading