Skip to content

Commit

Permalink
add missing package to rpm
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 Feb 27, 2024
1 parent 103a099 commit 26fb4b9
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 19 deletions.
46 changes: 39 additions & 7 deletions qml/harbour-tidalplayer.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import "pages/widgets"
ApplicationWindow
{
property bool loginTrue : false
property var locale: Qt.locale()
property date currentDate: new Date()
property MiniPlayer minPlayerPanel : miniPlayerPanel

ConfigurationValue {
Expand Down Expand Up @@ -175,7 +177,7 @@ ApplicationWindow
}

function appendTrack(id) {
console.log(id)
console.log("appended", id)
call('playlistmanager.PL.AppendTrack', [id], {});
canNext = true
}
Expand Down Expand Up @@ -207,7 +209,7 @@ ApplicationWindow
}

function insertTrack(id) {
console.log(id)
console.log("inserted", id)

call('playlistmanager.PL.InsertTrack', [id], {});
}
Expand Down Expand Up @@ -371,6 +373,7 @@ ApplicationWindow

refresh_token.value = rtoken
expiry_time.value = date
console.log(expiry_time)
loginTrue = true
pythonApi.loginSuccess()
pythonApi.loginIn()
Expand All @@ -397,12 +400,16 @@ ApplicationWindow
mediaPlayer.play()
});

setHandler('insertTrack', function(id)
{
console.log("inserted to PL", id)
playlistManager.insertTrack(id)
});

setHandler('addTracktoPL', function(id)
{
console.log(id)
//pythonApi.playAlbumTracks(id)
console.log("appended to PL", id)
playlistManager.appendTrack(id)
//playlistManager.playPosition(0)
});

setHandler('fillFinished', function()
Expand Down Expand Up @@ -440,7 +447,24 @@ ApplicationWindow

function loginIn() {
console.log("Want login now")
call('tidal.Tidaler.login', [token_type.value, access_token.value, refresh_token.value, expiry_time.value], {});
//console.log(expiry_time.value)
//console.log(currentDate.toLocaleString(locale, "yyyy-MM-ddThh:mm:ss"))
//print(Date.fromLocaleString(locale, expiry_time.value, "yyyy-MM-ddThh:mm:ss"));
//console.log(Date.fromLocaleString(locale, expiry_time.value, "yyyy-MM-ddThh:mm:ss") < currentDate)
if(Date.fromLocaleString(locale, expiry_time.value, "yyyy-MM-ddThh:mm:ss") > currentDate)
{
console.log("Valid login time");
//console.log(token_type.value, access_token.value, refresh_token.value, expiry_time.value);
call('tidal.Tidaler.login', [token_type.value, access_token.value, refresh_token.value, expiry_time.value], {});
}
else
{
console.log("inValid login time");
//console.log(token_type.value, refresh_token.value, refresh_token.value, expiry_time.value);
call('tidal.Tidaler.login', [token_type.value, refresh_token.value, refresh_token.value, expiry_time.value], {});
console.log("Need to renew login")
}

}

function genericSearch(text) {
Expand All @@ -450,7 +474,15 @@ ApplicationWindow

function playTrackId(id)
{
call("tidal.Tidaler.getTrackUrl", [id], {});
call("tidal.Tidaler.getTrackUrl", [id], function(name)
{
print(name[0], name[1])
console.log(name)
if(typeof name === 'undefined')
console.log(typeof name)
else
console.log(typeof name)
});
}


Expand Down
2 changes: 1 addition & 1 deletion qml/pages/FirstPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Page {
id: searchString
width: parent.width
placeholderText: "Type and Search"
text: "Cover"
text: ""
label: "Please wait for login ..."
EnterKey.enabled: text.length > 0
EnterKey.iconSource: "image://theme/icon-m-search"
Expand Down
9 changes: 6 additions & 3 deletions qml/pages/Personal.qml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ Page {
source: model.image
}
Column{
Row{
Label
{
id: trackName
Expand All @@ -68,7 +67,7 @@ Page {
color: Theme.highlightColor
text: model.num_tracks + " Tracks (" + dur + ")"
}
}

Label
{
id: descriptionLabel
Expand All @@ -88,7 +87,11 @@ Page {

}
}

onClicked:
{
//tracklistpage = pageStack.push(Qt.resolvedUrl("TrackList.qml"))
//tracklistpage.
}
}
anchors.fill: parent

Expand Down
18 changes: 10 additions & 8 deletions qml/tidal.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,9 @@ def login(self, token_type, access_token, refresh_token, expiry_time):
self.session.load_oauth_session(token_type, access_token)
if self.session.check_login() == True:
pyotherside.send("oauth_login_success")
else:
if access_token == refresh_token:
self.session.load_oauth_session(token_type, refresh_token)
if self.session.check_login() == True:
pyotherside.send("oauth_login_success")
pyotherside.send("oauth_updated", self.session.token_type, self.session.access_token, self.session.refresh_token, self.session.expiry_time)
else:
pyotherside.send("oauth_login_failed")
pyotherside.send("oauth_updated", self.session.token_type, self.session.access_token, self.session.refresh_token, self.session.expiry_time)

def request_oauth(self):
self.login, self.future = self.session.login_oauth()
Expand All @@ -49,6 +45,7 @@ def getTrackInfo(self, id):
except AttributeError:
pyotherside.send("trackInfo", i.id, i.name, i.album.name, i.artist.name, "", i.duration)


def getAlbumInfo(self, id):
i = self.session.album(int(id))
try:
Expand Down Expand Up @@ -116,6 +113,7 @@ def getTrackUrl(self, id):
pyotherside.send("currentTrackInfo", t.name, t.track_num, t.album.name, t.artist.name, t.duration, t.album.image(320), t.artist.image(320))
except AttributeError:
pyotherside.send("currentTrackInfo", t.name, t.track_num, t.album.name, t.artist.name, t.duration, "", "")
return t.name, t.track_num

def getAlbumTracks(self, id):
album = self.session.album(int(id))
Expand Down Expand Up @@ -163,8 +161,12 @@ def getPersonalPlaylist(self, id):

def playPlaylist(self, id):
playlist = self.session.playlist(id)
for i in playlist.tracks():
pyotherside.send("addTracktoPL", i.id)
pyotherside.send("insertTrack", playlist.tracks()[0].id)
for i, item in enumerate(playlist.tracks()):
# if i == 0:
# pyotherside.send("insertTrack", item.id)
# else:
pyotherside.send("addTracktoPL", item.id)
pyotherside.send("fillFinished")

Tidaler = Tidal()
Expand Down
1 change: 1 addition & 0 deletions rpm/harbour-tidalplayer.spec
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Requires: python3-requests
Requires: python3-future
Requires: python3-dateutil
Requires: python3-six
Requires: mpris-qt5-qml-plugin
BuildRequires: pkgconfig(sailfishapp) >= 1.0.2
BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(Qt5Qml)
Expand Down

0 comments on commit 26fb4b9

Please sign in to comment.