summaryrefslogtreecommitdiffstats
path: root/src/audiotagger.h
blob: 4133bfb4aa85d77a5a26e8151b07bc0f148052c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef AUDIOTAGGER_H
#define AUDIOTAGGER_H

#include <QString>
#include <QFileInfo>
#include <taglib/apetag.h>
#include <taglib/id3v2tag.h>
#include <taglib/xiphcomment.h>
#include <taglib/mp4tag.h>

#include "util/sandbox.h"

class AudioTagger {
  public:
    AudioTagger(const QString& file, SecurityTokenPointer pToken);
    virtual ~AudioTagger();

    void setArtist(QString artist);
    void setTitle(QString title);
    void setAlbum(QString album);
    void setAlbumArtist(QString albumArtist);
    void setGenre(QString genre);
    void setComposer(QString composer);
    void setGrouping(QString grouping);
    void setYear(QString year);
    void setComment(QString comment);
    void setKey(QString key);
    void setBpm(QString bpm);
    void setTracknumber(QString tracknumber);
    bool save();

  private:
    QString m_artist;
    QString m_title;
    QString m_albumArtist;
    QString m_genre;
    QString m_composer;
    QString m_album;
    QString m_grouping;
    QString m_year;
    QString m_comment;
    QString m_key;
    QString m_bpm;
    QString m_tracknumber;

    QFileInfo m_file;
    SecurityTokenPointer m_pSecurityToken;

    /** adds or modifies the ID3v2 tag to include BPM and KEY information **/
    void addID3v2Tag(TagLib::ID3v2::Tag* id3v2);
    void addAPETag(TagLib::APE::Tag* ape);
    void addXiphComment(TagLib::Ogg::XiphComment* xiph);
    void processMP4Tag(TagLib::MP4::Tag* mp4);
};

#endif // AUDIOTAGGER_H