Commit 55f9aecd authored by Camilo Higuita's avatar Camilo Higuita

update for merge

parents 3747ff09 4651330e
...@@ -16,7 +16,7 @@ CONFIG += c++11 ...@@ -16,7 +16,7 @@ CONFIG += c++11
linux:unix:!android { linux:unix:!android {
QT += webkit QT += webengine
message(Building for Linux KDE) message(Building for Linux KDE)
include(kde/kde.pri) include(kde/kde.pri)
...@@ -124,12 +124,6 @@ HEADERS += \ ...@@ -124,12 +124,6 @@ HEADERS += \
#TAGLIB #TAGLIB
linux:unix:!macx:!android {
message(Searching local TagLib lib)
LIBS += -ltag
} else:android {
message(Building TagLib for Android)
DEPENDPATH += 3rdparty/taglib DEPENDPATH += 3rdparty/taglib
DEPENDPATH += 3rdparty/taglib/ape DEPENDPATH += 3rdparty/taglib/ape
...@@ -388,9 +382,6 @@ HEADERS += \ ...@@ -388,9 +382,6 @@ HEADERS += \
3rdparty/taglib/config.h \ 3rdparty/taglib/config.h \
3rdparty/taglib/taglib_config.h \ 3rdparty/taglib/taglib_config.h \
}
#INCLUDEPATH += /usr/include/python3.6m #INCLUDEPATH += /usr/include/python3.6m
#LIBS += -lpython3.6m #LIBS += -lpython3.6m
......
...@@ -30,6 +30,10 @@ CollectionDB::CollectionDB(QObject *parent) : QObject(parent) ...@@ -30,6 +30,10 @@ CollectionDB::CollectionDB(QObject *parent) : QObject(parent)
if(!BAE::fileExists(BAE::CollectionDBPath + BAE::DBName)) if(!BAE::fileExists(BAE::CollectionDBPath + BAE::DBName))
{ {
QDir collectionDBPath_dir(BAE::CollectionDBPath);
if (!collectionDBPath_dir.exists())
collectionDBPath_dir.mkpath(".");
this->openDB(this->name); this->openDB(this->name);
qDebug()<<"Collection doesn't exists, trying to create it" << BAE::CollectionDBPath + BAE::DBName; qDebug()<<"Collection doesn't exists, trying to create it" << BAE::CollectionDBPath + BAE::DBName;
this->prepareCollectionDB(); this->prepareCollectionDB();
...@@ -733,6 +737,9 @@ DB_LIST CollectionDB::getOnlineTracks(const KEY &orderBy, const BAE::W &order) ...@@ -733,6 +737,9 @@ DB_LIST CollectionDB::getOnlineTracks(const KEY &orderBy, const BAE::W &order)
QStringList CollectionDB::getSourcesFolders() QStringList CollectionDB::getSourcesFolders()
{ {
auto data = this->getDBData("select * from folders order by strftime(\"%s\", addDate) desc"); auto data = this->getDBData("select * from folders order by strftime(\"%s\", addDate) desc");
if(data.isEmpty()) return QStringList();
return this->dataToList(data, BAE::KEY::URL); return this->dataToList(data, BAE::KEY::URL);
} }
......
...@@ -11,7 +11,8 @@ ...@@ -11,7 +11,8 @@
#ifdef Q_OS_ANDROID #ifdef Q_OS_ANDROID
#include "./3rdparty/kirigami/src/kirigamiplugin.h" #include "./3rdparty/kirigami/src/kirigamiplugin.h"
#include <QtWebView/QtWebView> #include <QtWebView/QtWebView>
//#include "java/notificationclient.h" #else
#include <QtWebEngine>
#endif #endif
#include "utils/bae.h" #include "utils/bae.h"
...@@ -76,8 +77,9 @@ int main(int argc, char *argv[]) ...@@ -76,8 +77,9 @@ int main(int argc, char *argv[])
#ifdef Q_OS_ANDROID #ifdef Q_OS_ANDROID
KirigamiPlugin::getInstance().registerTypes(); KirigamiPlugin::getInstance().registerTypes();
QtWebView::initialize(); QtWebView::initialize();
//#else #else
// QQuickStyle::setStyle("Universal"); QQuickStyle::setStyle("nomad");
QtWebEngine::initialize();
#endif #endif
engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
......
...@@ -203,7 +203,7 @@ Kirigami.ApplicationWindow ...@@ -203,7 +203,7 @@ Kirigami.ApplicationWindow
visible: true visible: true
currentIndex: currentView currentIndex: currentView
// onSettingsViewClicked: settingsDrawer.visible ? settingsDrawer.close() : settingsDrawer.open() onSettingsViewClicked: settingsDrawer.visible ? settingsDrawer.close() : settingsDrawer.open()
onTracksViewClicked: onTracksViewClicked:
{ {
...@@ -533,12 +533,12 @@ Kirigami.ApplicationWindow ...@@ -533,12 +533,12 @@ Kirigami.ApplicationWindow
z: -999 z: -999
} }
// globalDrawer: SettingsView globalDrawer: SettingsView
// { {
// id: settingsDrawer id: settingsDrawer
// // contentItem.implicitWidth: columnWidth // contentItem.implicitWidth: columnWidth
// onIconSizeChanged: toolBarIconSize = size onIconSizeChanged: toolBarIconSize = size
// } }
Item Item
{ {
......
...@@ -74,6 +74,10 @@ ...@@ -74,6 +74,10 @@
<file>widgets/SearchView/SearchSuggestions.qml</file> <file>widgets/SearchView/SearchSuggestions.qml</file>
<file>services/web/YouTube.qml</file> <file>services/web/YouTube.qml</file>
<file>services/web/YoutubeViewer.qml</file> <file>services/web/YoutubeViewer.qml</file>
<file>services/web/YoutubeViewer_A.qml</file> <file>services/web/YoutubePlayer.qml</file>
<file>services/web/YoutubeHelper.js</file>
<file>services/web/YoutubePlayer_A.qml</file>
<file>services/web/WebView.qml</file>
<file>services/web/WebView_A.qml</file>
</qresource> </qresource>
</RCC> </RCC>
...@@ -5,50 +5,44 @@ ...@@ -5,50 +5,44 @@
#include <QByteArray> #include <QByteArray>
#include <QObject> #include <QObject>
#if (defined (Q_OS_LINUX) && !defined (Q_OS_ANDROID))
#include <taglib/tag.h>
#include <taglib/fileref.h>
#endif
#if defined(Q_OS_ANDROID)
#include <./3rdparty/taglib/tag.h> #include <./3rdparty/taglib/tag.h>
#include <./3rdparty/taglib/fileref.h> #include <./3rdparty/taglib/fileref.h>
#endif
namespace TagLib { namespace TagLib
class FileRef; {
class FileRef;
} }
class TagInfo : public QObject class TagInfo : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
TagInfo(QObject *parent = nullptr); TagInfo(QObject *parent = nullptr);
~TagInfo(); ~TagInfo();
bool feed(const QString &url); bool feed(const QString &url);
QString getAlbum() const; QString getAlbum() const;
QString getTitle() const; QString getTitle() const;
QString getArtist() const; QString getArtist() const;
int getTrack() const; int getTrack() const;
QString getGenre() const; QString getGenre() const;
QString fileName() const; QString fileName() const;
QString getComment() const; QString getComment() const;
QByteArray getCover() const; QByteArray getCover() const;
int getDuration() const; int getDuration() const;
uint getYear() const; uint getYear() const;
void setAlbum(const QString &album) ; void setAlbum(const QString &album) ;
void setTitle(const QString &title); void setTitle(const QString &title);
void setTrack(const int &track); void setTrack(const int &track);
void setArtist(const QString &artist); void setArtist(const QString &artist);
void setGenre(const QString &genre); void setGenre(const QString &genre);
void setComment(const QString &comment); void setComment(const QString &comment);
void setCover(const QByteArray &array); void setCover(const QByteArray &array);
private: private:
TagLib::FileRef file; TagLib::FileRef file;
QString path; QString path;
}; };
#endif // TAGINFO_H #endif // TAGINFO_H
import QtQuick 2.0
import QtWebEngine 1.5
import "../../utils/Player.js" as Player
WebEngineView
{
id: webView
onLoadingChanged:
{
if (loadRequest.errorString)
console.error(loadRequest.errorString);
}
onRecentlyAudibleChanged:
{
console.log("is playing", recentlyAudible)
if(recentlyAudible && isPlaying)
{
wasPlaying = isPlaying
Player.pauseTrack()
}
if(!recentlyAudible && wasPlaying)
Player.resumeTrack()
}
}
import QtQuick 2.0
import QtWebView 1.1
import "../../utils/Player.js" as Player
WebView
{
id: webView
onLoadingChanged:
{
if (loadRequest.errorString)
console.error(loadRequest.errorString);
}
}
var player, timer, timeSpent = [], display = document.getElementById('display');
function onYouTubeIframeAPIReady() {
player = new YT.Player( 'player', {
events: { 'onStateChange': onPlayerStateChange }
});
}
function onPlayerStateChange(event) {
if(event.data === 1) { // Started playing
if(!timeSpent.length){
timeSpent = new Array( parseInt(player.getDuration()) );
}
timer = setInterval(record,100);
} else {
clearInterval(timer);
}
}
function record(){
timeSpent[ parseInt(player.getCurrentTime()) ] = true;
showPercentage();
}
function showPercentage(){
var percent = 0;
for(var i=0, l=timeSpent.length; i<l; i++){
if(timeSpent[i]) percent++;
}
percent = Math.round(percent / timeSpent.length * 100);
console.log(percent + "%");
}
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import "../../view_models"
import QtWebEngine 1.5
import "../../utils/Player.js" as Player
import "YoutubeHelper.js" as YTH
WebEngineView
{
id: webView
anchors.fill: parent
visible: true
property bool wasPlaying: false
onLoadingChanged:
{
if (loadRequest.errorString)
console.error(loadRequest.errorString);
}
onRecentlyAudibleChanged:
{
console.log("is playing", recentlyAudible)
if(recentlyAudible && isPlaying)
Player.pauseTrack()
if(!recentlyAudible && wasPlaying)
Player.resumeTrack()
}
}
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import "../../view_models"
import QtWebView 1.1
import "../../utils/Player.js" as Player
import "YoutubeHelper.js" as YTH
WebView
{
id: webView
anchors.fill: parent
visible: false
clip: true
property bool wasPlaying: false
onLoadingChanged:
{
if (loadRequest.errorString)
console.error(loadRequest.errorString);
}
// onRecentlyAudibleChanged:
// {
// console.log("is playing", recentlyAudible)
// if(recentlyAudible && isPlaying)
// Player.pauseTrack()
// if(!recentlyAudible && wasPlaying)
// Player.resumeTrack()
// }
}
import QtQuick 2.9
import QtWebView 1.1
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import "../../view_models"
BabePopup
{
id: videoPlayback
property alias webView: webView
WebView
{
id: webView
anchors.fill: parent
onLoadingChanged: {
if (loadRequest.errorString)
console.error(loadRequest.errorString);
}
}
}
...@@ -48,12 +48,9 @@ BabeSettings::BabeSettings(QObject *parent) : QObject(parent) ...@@ -48,12 +48,9 @@ BabeSettings::BabeSettings(QObject *parent) : QObject(parent)
} }
#endif #endif
QDir collectionDBPath_dir(BAE::CollectionDBPath);
QDir cachePath_dir(BAE::CachePath); QDir cachePath_dir(BAE::CachePath);
QDir youtubeCache_dir(BAE::YoutubeCachePath); QDir youtubeCache_dir(BAE::YoutubeCachePath);
if (!collectionDBPath_dir.exists())
collectionDBPath_dir.mkpath(".");
if (!cachePath_dir.exists()) if (!cachePath_dir.exists())
cachePath_dir.mkpath("."); cachePath_dir.mkpath(".");
if (!youtubeCache_dir.exists()) if (!youtubeCache_dir.exists())
...@@ -88,10 +85,10 @@ BabeSettings::BabeSettings(QObject *parent) : QObject(parent) ...@@ -88,10 +85,10 @@ BabeSettings::BabeSettings(QObject *parent) : QObject(parent)
{ {
bDebug::Instance()->msg("Finished inserting into DB "+QString::number(size)+" tracks"); bDebug::Instance()->msg("Finished inserting into DB "+QString::number(size)+" tracks");
bDebug::Instance()->msg("Starting Brainz with interval: " + QString::number(BAE::SEG::ONEHALF)); bDebug::Instance()->msg("Starting Brainz with interval: " + QString::number(BAE::SEG::ONEHALF));
this->startBrainz(true, BAE::SEG::ONEHALF); this->startBrainz(true, BAE::SEG::HALF);
}else }else
this->startBrainz(BAE::loadSettings("BRAINZ", "BABE", false).toBool(), BAE::SEG::THREE); this->startBrainz(BAE::loadSettings("BRAINZ", "BABE", false).toBool(), BAE::SEG::TWO);
emit refreshTables(size); emit refreshTables(size);
}); });
......
...@@ -29,7 +29,7 @@ function playTrack(track) ...@@ -29,7 +29,7 @@ function playTrack(track)
bae.notifySong(currentTrack.url) bae.notifySong(currentTrack.url)
} }
// bae.trackLyrics(currentTrack.url) bae.trackLyrics(currentTrack.url)
// root.mainPlaylist.infoView.wikiAlbum = bae.albumWiki(root.mainPlaylist.currentTrack.album,root.mainPlaylist.currentTrack.artist) // root.mainPlaylist.infoView.wikiAlbum = bae.albumWiki(root.mainPlaylist.currentTrack.album,root.mainPlaylist.currentTrack.artist)
// root.mainPlaylist.infoView.wikiArtist = bae.artistWiki(root.mainPlaylist.currentTrack.artist) // root.mainPlaylist.infoView.wikiArtist = bae.artistWiki(root.mainPlaylist.currentTrack.artist)
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#define BABE_VERSION_STR "0.1.0" #define BABE_VERSION_STR "0.1.0"
#define BABE_VERSION KDE_MAKE_VERSION(@BABE_MAJOR_VERSION@,@BABE_MINOR_VERSION@,@BABE_PATCH_VERSION@) #define BABE_VERSION KDE_MAKE_VERSION(0,1,0)
using namespace std; using namespace std;
...@@ -54,6 +54,7 @@ inline bool isMobile() ...@@ -54,6 +54,7 @@ inline bool isMobile()
enum SEG enum SEG
{ {
HALF = 500,
ONE = 1000, ONE = 1000,
ONEHALF = 1500, ONEHALF = 1500,
TWO = 2000, TWO = 2000,
......
...@@ -198,14 +198,11 @@ Item ...@@ -198,14 +198,11 @@ Item
iconName: "videoclip-amarok" iconName: "videoclip-amarok"
onClicked: onClicked:
{ {
if(youtube.getQuery(currentTrack.title+" "+currentTrack.artist)) youtubeView.openVideo = 1
{ youtube.getQuery(currentTrack.title+" "+currentTrack.artist)
pageStack.currentIndex = 1 pageStack.currentIndex = 1
currentView = viewsIndex.youtube currentView = viewsIndex.youtube
}
} }
} }
} }
......
...@@ -19,6 +19,7 @@ BabeTable ...@@ -19,6 +19,7 @@ BabeTable
section.criteria: ViewSection.FullString section.criteria: ViewSection.FullString
section.delegate: BabeDelegate section.delegate: BabeDelegate
{ {
id: delegate
label: section label: section
isSection: true isSection: true
boldLabel: true boldLabel: true
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment