syntax = "proto2";

package pb.tagreader;

message SongMetadata {

  enum FileType {
    UNKNOWN = 0;
    WAV = 1;
    FLAC = 2;
    WAVPACK = 3;
    OGGFLAC = 4;
    OGGVORBIS = 5;
    OGGOPUS = 6;
    OGGSPEEX = 7;
    MPEG = 8;
    MP4 = 9;
    ASF = 10;
    AIFF = 11;
    MPC = 12;
    TRUEAUDIO = 13;
    DSF = 14;
    DSDIFF = 15;
    PCM = 16;
    APE = 17;
    CDDA = 90;
    STREAM = 91;
  }

  optional bool valid = 1;

  optional string title = 2;
  optional string album = 3;
  optional string artist = 4;
  optional string albumartist = 5;
  optional int32 track = 6;
  optional int32 disc = 7;
  optional int32 year = 8;
  optional int32 originalyear = 9;
  optional string genre = 10;
  optional bool compilation = 11;
  optional string composer = 12;
  optional string performer = 13;
  optional string grouping = 14;
  optional string comment = 15;
  optional string lyrics = 16;

  optional uint64 length_nanosec = 17;

  optional int32 bitrate = 18;
  optional int32 samplerate = 19;
  optional int32 bitdepth = 20;

  optional string url = 21;
  optional string basefilename = 22;
  optional FileType filetype = 23;
  optional int32 filesize = 24;
  optional int64 mtime = 25;
  optional int64 ctime = 26;

  optional int32 playcount = 27;
  optional int32 skipcount = 28;
  optional int32 lastplayed = 29;

  optional bool suspicious_tags = 30;
  optional string art_automatic = 31;

}

message ReadFileRequest {
  optional string filename = 1;
}

message ReadFileResponse {
  optional SongMetadata metadata = 1;
}

message SaveFileRequest {
  optional string filename = 1;
  optional SongMetadata metadata = 2;
}

message SaveFileResponse {
  optional bool success = 1;
}

message IsMediaFileRequest {
  optional string filename = 1;
}

message IsMediaFileResponse {
  optional bool success = 1;
}

message LoadEmbeddedArtRequest {
  optional string filename = 1;
}

message LoadEmbeddedArtResponse {
  optional bytes data = 1;
}

message Message {
  optional int32 id = 1;

  optional ReadFileRequest read_file_request = 2;
  optional ReadFileResponse read_file_response = 3;

  optional SaveFileRequest save_file_request = 4;
  optional SaveFileResponse save_file_response = 5;

  optional IsMediaFileRequest is_media_file_request = 6;
  optional IsMediaFileResponse is_media_file_response = 7;

  optional LoadEmbeddedArtRequest load_embedded_art_request = 8;
  optional LoadEmbeddedArtResponse load_embedded_art_response = 9;

}
