Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Maui
Vvave
Commits
62680ef1
Commit
62680ef1
authored
Mar 05, 2019
by
Camilo higuita
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
start working on fixing pulpo for rc
parent
0721692b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
22 deletions
+50
-22
babe.cpp
babe.cpp
+17
-17
main.qml
main.qml
+8
-2
models/tracks/tracksmodel.cpp
models/tracks/tracksmodel.cpp
+21
-0
models/tracks/tracksmodel.h
models/tracks/tracksmodel.h
+2
-1
widgets/MainPlaylist/MainPlaylist.qml
widgets/MainPlaylist/MainPlaylist.qml
+2
-2
No files found.
babe.cpp
View file @
62680ef1
...
...
@@ -469,27 +469,27 @@ void Babe::loadCover(const QString &url)
void
Babe
::
fetchCoverArt
(
FMH
::
MODEL
&
song
)
{
//
auto pulpo = new Pulpo;
auto
pulpo
=
new
Pulpo
;
//
if(BAE::artworkCache(song, FMH::MODEL_KEY::ALBUM))
return
song[FMH::MODEL_KEY::ARTWORK];
//
if(BAE::artworkCache(song, FMH::MODEL_KEY::ARTIST))
return
song[FMH::MODEL_KEY::ARTWORK];
if
(
BAE
::
artworkCache
(
song
,
FMH
::
MODEL_KEY
::
ALBUM
))
emit
this
->
coverReady
(
song
[
FMH
::
MODEL_KEY
::
ARTWORK
]
)
;
if
(
BAE
::
artworkCache
(
song
,
FMH
::
MODEL_KEY
::
ARTIST
))
emit
this
->
coverReady
(
song
[
FMH
::
MODEL_KEY
::
ARTWORK
]
)
;
//
pulpo->registerServices({SERVICES::LastFm, SERVICES::Spotify});
//
pulpo->setOntology(PULPO::ONTOLOGY::ALBUM);
//
pulpo->setInfo(PULPO::INFO::ARTWORK);
pulpo
->
registerServices
({
SERVICES
::
LastFm
,
SERVICES
::
Spotify
});
pulpo
->
setOntology
(
PULPO
::
ONTOLOGY
::
ALBUM
);
pulpo
->
setInfo
(
PULPO
::
INFO
::
ARTWORK
);
//
connect(
&
pulpo, &Pulpo::infoReady, [&](const FMH::MODEL &track,const PULPO::RESPONSE &res)
//
{
//
Q_UNUSED(track);
//
if(!res[PULPO::ONTOLOGY::ALBUM][PULPO::INFO::ARTWORK].isEmpty())
//
{
//
auto artwork = res[PULPO::ONTOLOGY::ALBUM][PULPO::INFO::ARTWORK][PULPO::CONTEXT::IMAGE].toByteArray();
//
BAE::saveArt(song, artwork, BAE::CachePath);
//
emit this->coverReady(
artwork
);
//
}
//
});
connect
(
pulpo
,
&
Pulpo
::
infoReady
,
[
&
](
const
FMH
::
MODEL
&
track
,
const
PULPO
::
RESPONSE
&
res
)
{
Q_UNUSED
(
track
);
if
(
!
res
[
PULPO
::
ONTOLOGY
::
ALBUM
][
PULPO
::
INFO
::
ARTWORK
].
isEmpty
())
{
auto
artwork
=
res
[
PULPO
::
ONTOLOGY
::
ALBUM
][
PULPO
::
INFO
::
ARTWORK
][
PULPO
::
CONTEXT
::
IMAGE
].
toByteArray
();
BAE
::
saveArt
(
song
,
artwork
,
BAE
::
CachePath
);
emit
this
->
coverReady
(
song
[
FMH
::
MODEL_KEY
::
ARTWORK
]
);
}
});
//
pulpo->feed(song, PULPO::RECURSIVE::OFF);
pulpo
->
feed
(
song
,
PULPO
::
RECURSIVE
::
OFF
);
}
QVariantList
Babe
::
transformData
(
const
FMH
::
MODEL_LIST
&
dbList
)
...
...
main.qml
View file @
62680ef1
...
...
@@ -613,7 +613,7 @@ Maui.ApplicationWindow
modal
:
!
root
.
isWide
handleVisible
:
false
closePolicy
:
Popup
.
NoAutoClose
contentItem
:
MainPlaylist
{
id
:
mainPlaylist
...
...
@@ -996,7 +996,13 @@ Maui.ApplicationWindow
// onRefreshAlbums: H.refreshAlbums()
// onRefreshArtists: H.refreshArtists()
onCoverReady
:
console
.
log
(
"
COVER ARTWORK IS READY
"
,
path
);
onCoverReady
:
{
root
.
currentArtwork
=
path
currentTrack
.
artwork
=
currentArtwork
mainPlaylist
.
list
.
update
(
currentTrack
,
currentTrackIndex
);
}
onTrackLyricsReady
:
{
console
.
log
(
lyrics
)
...
...
models/tracks/tracksmodel.cpp
View file @
62680ef1
...
...
@@ -363,3 +363,24 @@ void TracksModel::refresh()
{
this
->
setList
();
}
bool
TracksModel
::
update
(
const
QVariantMap
&
data
,
const
int
&
index
)
{
if
(
index
>=
this
->
list
.
size
()
||
index
<
0
)
return
false
;
auto
newData
=
this
->
list
[
index
];
QVector
<
int
>
roles
;
for
(
auto
key
:
data
.
keys
())
if
(
newData
[
FMH
::
MODEL_NAME_KEY
[
key
]]
!=
data
[
key
].
toString
())
{
newData
.
insert
(
FMH
::
MODEL_NAME_KEY
[
key
],
data
[
key
].
toString
());
roles
<<
FMH
::
MODEL_NAME_KEY
[
key
];
}
this
->
list
[
index
]
=
newData
;
emit
this
->
updateModel
(
index
,
roles
);
return
true
;
}
models/tracks/tracksmodel.h
View file @
62680ef1
#
ifndef
TRACKSMODEL_H
#ifndef TRACKSMODEL_H
#define TRACKSMODEL_H
#include <QObject>
...
...
@@ -66,6 +66,7 @@ public slots:
bool
countUp
(
const
int
&
index
);
bool
remove
(
const
int
&
index
)
override
;
void
refresh
();
bool
update
(
const
QVariantMap
&
data
,
const
int
&
index
)
override
;
};
#endif // TRACKSMODEL_H
widgets/MainPlaylist/MainPlaylist.qml
View file @
62680ef1
...
...
@@ -150,8 +150,8 @@ Maui.Page
list
.
appendQuery
(
query
);
}
if
(
autoplay
)
Player
.
playAt
(
0
)
//
if(autoplay)
//
Player.playAt(0)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment