Library Tag: Make root_path private
And just change the name of the variable to "_path". Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
f83765d11e
commit
01e514736e
|
@ -177,7 +177,7 @@ void library :: update(Library *library)
|
|||
};
|
||||
|
||||
if (library) {
|
||||
scan.path = library->root_path;
|
||||
scan.path = library->primary_key();
|
||||
idle :: schedule(validate_library, library);
|
||||
idle :: schedule(scan_path, scan);
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ Track :: Track() : library(NULL), artist(NULL), album(NULL), genre(NULL){}
|
|||
Track :: Track(const std::string &f, Library *l)
|
||||
: library(l), artist(NULL), album(NULL), genre(NULL),
|
||||
play_count(0), last_year(0), last_month(0), last_day(0),
|
||||
filepath(f.substr(l->root_path.size() + 1))
|
||||
filepath(f.substr(l->primary_key().size() + 1))
|
||||
{
|
||||
library->count++;
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ bool Track :: tag()
|
|||
|
||||
const std::string Track :: path() const
|
||||
{
|
||||
return library->root_path + "/" + filepath;
|
||||
return library->primary_key() + "/" + filepath;
|
||||
}
|
||||
|
||||
void Track :: played()
|
||||
|
|
|
@ -10,22 +10,22 @@ Library :: Library()
|
|||
}
|
||||
|
||||
Library :: Library(const std::string &s)
|
||||
: root_path(s), count(0), enabled(true)
|
||||
: _path(s), count(0), enabled(true)
|
||||
{
|
||||
}
|
||||
|
||||
const std::string Library :: primary_key() const
|
||||
{
|
||||
return root_path;
|
||||
return _path;
|
||||
}
|
||||
|
||||
void Library :: read(File &f)
|
||||
{
|
||||
f >> enabled;
|
||||
root_path = f.getline();
|
||||
_path = f.getline();
|
||||
}
|
||||
|
||||
void Library :: write(File &f)
|
||||
{
|
||||
f << enabled << " " << root_path;
|
||||
f << enabled << " " << _path;
|
||||
}
|
||||
|
|
|
@ -11,9 +11,10 @@
|
|||
* Library tag
|
||||
*/
|
||||
class Library : public DatabaseEntry {
|
||||
private:
|
||||
std::string _path; /**< Path to the root directory of this library. */
|
||||
|
||||
public:
|
||||
/** Path to the directory containing this library's audio files */
|
||||
std::string root_path;
|
||||
/** Number of tracks in this library */
|
||||
unsigned int count;
|
||||
/** True if the library is enabled, false otherwise */
|
||||
|
|
|
@ -46,7 +46,7 @@ static void list_path(Library *lib)
|
|||
row[c_cols.c_id] = lib->index();
|
||||
row[c_cols.c_enabled] = lib->enabled;
|
||||
row[c_cols.c_size] = lib->count;
|
||||
row[c_cols.c_path] = lib->root_path;
|
||||
row[c_cols.c_path] = lib->primary_key();
|
||||
}
|
||||
|
||||
static void remove_banned_tracks()
|
||||
|
|
|
@ -10,7 +10,7 @@ static void test_library_tag()
|
|||
Library library("/home/Zelda/Music");
|
||||
File f("library_tag", 0);
|
||||
|
||||
test_equal(library.root_path, (std::string)"/home/Zelda/Music");
|
||||
test_equal(library.primary_key(), (std::string)"/home/Zelda/Music");
|
||||
test_equal(library.count, (unsigned)0);
|
||||
test_equal(library.enabled, true);
|
||||
|
||||
|
@ -21,7 +21,7 @@ static void test_library_tag()
|
|||
f.close();
|
||||
|
||||
library = Library();
|
||||
test_equal(library.root_path, (std::string)"");
|
||||
test_equal(library.primary_key(), (std::string)"");
|
||||
test_equal(library.count, (unsigned)0);
|
||||
test_equal(library.enabled, false);
|
||||
|
||||
|
@ -29,7 +29,7 @@ static void test_library_tag()
|
|||
library.read(f);
|
||||
f.close();
|
||||
|
||||
test_equal(library.root_path, (std::string)"/home/Zelda/Music");
|
||||
test_equal(library.primary_key(), (std::string)"/home/Zelda/Music");
|
||||
test_equal(library.count, (unsigned)0);
|
||||
test_equal(library.enabled, true);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue