KaraokePC/Herse.Models/Song.cs

49 lines
1.1 KiB
C#

using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Herse.Models
{
public class Song
{
[JsonProperty("title")]
public string Title { get; set; }
[JsonProperty("artist")]
public string Artist { get; set; }
[JsonProperty("genre")]
public string Genre { get; set; }
[JsonProperty("year")]
public int Year { get; set; }
[JsonProperty("path")]
public string Path { get; set; }
[JsonIgnore]
public FileType FileType
{
get
{
switch (Path.Substring(Path.Length - 3, 3).ToLower())
{
case "cdg":
case "mp3":
return FileType.CDG;
case "mp4":
return FileType.MP4;
case "zip":
return FileType.ZIP;
default:
throw new Exception("file type not handled");
}
}
}
}
}