Commit 6e71fd5a authored by Camilo Higuita's avatar Camilo Higuita

fixes on some basic properties for main playlist and fix issue with taglib file name

parent e348d994
......@@ -4,7 +4,7 @@ artist TEXT ,
artwork TEXT ,
wiki TEXT,
PRIMARY KEY(artist)
) ;
);
CREATE TABLE ALBUMS
(
......@@ -14,7 +14,7 @@ artwork TEXT,
wiki TEXT,
PRIMARY KEY(album, artist),
FOREIGN KEY(artist) REFERENCES artists(artist)
) ;
);
CREATE TABLE TAGS
(
......@@ -22,38 +22,37 @@ tag TEXT NOT NULL,
context TEXT NOT NULL,
PRIMARY KEY(tag, context)
) ;
);
CREATE TABLE MOODS
(
mood TEXT PRIMARY KEY
) ;
);
CREATE TABLE PLAYLISTS
(
playlist TEXT PRIMARY KEY ,
playlist TEXT PRIMARY KEY,
adddate DATE NOT NULL
) ;
);
CREATE TABLE SOURCES_TYPES
(
id INTEGER PRIMARY KEY ,
id INTEGER PRIMARY KEY,
name TEXT NOT NULL
) ;
);
CREATE TABLE FOLDERS
(
url TEXT PRIMARY KEY,
url TEXT PRIMARY KEY,
adddate DATE NOT NULL
) ;
);
CREATE TABLE SOURCES
(
url TEXT PRIMARY KEY ,
sourcetype INTEGER NOT NULL,
FOREIGN KEY(sourcetype) REFERENCES SOURCES_TYPES(id)
) ;
);
CREATE TABLE TRACKS
(
......@@ -77,8 +76,7 @@ wiki TEXT NOT NULL,
PRIMARY KEY (url),
FOREIGN KEY(source) REFERENCES SOURCES(url),
FOREIGN KEY(album, artist) REFERENCES albums(album, artist)
) ;
);
CREATE TABLE TRACKS_MOODS
(
......@@ -86,8 +84,7 @@ mood TEXT NOT NULL ,
url TEXT NOT NULL ,
FOREIGN KEY(mood) REFERENCES MOODS(mood),
FOREIGN KEY(url) REFERENCES TRACKS(url)
) ;
);
CREATE TABLE TRACKS_TAGS
(
......@@ -97,8 +94,7 @@ url TEXT NOT NULL ,
PRIMARY KEY (tag, context, url),
FOREIGN KEY(tag, context) REFERENCES TAGS(tag, context),
FOREIGN KEY(url) REFERENCES TRACKS(url)
) ;
);
CREATE TABLE ARTISTS_TAGS
(
......@@ -108,8 +104,7 @@ artist TEXT NOT NULL ,
PRIMARY KEY (tag, context, artist),
FOREIGN KEY(tag, context) REFERENCES TAGS(tag, context),
FOREIGN KEY(artist) REFERENCES ARTISTS(artist)
) ;
);
CREATE TABLE ALBUMS_TAGS
(
......@@ -120,7 +115,7 @@ artist TEXT NOT NULL,
PRIMARY KEY (tag, context, album, artist),
FOREIGN KEY(tag, context) REFERENCES TAGS(tag, context),
FOREIGN KEY(album, artist) REFERENCES ALBUMS(album, artist)
) ;
);
CREATE TABLE PLAYLISTS_MOODS
(
......@@ -129,8 +124,7 @@ mood TEXT NOT NULL ,
PRIMARY KEY (playlist, mood),
FOREIGN KEY(playlist) REFERENCES PLAYLISTS(playlist),
FOREIGN KEY(mood) REFERENCES MOODS(mood)
) ;
);
CREATE TABLE TRACKS_PLAYLISTS
(
......@@ -140,14 +134,13 @@ adddate DATE NOT NULL,
PRIMARY KEY (playlist, url),
FOREIGN KEY(playlist) REFERENCES PLAYLISTS(playlist),
FOREIGN KEY(url) REFERENCES TRACKS(url)
) ;
);
CREATE TABLE LOG
(
id INTEGER NOT NULL,
adddate DATE NOT NULL,
PRIMARY KEY(id)
);
......
......@@ -54,13 +54,12 @@ Maui.ApplicationWindow
/******************** PLAYBACK ********************/
/*************************************************/
property bool isShuffle: Maui.FM.loadSettings("SHUFFLE","PLAYBACK", false)
readonly property var currentTrack: mainlistEmpty? ({url: "", artwork: "", fav: "0", stars: "0"}) : mainPlaylist.table.listModel.get(currentTrackIndex)
property var currentTrack: mainlistEmpty? ({url: "", artwork: "", fav: "0", stars: "0"}) : mainPlaylist.table.listModel.get(currentTrackIndex)
property int currentTrackIndex: -1
property int prevTrackIndex: 0
readonly property string currentArtwork: currentTrack.artwork
readonly property bool currentBabe: currentTrack.fav == "0" ? false : true
property alias durationTimeLabel: player.duration
property string progressTimeLabel: player.transformTime((player.duration/1000) *(player.pos/ 1000))
......@@ -523,11 +522,10 @@ Maui.ApplicationWindow
id: babeBtnIcon
icon.name: "love"
enabled: currentTrackIndex >= 0
icon.color: currentBabe ? babeColor : Kirigami.Theme.textColor
icon.color: currentTrack.fav == "0" ? babeColor : Kirigami.Theme.textColor
onClicked: if (!mainlistEmpty)
{
mainPlaylist.list.fav(currentTrackIndex, !(mainPlaylist.listModel.get(currentTrackIndex).fav == "1"))
currentBabe = mainPlaylist.listModel.get(currentTrackIndex).fav == "1"
}
},
......
......@@ -32,7 +32,7 @@ static inline QList<QUrl> getPathContents(QList<QUrl> &urls, const QUrl &url)
// returns the number of new items added to the collection db
static inline uint getTracks(const QList<QUrl>& paths)
{
auto db = CollectionDB::getInstance();
const auto db = CollectionDB::getInstance();
const auto urls = std::accumulate(paths.begin(), paths.end(), QList<QUrl>(), getPathContents);
for(const auto &path : paths)
......@@ -53,6 +53,8 @@ static inline uint getTracks(const QList<QUrl>& paths)
if(info.isNull())
continue;
qDebug()<< url << "HHH";
const auto track = info.getTrack();
const auto genre = info.getGenre();
const auto album = BAE::fixString(info.getAlbum());
......@@ -62,7 +64,6 @@ static inline uint getTracks(const QList<QUrl>& paths)
const auto duration = info.getDuration();
const auto year = info.getYear();
FMH::MODEL trackMap =
{
{FMH::MODEL_KEY::URL, url.toString()},
......
......@@ -27,7 +27,8 @@ TagInfo::TagInfo(const QString &url, QObject *parent) : QObject(parent)
if(_file.isReadable())
{
this->file = new TagLib::FileRef(TagLib::FileName(this->path.toStdWString().c_str()));
qDebug()<< "is readble";
this->file = new TagLib::FileRef(path.toUtf8());
}
else
this->file = new TagLib::FileRef();
......@@ -36,12 +37,12 @@ TagInfo::TagInfo(const QString &url, QObject *parent) : QObject(parent)
TagInfo::~TagInfo()
{
qDebug()<< "DELETING TAGINFO";
// delete this->file;
delete this->file;
}
bool TagInfo::isNull()
{
return this->file->isNull() && this->file->tag() == nullptr ;
return this->file->isNull();
}
QString TagInfo::getAlbum() const
......
......@@ -379,11 +379,10 @@ Maui.Page
icon.height: Maui.Style.iconSizes.big
icon.name: "love"
enabled: currentTrackIndex >= 0
icon.color: currentBabe ? babeColor : Kirigami.Theme.textColor
icon.color: currentTrack.fav == "0" ? babeColor : Kirigami.Theme.textColor
onClicked: if (!mainlistEmpty)
{
mainPlaylist.list.fav(currentTrackIndex, !(mainPlaylist.list.get(currentTrackIndex).fav == "1"))
currentBabe = mainPlaylist.list.get(currentTrackIndex).fav == "1"
}
},
......
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