roadie/RoadieLibrary/Data/ArtistPartial.cs

63 lines
1.6 KiB
C#
Raw Normal View History

2018-11-04 20:33:37 +00:00
using Roadie.Library.Configuration;
2018-11-03 21:21:36 +00:00
using Roadie.Library.Utility;
using System;
using System.Linq;
namespace Roadie.Library.Data
{
public partial class Artist
{
public string CacheRegion
{
get
{
return string.Format("urn:artist:{0}", this.RoadieId);
}
}
public string Etag
{
get
{
using (var md5 = System.Security.Cryptography.MD5.Create())
{
2018-11-04 15:16:52 +00:00
return String.Concat(md5.ComputeHash(System.Text.Encoding.Default.GetBytes(string.Format("{0}{1}", this.RoadieId, this.LastUpdated))).Select(x => x.ToString("D2")));
2018-11-03 21:21:36 +00:00
}
}
}
2018-11-04 20:33:37 +00:00
public bool IsNew
2018-11-03 21:21:36 +00:00
{
get
{
2018-11-04 20:33:37 +00:00
return this.Id < 1;
2018-11-03 21:21:36 +00:00
}
}
2018-11-04 20:33:37 +00:00
public bool IsValid
2018-11-03 21:21:36 +00:00
{
get
{
2018-11-04 20:33:37 +00:00
return !string.IsNullOrEmpty(this.Name);
2018-11-03 21:21:36 +00:00
}
}
public string SortNameValue
{
get
{
return string.IsNullOrEmpty(this.SortName) ? this.Name : this.SortName;
}
}
2018-11-04 20:33:37 +00:00
public string ArtistFileFolder(IRoadieSettings configuration, string destinationRoot)
2018-11-03 21:21:36 +00:00
{
return FolderPathHelper.ArtistPath(configuration, this.SortNameValue, destinationRoot);
}
2018-11-04 20:33:37 +00:00
public override string ToString()
{
return string.Format("Id [{0}], Name [{1}], SortName [{2}], RoadieId [{3}]", this.Id, this.Name, this.SortNameValue, this.RoadieId);
}
2018-11-03 21:21:36 +00:00
}
2018-11-04 20:33:37 +00:00
}