Skip to content

Commit

Permalink
Support album art from audio CD tracks
Browse files Browse the repository at this point in the history
When copying metdata objects, copy existing albumart too.
Also handle retrieving the albumart file for repo == RT_CD.
  • Loading branch information
hambre committed Jan 3, 2024
1 parent e040555 commit 6abb8ac
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
19 changes: 18 additions & 1 deletion mythtv/libs/libmythmetadata/musicmetadata.cpp
Expand Up @@ -122,7 +122,10 @@ MusicMetadata& MusicMetadata::operator=(const MusicMetadata &rhs)
m_compartistId = rhs.m_compartistId;
m_albumId = rhs.m_albumId;
m_genreId = rhs.m_genreId;
m_albumArt = nullptr;
if (rhs.m_albumArt)
{
m_albumArt = new AlbumArtImages(this, *rhs.m_albumArt);
}
m_lyricsData = nullptr;
m_format = rhs.m_format;
m_changed = rhs.m_changed;
Expand Down Expand Up @@ -1296,6 +1299,11 @@ QString MusicMetadata::getAlbumArtFile(void)

res = albumart_image->m_filename;
}
else if (repo == RT_CD)
{
// CD tracks can only be played locally, so coverart is local too
return res;
}
else
{
// check for the image in the storage group
Expand Down Expand Up @@ -1890,6 +1898,15 @@ AlbumArtImages::AlbumArtImages(MusicMetadata *metadata, bool loadFromDB)
findImages();
}

AlbumArtImages::AlbumArtImages(MusicMetadata *metadata, const AlbumArtImages &other)
: m_parent(metadata)
{
for (auto &srcImage : qAsConst(other.m_imageList))
{
m_imageList.append(new AlbumArtImage(srcImage));
}
}

AlbumArtImages::~AlbumArtImages()
{
while (!m_imageList.empty())
Expand Down
1 change: 1 addition & 0 deletions mythtv/libs/libmythmetadata/musicmetadata.h
Expand Up @@ -523,6 +523,7 @@ class META_PUBLIC AlbumArtImages

public:
explicit AlbumArtImages(MusicMetadata *metadata, bool loadFromDB = true);
explicit AlbumArtImages(MusicMetadata *metadata, const AlbumArtImages &other);
~AlbumArtImages();

void scanForImages(void);
Expand Down

0 comments on commit 6abb8ac

Please sign in to comment.