MythTV  master
metaio.h
Go to the documentation of this file.
1 #ifndef METAIO_H_
2 #define METAIO_H_
3 
4 // POSIX C headers
5 #include <unistd.h>
6 #include <fcntl.h>
7 #include <sys/stat.h>
8 
9 // QT
10 #include <QString>
11 
12 // libmythmetadata
13 #include "musicmetadata.h"
14 
15 #define MYTH_MUSICBRAINZ_ALBUMARTIST_UUID "89ad4ac3-39f7-470e-963a-56509c546377"
16 
18 {
19  public:
20  MetaIO(void);
21  virtual ~MetaIO(void) = default;
22 
30  virtual bool write(const QString &filename, MusicMetadata* mdata) = 0;
31 
38  virtual bool writeVolatileMetadata(const QString & filename, MusicMetadata* mdata)
39  {
40  // These are here so that the parameters can be documented
41  // with doxygen.
42  (void) filename;
43  (void) mdata;
44  return false;
45  }
46 
53  virtual MusicMetadata* read(const QString &filename) = 0;
54 
60  virtual bool supportsEmbeddedImages(void)
61  {
62  return false;
63  }
64 
71  virtual AlbumArtList getAlbumArtList(const QString &filename)
72  {
73  (void)filename;
74  return AlbumArtList();
75  }
76 
77  virtual bool writeAlbumArt(const QString &filename,
78  const AlbumArtImage *albumart)
79  {
80  (void)filename;
81  (void)albumart;
82  return false;
83  }
84 
85  virtual bool removeAlbumArt(const QString &filename,
86  const AlbumArtImage *albumart)
87  {
88  (void)filename;
89  (void)albumart;
90  return false;
91  }
92 
93  virtual bool changeImageType(const QString &filename,
94  const AlbumArtImage *albumart,
95  ImageType newType)
96  {
97  (void)filename;
98  (void)albumart;
99  (void)newType;
100  return false;
101  }
102 
103  virtual QImage *getAlbumArt(const QString &filename, ImageType type)
104  {
105  (void)filename;
106  (void)type;
107  return nullptr;
108  }
109 
120  void readFromFilename(const QString &filename, QString &artist,
121  QString &album, QString &title, QString &genre,
122  int &tracknum);
123 
131  MusicMetadata* readFromFilename(const QString &filename, bool blnLength = false);
132 
133  void readFromFilename(MusicMetadata *metadata);
134 
135  virtual bool TagExists(const QString &filename)
136  {
137  (void)filename;
138  return false;
139  }
140 
150  static MetaIO *createTagger(const QString &filename);
151 
160  static MusicMetadata *readMetadata(const QString &filename);
161 
171  static MusicMetadata *getMetadata(const QString &filename);
172 
173  static const QString ValidFileExtensions;
174 
175  protected:
176  void saveTimeStamps(void);
177  void restoreTimeStamps(void);
178 
179  virtual int getTrackLength(const QString &filename) = 0;
180 
181  QString m_filename;
183 
184  struct stat m_fileinfo;
185 };
186 
187 #endif
188 
def write(text, progress=True)
Definition: mythburn.py:279
virtual AlbumArtList getAlbumArtList(const QString &filename)
Reads the list of embedded images in the tag.
Definition: metaio.h:71
virtual bool writeVolatileMetadata(const QString &filename, MusicMetadata *mdata)
Writes rating and playcount back to a file.
Definition: metaio.h:38
virtual QImage * getAlbumArt(const QString &filename, ImageType type)
Definition: metaio.h:103
QList< AlbumArtImage * > AlbumArtList
Definition: musicmetadata.h:54
virtual bool changeImageType(const QString &filename, const AlbumArtImage *albumart, ImageType newType)
Definition: metaio.h:93
def read(device=None, features=[])
Definition: disc.py:35
static const QString ValidFileExtensions
Definition: metaio.h:173
virtual bool writeAlbumArt(const QString &filename, const AlbumArtImage *albumart)
Definition: metaio.h:77
Definition: metaio.h:17
virtual bool removeAlbumArt(const QString &filename, const AlbumArtImage *albumart)
Definition: metaio.h:85
virtual bool supportsEmbeddedImages(void)
Does the tag support embedded cover art.
Definition: metaio.h:60
#define META_PUBLIC
Definition: mythmetaexp.h:9
QString m_filename
Definition: metaio.h:181
QString m_filenameFormat
Definition: metaio.h:182
ImageType
Definition: musicmetadata.h:26
virtual bool TagExists(const QString &filename)
Definition: metaio.h:135