TTKMusicPlayer  3.7.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
MetaDataManager Class Reference

The MetaDataManager class is the base class for metadata access. More...

#include <metadatamanager.h>

Classes

struct  CoverCacheItem
 

Public Member Functions

QList< TrackInfo * > createPlayList (const QString &path, TrackInfo::Parts parts=TrackInfo::AllParts, QStringList *ignoredPaths=nullptr) const
 
MetaDataModelcreateMetaDataModel (const QString &url, bool readOnly) const
 
QStringList filters () const
 
QStringList nameFilters () const
 
QStringList protocols () const
 
QList< RegularExpressionregExps () const
 
bool supports (const QString &file) const
 
QPixmap getCover (const QString &url) const
 
QString getCoverPath (const QString &url) const
 
QString findCoverFile (const QString &fileName) const
 
void clearCoverCache ()
 
void prepareForAnotherThread ()
 

Static Public Member Functions

static MetaDataManagerinstance ()
 

Private Member Functions

 MetaDataManager ()
 
 ~MetaDataManager ()
 
QFileInfoList findCoverFiles (QDir dir, int depth) const
 
CoverCacheItemcreateCoverCacheItem (const QString &url) const
 

Static Private Member Functions

static void destroy ()
 

Private Attributes

QList< CoverCacheItem * > m_cover_cache
 
QmmpSettingsm_settings = nullptr
 
QMutex m_mutex
 

Static Private Attributes

static MetaDataManagerm_instance
 

Detailed Description

The MetaDataManager class is the base class for metadata access.

Author
Ilya Kotov forko.nosp@m.tov0.nosp@m.2@ya..nosp@m.ru

Definition at line 41 of file metadatamanager.h.

Constructor & Destructor Documentation

MetaDataManager::MetaDataManager ( )
private
MetaDataManager::~MetaDataManager ( )
private

Member Function Documentation

void MetaDataManager::clearCoverCache ( )

Clears cover path cache.

CoverCacheItem* MetaDataManager::createCoverCacheItem ( const QString &  url) const
private
MetaDataModel* MetaDataManager::createMetaDataModel ( const QString &  url,
bool  readOnly 
) const

Creats metadata object, which provides full access to file tags.

Parameters
urlFile path or URL.
readOnlyOpen file in read-only mode (true - enabled, false - disable).
Returns
MetaDataModel pointer or null pointer.
QList<TrackInfo*> MetaDataManager::createPlayList ( const QString &  path,
TrackInfo::Parts  parts = TrackInfo::AllParts,
QStringList *  ignoredPaths = nullptr 
) const

Extracts metadata and audio information from file path and returns a list of FileInfo items. One file may contain several playlist items (for example: cda disk or flac with embedded cue)

Parameters
pathLocal file path or URL.
partsparts of metadata which should be extracted from file.
ignoredPathsPointer to a list of the files which should be ignored by the recursive search (useful to exclude cue data files from playlist)
static void MetaDataManager::destroy ( )
staticprivate
QStringList MetaDataManager::filters ( ) const

Returns a list of file name filters with description, i.e. "MPEG Files (*.mp3 *.mpg)"

QString MetaDataManager::findCoverFile ( const QString &  fileName) const

Returns the cover file path for the given local audio file, or returns an empty string if the cover file is not available. Unlike getCover and getCoverPath this function provides simple file search (without cache) and should be used inside MetaDataModel reimplementation.

Parameters
fileNamePath of the local audio file.
QFileInfoList MetaDataManager::findCoverFiles ( QDir  dir,
int  depth 
) const
private
QPixmap MetaDataManager::getCover ( const QString &  url) const

Returns the cover pixmap for the given file url, or returns an empty pixmap if cover is not available. IMPORTANT: to avoid infinite recursion, do not use this function inside MetaDataModel reimplementation.

QString MetaDataManager::getCoverPath ( const QString &  url) const

Returns the cover file path for the given file url, or returns an empty string if the cover file is not available. This function does not work with embedded covers. IMPORTANT: to avoid infinite recursion, do not use this function inside MetaDataModel reimplementation.

Referenced by MusicMPRISPlayerCore::metadata().

static MetaDataManager* MetaDataManager::instance ( )
static
QStringList MetaDataManager::nameFilters ( ) const

Returns a list of file name filters, i.e. "*.mp3 *.mpg".

void MetaDataManager::prepareForAnotherThread ( )

Prepares object for usage by another thread to avoid warnings about parent from the different thread

QStringList MetaDataManager::protocols ( ) const

Returns a list of the suported protocols

Referenced by MusicMPRISPlayerRoot::supportedUriSchemes().

QList<RegularExpression> MetaDataManager::regExps ( ) const

Returns a list of supported regular expressions for URL.

bool MetaDataManager::supports ( const QString &  file) const

Returns true if file is supported and exists, otherwise returns false

Member Data Documentation

QList<CoverCacheItem *> MetaDataManager::m_cover_cache
mutableprivate

Definition at line 129 of file metadatamanager.h.

MetaDataManager* MetaDataManager::m_instance
staticprivate

Definition at line 133 of file metadatamanager.h.

QMutex MetaDataManager::m_mutex
mutableprivate

Definition at line 131 of file metadatamanager.h.

QmmpSettings* MetaDataManager::m_settings = nullptr
private

Definition at line 130 of file metadatamanager.h.


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