Append album cover file identifiers to audio file identifiers.
This commit is contained in:
parent
2867fe3637
commit
14fa1d71d9
@ -179,6 +179,25 @@ FileId AudiosManager::get_audio_thumbnail_file_id(FileId file_id) const {
|
||||
return audio->thumbnail.file_id;
|
||||
}
|
||||
|
||||
void AudiosManager::append_audio_album_cover_file_ids(FileId file_id, vector<FileId> &file_ids) const {
|
||||
if (td_->auth_manager_->is_bot()) {
|
||||
return;
|
||||
}
|
||||
auto audio = get_audio(file_id);
|
||||
CHECK(audio != nullptr);
|
||||
|
||||
auto append_album_cover = [&](bool is_small) {
|
||||
auto r_file_id =
|
||||
td_->file_manager_->get_audio_thumbnail_file_id(audio->title, audio->performer, is_small, DialogId());
|
||||
if (r_file_id.is_ok()) {
|
||||
file_ids.push_back(r_file_id.ok());
|
||||
}
|
||||
};
|
||||
|
||||
append_album_cover(true);
|
||||
append_album_cover(false);
|
||||
}
|
||||
|
||||
void AudiosManager::delete_audio_thumbnail(FileId file_id) {
|
||||
auto &audio = audios_[file_id];
|
||||
CHECK(audio != nullptr);
|
||||
|
@ -48,6 +48,8 @@ class AudiosManager {
|
||||
|
||||
FileId get_audio_thumbnail_file_id(FileId file_id) const;
|
||||
|
||||
void append_audio_album_cover_file_ids(FileId file_id, vector<FileId> &file_ids) const;
|
||||
|
||||
void delete_audio_thumbnail(FileId file_id);
|
||||
|
||||
FileId dup_audio(FileId new_id, FileId old_id);
|
||||
|
@ -69,6 +69,10 @@ void Document::append_file_ids(const Td *td, vector<FileId> &file_ids) const {
|
||||
if (animated_thumbnail_file_id.is_valid()) {
|
||||
file_ids.push_back(animated_thumbnail_file_id);
|
||||
}
|
||||
|
||||
if (type == Type::Audio) {
|
||||
td->audios_manager_->append_audio_album_cover_file_ids(file_id, file_ids);
|
||||
}
|
||||
}
|
||||
|
||||
bool operator==(const Document &lhs, const Document &rhs) {
|
||||
|
Loading…
Reference in New Issue
Block a user