Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Maui
Vvave
Commits
0721692b
Commit
0721692b
authored
Mar 05, 2019
by
Camilo higuita
Browse files
push latest fixes
parent
9233ef61
Changes
14
Hide whitespace changes
Inline
Side-by-side
babe.cpp
View file @
0721692b
...
...
@@ -100,9 +100,7 @@ Babe::Babe(QObject *parent) : QObject(parent)
}
Babe
::~
Babe
()
{
}
Babe
::~
Babe
(){}
//void Babe::runPy()
...
...
@@ -446,11 +444,11 @@ QStringList Babe::defaultSources()
return
BAE
::
defaultSources
;
}
QString
Babe
::
loadCover
(
const
QString
&
url
)
void
Babe
::
loadCover
(
const
QString
&
url
)
{
auto
map
=
this
->
db
->
getDBData
(
QStringList
()
<<
url
);
if
(
map
.
isEmpty
())
return
""
;
if
(
map
.
isEmpty
())
return
;
auto
track
=
map
.
first
();
auto
artist
=
track
[
FMH
::
MODEL_KEY
::
ARTIST
];
...
...
@@ -461,51 +459,37 @@ QString Babe::loadCover(const QString &url)
auto
albumImg
=
this
->
albumArt
(
album
,
artist
);
if
(
!
albumImg
.
isEmpty
()
&&
albumImg
!=
BAE
::
SLANG
[
W
::
NONE
])
return
albumImg
;
emit
this
->
coverReady
(
albumImg
)
;
else
if
(
!
artistImg
.
isEmpty
()
&&
artistImg
!=
BAE
::
SLANG
[
W
::
NONE
])
return
artistImg
;
emit
this
->
coverReady
(
artistImg
)
;
else
return
this
->
fetchCoverArt
(
track
);
this
->
fetchCoverArt
(
track
);
}
QString
Babe
::
fetchCoverArt
(
FMH
::
MODEL
&
song
)
void
Babe
::
fetchCoverArt
(
FMH
::
MODEL
&
song
)
{
Pulpo
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
];
pulpo
.
registerServices
({
SERVICES
::
LastFm
,
SERVICES
::
Spotify
});
pulpo
.
setOntology
(
PULPO
::
ONTOLOGY
::
ALBUM
);
pulpo
.
setInfo
(
PULPO
::
INFO
::
ARTWORK
);
// auto pulpo = new Pulpo;
QEventLoop
loop
;
// 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];
QTimer
timer
;
timer
.
setSingleShot
(
true
);
timer
.
setInterval
(
1000
);
//
pulpo->registerServices({SERVICES::LastFm, SERVICES::Spotify})
;
//
pulpo->setOntology(PULPO::ONTOLOGY::ALBUM
);
//
pulpo->setInfo(PULPO::INFO::ARTWORK
);
connect
(
&
timer
,
&
QTimer
::
timeout
,
&
loop
,
&
QEventLoop
::
quit
);
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
);
}
loop
.
quit
();
});
pulpo
.
feed
(
song
,
PULPO
::
RECURSIVE
::
OFF
);
timer
.
start
();
loop
.
exec
();
timer
.
stop
();
// 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);
// }
// });
return
song
[
FMH
::
MODEL_KEY
::
ARTWORK
]
;
//
pulpo->feed(song, PULPO::RECURSIVE::OFF)
;
}
QVariantList
Babe
::
transformData
(
const
FMH
::
MODEL_LIST
&
dbList
)
...
...
babe.h
View file @
0721692b
...
...
@@ -46,7 +46,7 @@ public:
Q_INVOKABLE
QString
albumArt
(
const
QString
&
album
,
const
QString
&
artist
);
Q_INVOKABLE
QString
artistWiki
(
const
QString
&
artist
);
Q_INVOKABLE
QString
albumWiki
(
const
QString
&
album
,
const
QString
&
artist
);
Q_INVOKABLE
QString
loadCover
(
const
QString
&
url
);
Q_INVOKABLE
void
loadCover
(
const
QString
&
url
);
/**************************************/
Q_INVOKABLE
QVariantList
getFolders
();
...
...
@@ -93,7 +93,7 @@ private:
#elif defined (Q_OS_ANDROID)
// NotificationClient *nof;
#endif
QString
fetchCoverArt
(
FMH
::
MODEL
&
song
);
void
fetchCoverArt
(
FMH
::
MODEL
&
song
);
static
QVariantList
transformData
(
const
FMH
::
MODEL_LIST
&
dbList
);
void
fetchTrackLyrics
(
FMH
::
MODEL
&
song
);
...
...
@@ -109,6 +109,7 @@ signals:
void
babeIt
();
void
message
(
QString
msg
);
void
openFiles
(
QVariantList
tracks
);
void
coverReady
(
const
QString
&
path
);
};
...
...
db/collectionDB.cpp
View file @
0721692b
...
...
@@ -29,7 +29,9 @@ CollectionDB::CollectionDB(QObject *parent) : QObject(parent)
CollectionDB
::~
CollectionDB
()
{
qDebug
()
<<
"DELETING COLLECTIONDB SINGLETON"
;
this
->
m_db
.
close
();
delete
this
->
instance
;
}
CollectionDB
*
CollectionDB
::
instance
=
nullptr
;
...
...
db/collectionDB.h
View file @
0721692b
...
...
@@ -27,7 +27,6 @@ class CollectionDB : public QObject
public:
static
CollectionDB
*
getInstance
();
bool
insert
(
const
QString
&
tableName
,
const
QVariantMap
&
insertData
);
bool
update
(
const
QString
&
tableName
,
const
FMH
::
MODEL
&
updateData
,
const
QVariantMap
&
where
);
bool
update
(
const
QString
&
table
,
const
QString
&
column
,
const
QVariant
&
newValue
,
const
QVariant
&
op
,
const
QString
&
id
);
...
...
main.qml
View file @
0721692b
...
...
@@ -57,7 +57,7 @@ Maui.ApplicationWindow
/***************************************************/
/******************** PLAYBACK ********************/
/*************************************************/
property
bool
isShuffle
:
Maui
.
FM
.
loadSetting
(
"
SHUFFLE
"
,
"
PLAYBACK
"
,
false
)
property
bool
isShuffle
:
Maui
.
FM
.
loadSetting
s
(
"
SHUFFLE
"
,
"
PLAYBACK
"
,
false
)
property
var
currentTrack
:
({
babe
:
"
0
"
,
stars
:
"
0
"
...
...
@@ -102,7 +102,7 @@ Maui.ApplicationWindow
property
bool
sync
:
false
property
string
infoMsg
:
""
property
bool
infoLabels
:
bae
.
loadSetting
(
"
LABELS
"
,
"
PLAYBACK
"
,
false
)
==
"
true
"
?
true
:
false
property
bool
infoLabels
:
Maui
.
FM
.
loadSetting
s
(
"
LABELS
"
,
"
PLAYBACK
"
,
false
)
==
"
true
"
?
true
:
false
// property bool isLinked: false
// property bool isServing: false
...
...
@@ -147,10 +147,10 @@ Maui.ApplicationWindow
}
}
BabeNotify
{
id
:
babeNotify
//todo
}
//
BabeNotify
//
{
//
id: babeNotify //todo
//
}
/* UI */
...
...
@@ -996,6 +996,7 @@ Maui.ApplicationWindow
// onRefreshAlbums: H.refreshAlbums()
// onRefreshArtists: H.refreshArtists()
onCoverReady
:
console
.
log
(
"
COVER ARTWORK IS READY
"
,
path
);
onTrackLyricsReady
:
{
console
.
log
(
lyrics
)
...
...
models/albums/albumsmodel.cpp
View file @
0721692b
...
...
@@ -159,4 +159,9 @@ void AlbumsModel::append(const QVariantMap &item, const int &at)
emit
this
->
postItemAppended
();
}
void
AlbumsModel
::
refresh
()
{
this
->
setList
();
}
models/albums/albumsmodel.h
View file @
0721692b
...
...
@@ -48,6 +48,7 @@ public slots:
QVariantMap
get
(
const
int
&
index
)
const
override
;
void
append
(
const
QVariantMap
&
item
);
void
append
(
const
QVariantMap
&
item
,
const
int
&
at
);
void
refresh
();
};
#endif // ALBUMSMODEL_H
models/tracks/tracksmodel.cpp
View file @
0721692b
...
...
@@ -358,3 +358,8 @@ bool TracksModel::remove(const int &index)
return
true
;
}
void
TracksModel
::
refresh
()
{
this
->
setList
();
}
models/tracks/tracksmodel.h
View file @
0721692b
...
...
@@ -65,6 +65,7 @@ public slots:
bool
rate
(
const
int
&
index
,
const
int
&
value
);
bool
countUp
(
const
int
&
index
);
bool
remove
(
const
int
&
index
)
override
;
void
refresh
();
};
#endif // TRACKSMODEL_H
services/web/YouTube.qml
View file @
0721692b
...
...
@@ -65,7 +65,7 @@ Page
if
(
searchTxt
!==
youtubeTable
.
headBarTitle
)
{
youtubeTable
.
headBarTitle
=
searchTxt
youtube
.
getQuery
(
searchTxt
,
bae
.
loadSetting
(
"
YOUTUBELIMIT
"
,
"
BABE
"
,
25
))
youtube
.
getQuery
(
searchTxt
,
Maui
.
FM
.
loadSetting
s
(
"
YOUTUBELIMIT
"
,
"
BABE
"
,
25
))
}
}
...
...
@@ -130,7 +130,7 @@ Page
Layout.column
:
1
Layout.row
:
3
Layout.fillWidth
:
true
text
:
bae
.
loadSetting
(
"
YOUTUBEKEY
"
,
"
BABE
"
,
youtube
.
getKey
())
text
:
Maui
.
FM
.
loadSetting
s
(
"
YOUTUBEKEY
"
,
"
BABE
"
,
youtube
.
getKey
())
}
Label
...
...
@@ -152,7 +152,7 @@ Page
Layout.fillWidth
:
true
from
:
1
to
:
50
value
:
bae
.
loadSetting
(
"
YOUTUBELIMIT
"
,
"
BABE
"
,
25
)
value
:
Maui
.
FM
.
loadSetting
s
(
"
YOUTUBELIMIT
"
,
"
BABE
"
,
25
)
editable
:
true
onValueChanged
:
{
...
...
settings/BabeSettings.cpp
View file @
0721692b
...
...
@@ -73,10 +73,8 @@ BabeSettings::BabeSettings(QObject *parent) : QObject(parent)
connect
(
&
this
->
fileLoader
,
&
FileLoader
::
finished
,
[
this
](
int
size
)
{
bDebug
::
Instance
()
->
msg
(
"Finished inserting into DB "
+
QString
::
number
(
size
)
+
" tracks"
);
if
(
size
>
0
)
this
->
startBrainz
(
true
,
BAE
::
SEG
::
HALF
);
// if(size > 0)
// this->startBrainz(true, BAE::SEG::HALF);
// else
// this->startBrainz(BAE::loadSettings("AUTO", "BRAINZ", true).toBool(), BAE::SEG::TWO);
...
...
@@ -125,5 +123,5 @@ void BabeSettings::populateDB(const QStringList &paths)
if
(
path
.
startsWith
(
"file://"
))
path
.
replace
(
"file://"
,
""
);
fileLoader
.
requestPaths
(
newPaths
);
this
->
fileLoader
.
requestPaths
(
newPaths
);
}
utils/Help.js
View file @
0721692b
...
...
@@ -45,12 +45,12 @@ function setStars(stars)
function
refreshCollection
(
size
)
{
//
if(!isMobile && size>0) bae.notify("Collection updated", size+" new tracks added...")
if
(
!
isMobile
&&
size
>
0
)
bae
.
notify
(
"
Collection updated
"
,
size
+
"
new tracks added...
"
)
//
refreshTracks()
//
refreshAlbums()
//
refreshArtists()
//
refreshFolders()
refreshTracks
()
refreshAlbums
()
refreshArtists
()
refreshFolders
()
}
function
refreshFolders
()
...
...
@@ -60,27 +60,23 @@ function refreshFolders()
function
refreshTracks
()
{
tracksView
.
clearTable
()
tracksView
.
populate
()
tracksView
.
list
.
refresh
()
}
function
refreshAlbums
()
{
albumsView
.
clearGrid
()
albumsView
.
populate
(
Q
.
GET
.
allAlbumsAsc
)
albumsView
.
list
.
refresh
()
}
function
refreshArtists
()
{
artistsView
.
clearGrid
()
artistsView
.
populate
(
Q
.
GET
.
allArtistsAsc
)
artistsView
.
list
.
refresh
()
}
function
notify
(
title
,
body
)
{
if
(
isMobile
)
babeNotify
.
notify
(
title
+
"
\n
"
+
body
)
root
.
notify
(
title
+
"
\n
"
+
body
)
else
bae
.
notify
(
title
,
body
)
}
...
...
utils/Player.js
View file @
0721692b
...
...
@@ -13,14 +13,12 @@ function playTrack(index)
player
.
url
=
currentTrack
.
url
;
player
.
playing
=
true
var
artwork
=
currentTrack
.
artwork
currentArtwork
=
artwork
&&
artwork
.
length
>
0
&&
artwork
!==
"
NONE
"
?
artwork
:
bae
.
loadCover
(
currentTrack
.
url
)
currentTrack
.
artwork
=
currentArtwork
if
(
currentTrack
.
artwork
&&
currentTrack
.
artwork
.
length
&&
currentTrack
.
artwork
!==
"
NONE
"
)
currentArtwork
=
currentTrack
.
artwork
else
bae
.
loadCover
(
currentTrack
.
url
)
// currentBabe = bae.trackBabe(currentTrack.url)
progressBar
.
enabled
=
true
progressBar
.
enabled
=
true
if
(
!
isMobile
)
{
...
...
@@ -152,7 +150,7 @@ function appendTrack(track)
if
(
sync
===
true
)
{
infoMsgAnim
()
// addToPlaylist([track.url], syncPlaylist)
// addToPlaylist([track.url], syncPlaylist)
}
}
...
...
@@ -231,7 +229,9 @@ function playAll()
syncPlaylist
=
""
infoMsg
=
""
pageStack
.
currentIndex
=
0
if
(
_drawer
.
modal
&&
!
_drawer
.
visible
)
_drawer
.
visible
=
true
mainPlaylist
.
listView
.
positionViewAtBeginning
()
playAt
(
0
)
}
widgets/AlbumsView.qml
View file @
0721692b
...
...
@@ -36,17 +36,17 @@ BabeGrid
visible
:
true
// topPadding: space.large
onAlbumCoverPressed
:
albumCoverPressedAndHold
(
album
,
artist
)
headBar.visible
:
true
headBar.visible
:
count
headBarExit
:
false
headBar.leftContent
:
[
Maui.ToolButton
{
id
:
playAllBtn
visible
:
headBar
.
visible
&&
albumsViewGrid
.
count
>
0
anim
:
true
iconName
:
"
media-playlist-play
"
onClicked
:
playAll
()
},
//
Maui.ToolButton
//
{
//
id : playAllBtn
//
visible : headBar.visible && albumsViewGrid.count > 0
//
anim : true
//
iconName : "media-playlist-play"
//
onClicked : playAll()
//
},
Maui.ToolButton
{
...
...
@@ -95,17 +95,17 @@ BabeGrid
}
]
headBar.rightContent
:
[
//
headBar.rightContent: [
Maui.ToolButton
{
id
:
appendBtn
visible
:
headBar
.
visible
&&
albumsViewGrid
.
count
>
0
anim
:
true
iconName
:
"
media-playlist-append
"
//"media-repeat-track-amarok"
onClicked
:
appendAll
()
}
]
//
Maui.ToolButton
//
{
//
id: appendBtn
//
visible: headBar.visible && albumsViewGrid.count > 0
//
anim : true
//
iconName : "media-playlist-append"//"media-repeat-track-amarok"
//
onClicked: appendAll()
//
}
//
]
Maui.Dialog
{
...
...
Write
Preview
Supports
Markdown
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