예제 #1
0
/*
  * Add to existing playlist
  */
void playlistobj::AddTo(int id, int par, string name, string path, fileObj &src){

    /// Add to our playlist object
    src.set(pl_obj_count, id, par, name.c_str(), path.c_str());
    pl_obj_count++;
    if(pl_obj_count >=src.getInit()){
        src.REinitFile(src.getInit(), 100);
    }
}
예제 #2
0
void playlistobj::writeNew(fileObj &src){
    char *qryState;
        for(int i =0; i< pl_obj_count; i++){
            qryState = new char[strlen(src.getName(i))+strlen(src.getPath(i))+250];
            sprintf(qryState, "INSERT INTO playlist_items (lcl_dir_name, lcl_dir_path, lcl_dir_id, lcl_dir_par, lcl_dir_type) VALUES ('%s', '%s', '%d', '%d', '%s')",
                    src.getName(i), src.getPath(i), src.getID(i), playlistCount, "song");
        }
    writeMe(string(qryState));
    delete [] qryState;
}
예제 #3
0
/*
  *  Search any Object for a track Par by the using the ID
  */
int checkSongObjParByID(int id, fileObj& src) {
    int FinPar;
    if(src.getSize() > 0) {
        for(int i = 0; i< src.getSize(); i++) {
            if(src.getID(i) == id) {

                FinPar = src.getPar(i);
            }
        }
    }
    return FinPar;
}
예제 #4
0
/*
  *  Search any Object for a track ID by the using the parent
  */
int checkSongObjIDbyPar(int par, fileObj& src) {
    int FinID = 0;
    if(src.getSize() > 0) {
        for(int i = 0; i< src.getSize(); i++) {
            if(src.getPar(i) == par) {

                FinID = src.getID(i);
            }
        }
    }
    return FinID;
}
예제 #5
0
/*
  * Move a playlist item
  */
void playlistobj::Move(int selected, int direction,fileObj &src){

    fileObj tempPl;
    int moving =0, moveTo = 0;
    moving = src.getID(selected);

    if(direction == 0 && selected-1 > 0 && selected-1 < src.getSize()){ // move down
        moveTo = src.getID(selected--);
        tempPl.set(0, src.getID(selected--), src.getPar(selected--), src.getName(selected--), src.getPath(selected--));
        tempPl.set(1, src.getID(selected--), src.getPar(selected--), src.getName(selected--), src.getPath(selected--));

        src.set(selected--, tempPl.getID(0), tempPl.getPar(0), tempPl.getName(0), tempPl.getPath(0));
        src.set(selected++, tempPl.getID(1), tempPl.getPar(1), tempPl.getName(1), tempPl.getPath(1));
    }
    else if(direction == 1 && selected+1 > 0 && selected+1 < src.getSize()){  // move up
        moveTo = src.getID(selected++);
        tempPl.set(0, src.getID(selected++), src.getPar(selected++), src.getName(selected++), src.getPath(selected++));
        src.set(selected, tempPl.getID(0), tempPl.getPar(0), tempPl.getName(0), tempPl.getPath(0));
        src.set(selected++, tempPl.getID(1), tempPl.getPar(1), tempPl.getName(1), tempPl.getPath(1));

    }
}