MythTV
master
mythtv
libs
libmythmetadata
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
static
constexpr
const
char
*
MYTH_MUSICBRAINZ_ALBUMARTIST_UUID
{
"89ad4ac3-39f7-470e-963a-56509c546377"
};
16
17
class
META_PUBLIC
MetaIO
18
{
19
public
:
20
MetaIO
(
void
)
21
: m_filenameFormat(
gCoreContext
->GetSetting(
"NonID3FileNameFormat"
).toUpper()) {};
22
virtual
~
MetaIO
(
void
) =
default
;
23
31
virtual
bool
write
(
const
QString &
filename
,
MusicMetadata
* mdata) = 0;
32
39
virtual
bool
writeVolatileMetadata
([[maybe_unused]]
const
QString &
filename
,
40
[[maybe_unused]]
MusicMetadata
* mdata)
41
{
42
return
false
;
43
}
44
51
virtual
MusicMetadata
*
read
(
const
QString &
filename
) = 0;
52
58
virtual
bool
supportsEmbeddedImages
(
void
)
59
{
60
return
false
;
61
}
62
69
virtual
AlbumArtList
getAlbumArtList
([[maybe_unused]]
const
QString &
filename
)
70
{
71
return
{};
72
}
73
74
virtual
bool
writeAlbumArt
([[maybe_unused]]
const
QString &
filename
,
75
[[maybe_unused]]
const
AlbumArtImage
*albumart)
76
{
77
return
false
;
78
}
79
80
virtual
bool
removeAlbumArt
([[maybe_unused]]
const
QString &
filename
,
81
[[maybe_unused]]
const
AlbumArtImage
*albumart)
82
{
83
return
false
;
84
}
85
86
virtual
bool
changeImageType
([[maybe_unused]]
const
QString &
filename
,
87
[[maybe_unused]]
const
AlbumArtImage
*albumart,
88
[[maybe_unused]]
ImageType
newType)
89
{
90
return
false
;
91
}
92
93
virtual
QImage *
getAlbumArt
([[maybe_unused]]
const
QString &
filename
,
94
[[maybe_unused]]
ImageType
type
)
95
{
96
return
nullptr
;
97
}
98
109
void
readFromFilename(
const
QString &
filename
, QString &artist,
110
QString &album, QString &title, QString &genre,
111
int
&tracknum);
112
120
MusicMetadata
* readFromFilename(
const
QString &
filename
,
bool
blnLength =
false
);
121
122
void
readFromFilename(
MusicMetadata
*metadata);
123
124
virtual
bool
TagExists
([[maybe_unused]]
const
QString &
filename
)
125
{
126
return
false
;
127
}
128
138
static
MetaIO
*createTagger(
const
QString &
filename
);
139
148
static
MusicMetadata
*readMetadata(
const
QString &
filename
);
149
159
static
MusicMetadata
*getMetadata(
const
QString &
filename
);
160
161
static
const
QString
kValidFileExtensions
;
162
163
protected
:
164
void
saveTimeStamps(
void
);
165
void
restoreTimeStamps(
void
);
166
167
virtual
std::chrono::milliseconds getTrackLength(
const
QString &
filename
) = 0;
168
169
QString
m_filename
;
170
QString
m_filenameFormat
;
171
172
struct
stat
m_fileinfo
{};
173
};
174
175
#endif
176
MetaIO::changeImageType
virtual bool changeImageType([[maybe_unused]] const QString &filename, [[maybe_unused]] const AlbumArtImage *albumart, [[maybe_unused]] ImageType newType)
Definition:
metaio.h:86
MetaIO::TagExists
virtual bool TagExists([[maybe_unused]] const QString &filename)
Definition:
metaio.h:124
discid.disc.read
def read(device=None, features=[])
Definition:
disc.py:35
mythburn.write
def write(text, progress=True)
Definition:
mythburn.py:308
MetaIO
Definition:
metaio.h:17
MetaIO::m_filename
QString m_filename
Definition:
metaio.h:169
MusicMetadata
Definition:
musicmetadata.h:81
MetaIO::supportsEmbeddedImages
virtual bool supportsEmbeddedImages(void)
Does the tag support embedded cover art.
Definition:
metaio.h:58
MetaIO::MetaIO
MetaIO(void)
Definition:
metaio.h:20
MetaIO::writeVolatileMetadata
virtual bool writeVolatileMetadata([[maybe_unused]] const QString &filename, [[maybe_unused]] MusicMetadata *mdata)
Writes rating and playcount back to a file.
Definition:
metaio.h:39
hardwareprofile.getLink.type
type
Definition:
getLink.py:57
MetaIO::removeAlbumArt
virtual bool removeAlbumArt([[maybe_unused]] const QString &filename, [[maybe_unused]] const AlbumArtImage *albumart)
Definition:
metaio.h:80
MetaIO::m_fileinfo
Definition:
metaio.h:172
MetaIO::getAlbumArt
virtual QImage * getAlbumArt([[maybe_unused]] const QString &filename, [[maybe_unused]] ImageType type)
Definition:
metaio.h:93
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition:
mythcorecontext.cpp:55
AlbumArtList
QList< AlbumArtImage * > AlbumArtList
Definition:
musicmetadata.h:57
MetaIO::getAlbumArtList
virtual AlbumArtList getAlbumArtList([[maybe_unused]] const QString &filename)
Reads the list of embedded images in the tag.
Definition:
metaio.h:69
MYTH_MUSICBRAINZ_ALBUMARTIST_UUID
static constexpr const char * MYTH_MUSICBRAINZ_ALBUMARTIST_UUID
Definition:
metaio.h:15
AlbumArtImage
Definition:
musicmetadata.h:40
build_compdb.filename
filename
Definition:
build_compdb.py:21
MetaIO::kValidFileExtensions
static const QString kValidFileExtensions
Definition:
metaio.h:161
ImageType
ImageType
Definition:
musicmetadata.h:29
META_PUBLIC
#define META_PUBLIC
Definition:
mythmetaexp.h:9
MetaIO::m_filenameFormat
QString m_filenameFormat
Definition:
metaio.h:170
musicmetadata.h
MetaIO::writeAlbumArt
virtual bool writeAlbumArt([[maybe_unused]] const QString &filename, [[maybe_unused]] const AlbumArtImage *albumart)
Definition:
metaio.h:74
Generated on Mon Jan 6 2025 03:16:44 for MythTV by
1.8.17