IndexerTrack will now keep the standard presort value to be used when updating a track.

This commit is contained in:
Daniel Önnerby 2009-01-04 23:39:51 +00:00
parent 70e5d7fb57
commit 274809a4ca
2 changed files with 6 additions and 2 deletions

View File

@ -55,6 +55,7 @@ using namespace musik::core;
IndexerTrack::IndexerTrack(DBINT id)
:meta(NULL)
,id(id)
,tempSortOrder(0)
{
}
@ -206,7 +207,7 @@ bool IndexerTrack::Save(db::Connection &dbConnection,utfstring libraryDirectory,
//////////////////////////////////////////////////////////////////////////////
// 1. Start by inserting as many tags as possible into the tracks-table
{
db::CachedStatement stmt("INSERT OR REPLACE INTO tracks (id,track,bpm,duration,filesize,year,folder_id,title,filename,filetime) VALUES (?,?,?,?,?,?,?,?,?,?)",dbConnection);
db::CachedStatement stmt("INSERT OR REPLACE INTO tracks (id,track,bpm,duration,filesize,year,folder_id,title,filename,filetime,sort_order1) VALUES (?,?,?,?,?,?,?,?,?,?,?)",dbConnection);
// Bind all "static" tags (the once that are in the tracks tables)
stmt.BindTextUTF(1,this->GetValue("track"));
@ -218,6 +219,7 @@ bool IndexerTrack::Save(db::Connection &dbConnection,utfstring libraryDirectory,
stmt.BindTextUTF(7,this->GetValue("title"));
stmt.BindTextUTF(8,this->GetValue("filename"));
stmt.BindTextUTF(9,this->GetValue("filetime"));
stmt.BindInt(10,this->tempSortOrder);
if(this->id!=0){
stmt.BindInt(0,this->id);
@ -551,7 +553,7 @@ bool IndexerTrack::GetTrackMetadata(db::Connection &db){
db::Statement genres("SELECT g.name FROM genres g,track_genres tg WHERE tg.genre_id=g.id AND tg.track_id=? ORDER BY tg.id",db);
db::Statement artists("SELECT ar.name FROM artists ar,track_artists ta WHERE ta.artist_id=ar.id AND ta.track_id=? ORDER BY ta.id",db);
db::Statement allMetadata("SELECT mv.content,mk.name FROM meta_values mv,meta_keys mk,track_meta tm WHERE tm.track_id=? AND tm.meta_value_id=mv.id AND mv.meta_key_id=mk.id ORDER BY tm.id",db);
db::Statement track("SELECT t.track,t.bpm,t.duration,t.filesize,t.year,t.title,t.filename,t.thumbnail_id,p.path||f.relative_path||'/'||t.filename,al.name,t.filetime FROM tracks t,folders f,paths p,albums al WHERE t.id=? AND t.folder_id=f.id AND f.path_id=p.id AND t.album_id=al.id",db);
db::Statement track("SELECT t.track,t.bpm,t.duration,t.filesize,t.year,t.title,t.filename,t.thumbnail_id,p.path||f.relative_path||'/'||t.filename,al.name,t.filetime,t.sort_order1 FROM tracks t,folders f,paths p,albums al WHERE t.id=? AND t.folder_id=f.id AND f.path_id=p.id AND t.album_id=al.id",db);
track.BindInt(0,this->id);
if(track.Step()==db::Row){
@ -566,6 +568,7 @@ bool IndexerTrack::GetTrackMetadata(db::Connection &db){
this->SetValue("path",track.ColumnTextUTF(8));
this->SetValue("album",track.ColumnTextUTF(9));
this->SetValue("filetime",track.ColumnTextUTF(10));
this->tempSortOrder = track.ColumnInt(11);
// genres
genres.BindInt(0,this->id);

View File

@ -78,6 +78,7 @@ class IndexerTrack : public Track {
private:
// The variables
DBINT id;
DBINT tempSortOrder;
private:
class MetaData{
public: