Пример #1
0
lastfm::Album
lastfm::Track::album( Corrections corrected ) const
{
    if ( corrected == Corrected && !d->correctedAlbum.isEmpty() )
        return Album( artist( corrected ), d->correctedAlbum );

    return Album( artist( corrected ), d->album );
}
Пример #2
0
status_t
CDDBData::Load()
{
	// This uses the default R5 path

	BPath path;
	if (find_directory(B_USER_DIRECTORY, &path, true) != B_OK)
		return B_ERROR;

	path.Append("cd");
	create_directory(path.Path(), 0755);

	BString filename(path.Path());
	filename << "/" << Artist() << " - " << Album();

	if (filename.Compare("Artist") == 0)
		filename << "." << DiscID();

	BEntry entry(filename.String());
	if (entry.InitCheck() != B_OK)
		return entry.InitCheck();

	entry_ref ref;
	entry.GetRef(&ref);

	return Load(ref);
}
Пример #3
0
/* mpd functions */
bool Mpd::update(mpd_tag_type type, const char *value) {
    mpd_pair *pair;
    album.clear();

    if (!mpd_search_db_tags(conn, MPD_TAG_ALBUM)) { err(); return false; }

    if (strcmp(value, "") != 0)
        if (!mpd_search_add_tag_constraint(conn, MPD_OPERATOR_DEFAULT, type, value)) { err(); return false; }

    if (!mpd_search_commit(conn)) { err(); return false; }

    while ((pair = mpd_recv_pair_tag(conn, MPD_TAG_ALBUM)) != NULL) {
        album.push_back(Album(pair->value));
        mpd_return_pair(conn, pair);
    }

    if (mpd_connection_get_error(conn) != MPD_ERROR_SUCCESS) { err(); return false; }

    if (!mpd_response_finish(conn)) { err(); return false; }

    cout << "Successful Update" << endl;
    for (std::vector<Album>::iterator i = album.begin(); i != album.end(); ++i)
        i->buildTags();
    sys->sortAlbums(MPD_TAG_UNKNOWN);
    for (std::vector<Album>::iterator i = album.begin(); i != album.end(); ++i)
        i->build();
    return true;
}
Пример #4
0
std::vector<Album> Connection::parse_albums(std::vector<std::string> ret){
	std::vector<Album> tmp_albums;
	for(int i=0; i<ret.size()-1; i++){
		std::cout << "Size of ret[" << i << "]: " << ret[i].size() << std::endl;
		std::cout << "ret[" << i << "]: " << ret[i] << std::endl;
		tmp_albums.push_back(Album(this, ret[i].substr(7).c_str()));
	}
	return tmp_albums;
} // Tested
Пример #5
0
AlbumList ArtistBrowse::albums() const
{
    int count = albumCount();
    AlbumList list;
    for (int i = 0; i < count; ++i)
        list << Album(sp_artistbrowse_album(handle(), i));

    return list;
}
Пример #6
0
status_t
CDDBData::Save()
{
	// This uses the default R5 path

	BPath path;
	if (find_directory(B_USER_DIRECTORY, &path, true) != B_OK)
		return B_ERROR;

	path.Append("cd");
	create_directory(path.Path(), 0755);

	BString filename(path.Path());
	filename << "/" << Artist() << " - " << Album();

	if (filename.Compare("Artist")==0)
		filename << "." << DiscID();

	return Save(filename.String());
}
Пример #7
0
Album Search::albumAt(int index) const
{
    return isValid() ? Album(sp_search_album(handle(), index)) : Album();
}
Пример #8
0
Album ArtistBrowse::albumAt(int index) const
{
    return isValid() ? Album(sp_artistbrowse_album(handle(), index)) : Album();
}