#ifndef _THA_VORBIS_TAG_H_
#define _THA_VORBIS_TAG_H_

#include "thalia/thalia_plugin_public.h"

#include <vorbis/vorbisfile.h>

#include "WDL/wdlstring.h"
#include "WDL/fileread.h"
#include "WDL/assocarray.h"

class THA_VorbisTag : public THA_IFileTag
{
public:
  THA_VorbisTag();
  ~THA_VorbisTag();

  bool Open(const char *filename);

  const char *GetType() const;

  const char *GetTitle() const;
  const char *GetArtist() const;
  const char *GetAlbum() const;
  const char *GetGenre() const;
  const char *GetTrack() const;
  const char *GetYear() const;
  const char *GetComment() const;

  void SetTitle(const char *val);
  void SetArtist(const char *val);
  void SetAlbum(const char *val);
  void SetGenre(const char *val);
  void SetTrack(const char *val);
  void SetYear(const char *val);
  void SetComment(const char *val);
  bool Save();

  WDL_INT64 GetFileSize() const;
  const char *GetFileName() const;
  const char *GetFilePath() const;
  const char *GetFileExtension() const;

private:
  WDL_FastString m_fn;
  WDL_FileRead *m_file;
  WDL_StringKeyedArray<char *> m_metadata;

  OggVorbis_File m_vf;
  WDL_FastString m_strbuf;
};

#endif // _THA_VORBIS_TAG_H_
