Skip to content

Commit

Permalink
get personal / top albums, tracks, titles
Browse files Browse the repository at this point in the history
Signed-off-by: Conrad Hübler <Conrad.Huebler@gmx.net>
  • Loading branch information
conradhuebler committed Jan 1, 2025
1 parent 13e43f3 commit 0824768
Show file tree
Hide file tree
Showing 6 changed files with 469 additions and 97 deletions.
23 changes: 23 additions & 0 deletions qml/components/TidalApi.qml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ Item {
signal albumofArtist(var album_info)
signal topTracksofArtist(var track_info)
signal similarArtist(var artist_info)

signal favTracks(var track_info)
signal favAlbums(var album_info)
signal favArtists(var artist_info)

signal noSimilarArtists()

signal playlistTrackAdded(var track_info)
Expand Down Expand Up @@ -137,6 +142,18 @@ Item {
tidalApi.noSimilarArtists()
})

setHandler('FavAlbums', function(album_info) {
tidalApi.favAlbums(album_info)
})

setHandler('FavTracks', function(track_info) {
tidalApi.favTracks(track_info)
})

setHandler('FavArtist', function(artist_info) {
tidalApi.favArtists(artist_info)
})

// Search Handler
setHandler('addTrack', function(id, title, album, artist, image, duration) {
tidalApi.trackAdded(id, title, album, artist, image, duration)
Expand Down Expand Up @@ -379,6 +396,8 @@ Item {
// Playlist Funktionen
function getPersonalPlaylists() {
pythonTidal.call('tidal.Tidaler.getPersonalPlaylists', [])
pythonTidal.call('tidal.Tidaler.homepage', [])

}

function getPlaylistTracks(id) {
Expand All @@ -404,6 +423,10 @@ Item {
function getSimiliarArtist(artistid) {
pythonTidal.call('tidal.Tidaler.getSimiliarArtist', [artistid])
}

function getFavorits(artistid) {
pythonTidal.call('tidal.Tidaler.getFavorits', [artistid])
}
}


24 changes: 12 additions & 12 deletions qml/components/TidalCache.qml
Original file line number Diff line number Diff line change
Expand Up @@ -252,20 +252,20 @@ id: root

var result = tidalApi.getAlbumInfo(id)
if (result) {
var trackData = {
albumid: id,
var albumData = {
albumid: result.albumid,
title: result.title,
artist: result.artist,
artistid: result.artistid,
image : result.image,
image: result.image,
duration: result.duration,
num_tracks : result.num_tracks,
year : result.year,
timestamp: Date.now()
}

saveAlbumToCache(trackData)
return trackData
saveAlbumToCache(albumData)
return albumData
}

return null
Expand All @@ -286,16 +286,16 @@ id: root

var result = tidalApi.getArtistInfo(id)
if (result) {
var trackData = {
artistid: id,
var artistData = {
artistid: result.artistid,
name: result.name,
image : result.image,
bio : result.bio,
timestamp: Date.now()
image: result.image,
bio: result.bio,
timestamp: Date.now(),
}

saveAlbumToCache(trackData)
return trackData
saveArtistToCache(artistData)
return artistData
}

return null
Expand Down
2 changes: 1 addition & 1 deletion qml/pages/AlbumPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ BackgroundItem {

Component.onCompleted: {
if (albumId > 0) {
albumData = cacheManager.getAlbum(albumId)
albumData = cacheManager.getAlbumInfo(albumId)
if (!albumData) {
console.log("Album nicht im Cache gefunden:", albumId)
}
Expand Down
2 changes: 1 addition & 1 deletion qml/pages/ArtistPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ function processWimpLinks(text) {

Component.onCompleted: {
if (artistId > 0) {
artistData = cacheManager.getArtist(artistId)
artistData = cacheManager.getArtistInfo(artistId)
if (!artistData) {
console.log("Artist nicht im Cache gefunden:", artistId)
}
Expand Down
Loading

0 comments on commit 0824768

Please sign in to comment.