MythTV  master
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
MetaIO Class Referenceabstract

#include <metaio.h>

Inheritance diagram for MetaIO:
Inheritance graph
[legend]
Collaboration diagram for MetaIO:
Collaboration graph
[legend]

Public Member Functions

 MetaIO (void)
 Constructor. More...
 
virtual ~MetaIO (void)=default
 
virtual bool write (const QString &filename, MusicMetadata *mdata)=0
 Writes all metadata back to a file. More...
 
virtual bool writeVolatileMetadata (const QString &filename, MusicMetadata *mdata)
 Writes rating and playcount back to a file. More...
 
virtual MusicMetadataread (const QString &filename)=0
 Reads MusicMetadata from a file. More...
 
virtual bool supportsEmbeddedImages (void)
 Does the tag support embedded cover art. More...
 
virtual AlbumArtList getAlbumArtList (const QString &filename)
 Reads the list of embedded images in the tag. More...
 
virtual bool writeAlbumArt (const QString &filename, const AlbumArtImage *albumart)
 
virtual bool removeAlbumArt (const QString &filename, const AlbumArtImage *albumart)
 
virtual bool changeImageType (const QString &filename, const AlbumArtImage *albumart, ImageType newType)
 
virtual QImage * getAlbumArt (const QString &filename, ImageType type)
 
void readFromFilename (const QString &filename, QString &artist, QString &album, QString &title, QString &genre, int &tracknum)
 Reads MusicMetadata based on the folder/filename. More...
 
MusicMetadatareadFromFilename (const QString &filename, bool blnLength=false)
 Reads MusicMetadata based on the folder/filename. More...
 
void readFromFilename (MusicMetadata *metadata)
 Reads MusicMetadata based on the folder/filename. More...
 
virtual bool TagExists (const QString &filename)
 

Static Public Member Functions

static MetaIOcreateTagger (const QString &filename)
 Finds an appropriate tagger for the given file. More...
 
static MusicMetadatareadMetadata (const QString &filename)
 Read the metadata from filename directly. More...
 
static MusicMetadatagetMetadata (const QString &filename)
 Get the metadata for filename. More...
 

Static Public Attributes

static const QString ValidFileExtensions
 

Protected Member Functions

void saveTimeStamps (void)
 
void restoreTimeStamps (void)
 
virtual int getTrackLength (const QString &filename)=0
 

Protected Attributes

QString m_filename
 
QString m_filenameFormat
 
struct stat m_fileinfo
 

Detailed Description

Definition at line 17 of file metaio.h.

Constructor & Destructor Documentation

◆ MetaIO()

MetaIO::MetaIO ( void  )

Constructor.

Definition at line 26 of file metaio.cpp.

◆ ~MetaIO()

virtual MetaIO::~MetaIO ( void  )
virtualdefault

Member Function Documentation

◆ write()

virtual bool MetaIO::write ( const QString &  filename,
MusicMetadata mdata 
)
pure virtual

Writes all metadata back to a file.

Parameters
filenameThe filename to write metadata to
mdataA pointer to a MusicMetadata object
Returns
Boolean to indicate success/failure.

Implemented in MetaIOID3, MetaIOWavPack, MetaIOFLACVorbis, MetaIOOggVorbis, MetaIOTagLib, MetaIOAVFComment, and MetaIOMP4.

Referenced by ImportMusicDialog::addPressed(), MainServer::HandleMusicTagUpdateMetadata(), and UpdateMeta().

◆ writeVolatileMetadata()

virtual bool MetaIO::writeVolatileMetadata ( const QString &  filename,
MusicMetadata mdata 
)
inlinevirtual

Writes rating and playcount back to a file.

Parameters
filenameThe filename to write metadata to
mdataA pointer to a MusicMetadata object
Returns
Boolean to indicate success/failure.

Reimplemented in MetaIOID3.

Definition at line 38 of file metaio.h.

◆ read()

virtual MusicMetadata* MetaIO::read ( const QString &  filename)
pure virtual

Reads MusicMetadata from a file.

Parameters
filenameThe filename to read metadata from.
Returns
MusicMetadata pointer or nullptr on error

Implemented in MetaIOID3, MetaIOFLACVorbis, MetaIOWavPack, MetaIOOggVorbis, MetaIOTagLib, MetaIOAVFComment, and MetaIOMP4.

Referenced by readMetadata(), and ImportMusicDialog::scanDirectory().

◆ supportsEmbeddedImages()

virtual bool MetaIO::supportsEmbeddedImages ( void  )
inlinevirtual

Does the tag support embedded cover art.

Returns
true if reading/writing embedded images are supported

Reimplemented in MetaIOID3, and MetaIOFLACVorbis.

Definition at line 60 of file metaio.h.

Referenced by MusicFileScanner::AddFileToDB(), ExtractImage(), MainServer::HandleMusicFindAlbumArt(), MainServer::HandleMusicTagAddImage(), MainServer::HandleMusicTagChangeImage(), MainServer::HandleMusicTagRemoveImage(), and EditAlbumartDialog::showMenu().

◆ getAlbumArtList()

virtual AlbumArtList MetaIO::getAlbumArtList ( const QString &  filename)
inlinevirtual

Reads the list of embedded images in the tag.

Parameters
filenameThe filename to read images from.
Returns
the list of embedded images

Reimplemented in MetaIOID3, and MetaIOFLACVorbis.

Definition at line 71 of file metaio.h.

Referenced by MusicFileScanner::AddFileToDB(), and MainServer::HandleMusicFindAlbumArt().

