Miam-Player  0.8.0
A nice music player
FileHelper Class Reference

The FileHelper class is used to extract various but relevant fields in all types of tags (MP3, Flac, etc). More...

#include <filehelper.h>

Public Types

enum  Extension {
  EXT_APE = 0, EXT_ASF = 1, EXT_FLAC = 2, EXT_MP4 = 4,
  EXT_MPC = 5, EXT_MP3 = 6, EXT_OGG = 7, EXT_UNKNOWN = -1
}
 
enum  ExtensionType { ET_Standard = 0x001, ET_GameMusicEmu = 0x002, ET_Playlist = 0x004, ET_All = ET_Standard | ET_GameMusicEmu | ET_Playlist }
 
enum  TagKey { Artist }
 
enum  Field {
  Field_AbsPath = 1, Field_Album = 2, Field_Artist = 3, Field_ArtistAlbum = 4,
  Field_Comment = 5, Field_Cover = 6, Field_Disc = 7, Field_FileName = 8,
  Field_Genre = 9, Field_Title = 10, Field_Track = 11, Field_Year = 12
}
 

Public Member Functions

 FileHelper (const QMediaContent &track)
 
 FileHelper (const QString &filePath)
 
virtual ~FileHelper ()
 
QString artistAlbum () const
 
void setArtistAlbum (const QString &artistAlbum)
 
int discNumber (bool canBeZero=false) const
 
CoverextractCover ()
 
bool insert (Field key, const QVariant &value)
 
bool hasCover () const
 
int rating () const
 
void setCover (Cover *cover)
 
void setDiscNumber (const QString &disc)
 
void setRating (int rating)
 
bool isValid () const
 Facade. More...
 
QString title () const
 
QString trackNumber () const
 
QString album () const
 
QString length () const
 
QString artist () const
 
QString year () const
 
QString genre () const
 
QString comment () const
 
bool save ()
 
QFileInfo fileInfo () const
 
TagLib::Filefile ()
 

Static Public Member Functions

static std::string keyToStdString (Field f)
 
static const QStringList suffixes (FileHelper::ExtensionTypes et=FileHelper::ET_Standard, bool withPrefix=false)
 

Detailed Description

The FileHelper class is used to extract various but relevant fields in all types of tags (MP3, Flac, etc).

Author
Matthieu Bachelier

Member Enumeration Documentation

Enumerator
EXT_APE 
EXT_ASF 
EXT_FLAC 
EXT_MP4 
EXT_MPC 
EXT_MP3 
EXT_OGG 
EXT_UNKNOWN 
Enumerator
ET_Standard 
ET_GameMusicEmu 
ET_Playlist 
ET_All 
Enumerator
Field_AbsPath 
Field_Album 
Field_Artist 
Field_ArtistAlbum 
Field_Comment 
Field_Cover 
Field_Disc 
Field_FileName 
Field_Genre 
Field_Title 
Field_Track 
Field_Year 
Enumerator
Artist 

Constructor & Destructor Documentation

FileHelper::FileHelper ( const QMediaContent &  track)
explicit
FileHelper::FileHelper ( const QString &  filePath)
explicit
FileHelper::~FileHelper ( )
virtual

Member Function Documentation

QString FileHelper::album ( ) const
QString FileHelper::artist ( ) const
QString FileHelper::artistAlbum ( ) const

Field ArtistAlbum if exists (in a compilation for example).

QString FileHelper::comment ( ) const
int FileHelper::discNumber ( bool  canBeZero = false) const

Extract field disc number.

Cover * FileHelper::extractCover ( )

Extract the inner picture if exists.

TagLib::File* FileHelper::file ( )
inline
QFileInfo FileHelper::fileInfo ( ) const
inline
QString FileHelper::genre ( ) const
bool FileHelper::hasCover ( ) const

Check if file has an inner picture.

bool FileHelper::insert ( Field  key,
const QVariant &  value 
)
bool FileHelper::isValid ( ) const

Facade.

std::string FileHelper::keyToStdString ( Field  f)
static
QString FileHelper::length ( ) const
int FileHelper::rating ( ) const

Convert the existing rating number into a smaller range from 1 to 5.

TODO other types?

bool FileHelper::save ( )
void FileHelper::setArtistAlbum ( const QString &  artistAlbum)
void FileHelper::setCover ( Cover cover)

Sets the inner picture.

void FileHelper::setDiscNumber ( const QString &  disc)

Set or remove any disc number.

void FileHelper::setRating ( int  rating)

Set or remove any rating.

const QStringList FileHelper::suffixes ( FileHelper::ExtensionTypes  et = FileHelper::ET_Standard,
bool  withPrefix = false 
)
static
QString FileHelper::title ( ) const
QString FileHelper::trackNumber ( ) const
QString FileHelper::year ( ) const

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