diff --git a/core/library.cpp b/core/library.cpp index 3acaea75..dda82eeb 100644 --- a/core/library.cpp +++ b/core/library.cpp @@ -95,7 +95,7 @@ static void tag_track(struct library *library, const std::string &filepath) tag = ref.tag(); audio = ref.audioProperties(); - track = tags :: add_track( + track = track_add( album_find(tag->album().stripWhiteSpace().to8Bit(true), tag->year()), artist_find(tag->artist().stripWhiteSpace().to8Bit(true)), genre_find(tag->genre().stripWhiteSpace().to8Bit(true)), diff --git a/core/tags/track.cpp b/core/tags/track.cpp index 0bb55862..44a52c58 100644 --- a/core/tags/track.cpp +++ b/core/tags/track.cpp @@ -152,10 +152,10 @@ void tags :: init_track_db() db_load(&track_db); } -struct track *tags :: add_track(struct album *album, struct artist *artist, - struct genre *genre, struct library *library, - const std::string &filepath, const std::string &name, - unsigned int length, unsigned int track) +struct track *track_add(struct album *album, struct artist *artist, + struct genre *genre, struct library *library, + const std::string &filepath, const std::string &name, + unsigned int length, unsigned int track) { std::string path = filepath.substr(library->primary_key().size() + 1); if (db_get(&track_db, make_key(library, path).c_str())) diff --git a/include/core/tags/track.h b/include/core/tags/track.h index cb4854a3..bc31e02c 100644 --- a/include/core/tags/track.h +++ b/include/core/tags/track.h @@ -120,24 +120,6 @@ namespace tags /** Called to read the track_db from disk. */ void init_track_db(); - /** - * Called to create a new Track tag. - * - * @param album The album containing this track. - * @param artist The artist performing this track. - * @param genre The genre describing this track. - * @param library The library containing this track. - * @param filepath The path of this track, relative to the library root. - * @param name The name (title) of this track. - * @param length The length of this track (in seconds). - * @param track The track number of this track. - * @return A new Track tag, or NULL if this Track is already in - * the track_db. - */ - struct track *add_track(struct album *, struct artist *, struct genre *, - struct library *, const std::string &, - const std::string &, unsigned int, unsigned int); - /** * Called to remove a Track tag from the database. * @@ -165,6 +147,11 @@ namespace tags } +/* Called to add a track tag to the database. */ +struct track *track_add(struct album *, struct artist *, struct genre *, + struct library *, const std::string &, + const std::string &, unsigned int, unsigned int); + /* Called to get a track tag with a specific index. */ struct track *track_get(const unsigned int); diff --git a/tests/core/tags/track.cpp b/tests/core/tags/track.cpp index 846f742a..18b43f44 100644 --- a/tests/core/tags/track.cpp +++ b/tests/core/tags/track.cpp @@ -122,18 +122,18 @@ static void test_track_tag_lookup() unsigned int index; struct track *a, *b; - a = tags :: add_track(album, artist, genre, library, + a = track_add(album, artist, genre, library, MUSIC_DIR + "/Hyrule Symphony/13 - Legend of Zelda Medley.mp3", "Legend of Zelda Medley", 288, 13); test_not_equal(a, (struct track *)NULL); verify_track_tag(a, 1); - b = tags :: add_track(album, artist, genre, library, + b = track_add(album, artist, genre, library, MUSIC_DIR + "/Hyrule Symphony/13 - Legend of Zelda Medley.mp3", "Legend of Zelda Medley", 288, 13); test_equal(b, (struct track *)NULL); - b = tags :: add_track(album, artist, genre, library, + b = track_add(album, artist, genre, library, MUSIC_DIR + "/Hyrule Symphony/12 - Ocarina Medley.mp3", "Ocarina Medley", 232, 12); test_not_equal(b, a); @@ -160,7 +160,7 @@ static void test_track_tag_lookup() test_equal(tags :: track_size(), b->index() + 1); - a = tags :: add_track(album, artist, genre, library, + a = track_add(album, artist, genre, library, MUSIC_DIR + "/Hyrule Symphony/13 - Legend of Zelda Medley.mp3", "Legend of Zelda Medley", 288, 13); test_not_equal(a, (struct track *)NULL); @@ -176,7 +176,7 @@ static void test_track_tag_locale() { time_t rawtime = time(NULL); struct tm *now = localtime(&rawtime); - struct track *track = tags :: add_track(album, artist, genre, library, + struct track *track = track_add(album, artist, genre, library, MUSIC_DIR + "/Hyrule Symphony/6 - Kakariko Village.mp3", "Kakariko Village", 186, 6); gchar *date;