Skip to content

Commit

Permalink
more nice things
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 Dec 29, 2024
1 parent 643d2f4 commit e066880
Show file tree
Hide file tree
Showing 14 changed files with 372 additions and 445 deletions.
3 changes: 0 additions & 3 deletions qml/components/MediaController.qml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ Item {
metadata[Mpris.metadataToString(Mpris.Title)] = track
metadata[Mpris.metadataToString(Mpris.Artist)] = artist
metadata[Mpris.metadataToString(Mpris.Album)] = album
console.log("mpris", track)
mprisPlayer.metadata = metadata
}
}
Expand Down Expand Up @@ -179,8 +178,6 @@ Item {
Connections {
target: tidalApi
onCurrentPlayback: {
console.log("current track info media controller")
console.log("track", trackinfo.title)
current_track_title = trackinfo.title
current_track_artist = trackinfo.artist
current_track_album = trackinfo.album
Expand Down
17 changes: 10 additions & 7 deletions qml/components/PlaylistManager.qml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ Item {

setHandler('currentTrack', function(id, position) {
console.log("Current track in playlist is", id, position)
root.currentIndex = position

root.currentTrackChanged(id)
root.currentId(id)
currentTrack(position)
Expand Down Expand Up @@ -168,6 +170,11 @@ Item {
playlistPython.clearPlayList()
}

// Öffentliche Funktionen
function play() {
playlistPython.playPosition(0)
}

function appendTrack(id) {
console.log("PlaylistManager.appendTrack", id)
playlistPython.appendTrack(id)
Expand All @@ -183,11 +190,8 @@ Item {
}

function requestPlaylistItem(index) {
console.log("Request PlaylistTrack", index)
var id = playlistPython.call_sync("playlistmanager.PL.TidalId", [index])
console.log("Got TidalId", id)
root.tidalId = id
console.log("Current playlist tidalid and size", root.tidalId, root.size)
return id
}

Expand Down Expand Up @@ -227,7 +231,7 @@ Item {

function nextTrack() {
console.log("Next track called")
if(mediaPlayer.playbackState !== 1) {
if(mediaController.playbackState !== 1) {
playlistPython.canNext = false
playlistPython.nextTrack()
}
Expand All @@ -236,14 +240,13 @@ Item {

function nextTrackClicked() {
console.log("Next track called")
mediaPlayer.blockAutoNext = true
mediaController.blockAutoNext = true
playlistPython.canNext = false
playlistPython.nextTrack()
currentTrackIndex()
}

function restartTrack(id) {
console.log(id)
playlistPython.restartTrack()
currentTrackIndex()
}
Expand All @@ -256,7 +259,7 @@ Item {

function previousTrackClicked() {
playlistPython.canNext = false
mediaPlayer.blockAutoNext = true
mediaController.blockAutoNext = true
playlistPython.previousTrack()
currentTrackIndex()
}
Expand Down
17 changes: 15 additions & 2 deletions qml/components/TidalApi.qml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Item {
signal playurl(string url)
signal currentPlayback(var trackinfo)
signal cacheTrack(var track_info)
signal playlistTrackAdded(var track_info)

// Properties für die Suche
property string artistsResults
Expand All @@ -52,6 +53,7 @@ Item {
property bool playlists: true

property bool loginTrue: false
property bool loading: false

property string playlist_track: ""
property string playlist_artist: ""
Expand Down Expand Up @@ -105,7 +107,6 @@ Item {
//})

setHandler('cacheTrack', function(track_info) {
console.log("add track to cache")
tidalApi.cacheTrack(track_info)
})

Expand Down Expand Up @@ -209,6 +210,18 @@ Item {
searchResults(playlist)
})

setHandler('loadingStarted', function() {
root.loading = true
})

setHandler('loadingFinished', function() {
root.loading = false
})

setHandler('playlistTrackAdded', function(track_info) {
root.playlistTrackAdded(track_info)
})

importModule('tidal', function() {
console.log("Tidal module imported successfully")
})
Expand Down Expand Up @@ -345,7 +358,7 @@ Item {
}

function getPlaylistTracks(id) {
pythonTidal.call('tidal.Tidaler.get_playlist_tracks', [id])
pythonTidal.call('tidal.Tidaler.getPlaylistTracks', [id])
}

function playPlaylist(id) {
Expand Down
1 change: 0 additions & 1 deletion qml/components/TidalCache.qml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ id: root

onCacheTrack: {
//track_info
console.log("cache track info", track_info.title)
saveTrackToCache({
id: track_info.id,
title: track_info.title,
Expand Down
7 changes: 6 additions & 1 deletion qml/harbour-tidalplayer.qml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ ApplicationWindow
onCurrentTrackChanged: {
if (track) {
tidalApi.playTrackId(track)
console.log("playlistmanager call id", track)
}
}
}
Expand Down Expand Up @@ -92,6 +91,12 @@ ApplicationWindow
mprisPlayer.setCanControl(true)
}

BusyIndicator {
size: BusyIndicatorSize.Large
anchors.centerIn: parent
running: tidalApi.loading
}

Connections {
target: tidalApi
onOAuthSuccess: {
Expand Down
22 changes: 19 additions & 3 deletions qml/pages/FirstPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ Page {
}
}

/*MenuItem {
text: qsTr("Playlist")
onClicked: {
pageStack.push(Qt.resolvedUrl("TrackList.qml"))
}
}*/

MenuItem {
text: minPlayerPanel.open ? "Hide player" : "Show player"
Expand All @@ -50,7 +56,7 @@ Page {
top: parent.top
}
iconArray: ["image://theme/icon-m-home", "image://theme/icon-m-search", "image://theme/icon-m-media-playlists"]
textArray: [qsTr("Home"), qsTr("Search"), qsTr("Playlist")]
textArray: [qsTr("Personal Page"), qsTr("Search"), qsTr("Playlist")]
}

SlideshowView {
Expand All @@ -66,7 +72,7 @@ Page {
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: miniPlayerPanel.top
property var carouselPages: ["Personal.qml", "Search.qml", "PlaylistPage.qml"]
property var carouselPages: ["Personal.qml", "Search.qml", "TrackList.qml"]
property int initialPage: 0
model: carouselPages.length
Component.onCompleted: currentIndex = initialPage
Expand All @@ -76,7 +82,17 @@ Page {
height: swipeView.height
source: swipeView.carouselPages[index]
asynchronous: true
}

onLoaded: {
if (index === 2) { // TrackList
item.title = ""
item.type = "current"
if (playlistManager.size > 0) {
playlistManager.generateList()
}
}
}
}
}
}
}
Loading

0 comments on commit e066880

Please sign in to comment.