◆ writeAlbumArt()

virtual bool MetaIO::writeAlbumArt ( const QString &  filename,
const AlbumArtImage albumart 
)
inlinevirtual

Reimplemented in MetaIOID3, and MetaIOFLACVorbis.

Definition at line 77 of file metaio.h.

Referenced by MainServer::HandleMusicTagAddImage().

◆ removeAlbumArt()

virtual bool MetaIO::removeAlbumArt ( const QString &  filename,
const AlbumArtImage albumart 
)
inlinevirtual

Reimplemented in MetaIOID3, and MetaIOFLACVorbis.

Definition at line 85 of file metaio.h.

Referenced by MainServer::HandleMusicTagRemoveImage().

◆ changeImageType()

virtual bool MetaIO::changeImageType ( const QString &  filename,
const AlbumArtImage albumart,
ImageType  newType 
)
inlinevirtual

Reimplemented in MetaIOID3, and MetaIOFLACVorbis.

Definition at line 93 of file metaio.h.

Referenced by MainServer::HandleMusicTagChangeImage().

◆ getAlbumArt()

virtual QImage* MetaIO::getAlbumArt ( const QString &  filename,
ImageType  type 
)
inlinevirtual

Reimplemented in MetaIOID3, and MetaIOFLACVorbis.

Definition at line 103 of file metaio.h.

Referenced by ExtractImage().

◆ readFromFilename() [1/3]

void MetaIO::readFromFilename ( const QString &  filename,
QString &  artist,
QString &  album,
QString &  title,
QString &  genre,
int &  tracknum 
)

Reads MusicMetadata based on the folder/filename.

Parameters
[in]filenameThe filename to try and determine metadata for.
[out]artist
[out]album
[out]title
[out]genre
[out]tracknum

Definition at line 107 of file metaio.cpp.

Referenced by MetaIOMP4::read(), MetaIOAVFComment::read(), readFromFilename(), MetaIOTagLib::ReadGenericMetadata(), and readMetadata().

◆ readFromFilename() [2/3]

MusicMetadata * MetaIO::readFromFilename ( const QString &  filename,
bool  blnLength = false 
)

Reads MusicMetadata based on the folder/filename.

Parameters
filenameThe filename to try and determine metadata for.
blnLengthIf true, read the file length as well.
Returns
MusicMetadata Pointer, or nullptr on error.

Definition at line 173 of file metaio.cpp.

◆ readFromFilename() [3/3]

void MetaIO::readFromFilename ( MusicMetadata metadata)

Reads MusicMetadata based on the folder/filename.

Parameters
metadataMusicMetadata Pointer

Definition at line 194 of file metaio.cpp.

◆ TagExists()

virtual bool MetaIO::TagExists ( const QString &  filename)
inlinevirtual

Reimplemented in MetaIOID3, and MetaIOFLACVorbis.

Definition at line 135 of file metaio.h.

◆ createTagger()

MetaIO * MetaIO::createTagger ( const QString &  filename)
static

Finds an appropriate tagger for the given file.

Parameters
filenameThe filename to find a tagger for.
Returns
MetaIO Pointer, or nullptr if non found.
Note
The caller is responsible for freeing it when no longer required

Definition at line 33 of file metaio.cpp.

Referenced by MusicFileScanner::AddFileToDB(), ImportMusicDialog::addPressed(), MusicMetadata::getTagger(), readMetadata(), ImportMusicDialog::scanDirectory(), and EditAlbumartDialog::showMenu().

◆ readMetadata()

MusicMetadata * MetaIO::readMetadata ( const QString &  filename)
static

Read the metadata from filename directly.

Creates a MetaIO object using MetaIO::createTagger and uses the MetaIO object to read the metadata.

Parameters
filenameThe filename to read metadata from.
Returns
an instance of MusicMetadata owned by the caller

Definition at line 68 of file metaio.cpp.

Referenced by MusicFileScanner::AddFileToDB(), getMetadata(), handleMedia(), and MusicFileScanner::UpdateFileInDB().

◆ getMetadata()

MusicMetadata * MetaIO::getMetadata ( const QString &  filename)
static

Get the metadata for filename.

First tries to read the metadata from the database. If there is no database entry, it'll call MetaIO::readMetadata.

Parameters
filenameThe filename to get metadata for.
Returns
an instance of MusicMetadata owned by the caller

Definition at line 96 of file metaio.cpp.

Referenced by MusicFileScanner::UpdateFileInDB().

◆ saveTimeStamps()

void MetaIO::saveTimeStamps ( void  )
protected

◆ restoreTimeStamps()

void MetaIO::restoreTimeStamps ( void  )
protected

◆ getTrackLength()

virtual int MetaIO::getTrackLength ( const QString &  filename)
protectedpure virtual

Implemented in MetaIOTagLib, MetaIOAVFComment, and MetaIOMP4.

Referenced by readFromFilename().

Member Data Documentation

◆ ValidFileExtensions

const QString MetaIO::ValidFileExtensions
static

◆ m_filename

QString MetaIO::m_filename
protected

◆ m_filenameFormat

QString MetaIO::m_filenameFormat
protected

Definition at line 182 of file metaio.h.

Referenced by MetaIO(), and readFromFilename().

◆ m_fileinfo

struct stat MetaIO::m_fileinfo
protected

Definition at line 184 of file metaio.h.

Referenced by MetaIO(), restoreTimeStamps(), and saveTimeStamps().


The documentation for this class was generated from the following files: