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;
|
2019-07-03 16:21:29 +00:00
|
|
|
|
using System.Security.Cryptography;
|
2018-11-03 21:21:36 +00:00
|
|
|
|
|
|
|
|
|
namespace Roadie.Library.Data
|
|
|
|
|
{
|
|
|
|
|
public partial class Artist
|
|
|
|
|
{
|
2019-07-03 16:21:29 +00:00
|
|
|
|
public string CacheKey => CacheUrn(RoadieId);
|
2018-11-22 23:12:57 +00:00
|
|
|
|
|
2019-07-03 16:21:29 +00:00
|
|
|
|
public string CacheRegion => CacheRegionUrn(RoadieId);
|
2018-11-03 21:21:36 +00:00
|
|
|
|
|
|
|
|
|
public string Etag
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2019-07-31 22:42:49 +00:00
|
|
|
|
return HashHelper.CreateMD5($"{ RoadieId }{ LastUpdated }");
|
2018-11-03 21:21:36 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-03 16:21:29 +00:00
|
|
|
|
public bool IsNew => Id < 1;
|
|
|
|
|
|
|
|
|
|
public bool IsValid => !string.IsNullOrEmpty(Name);
|
|
|
|
|
|
|
|
|
|
public string SortNameValue => string.IsNullOrEmpty(SortName) ? Name : SortName;
|
|
|
|
|
|
|
|
|
|
public static string CacheRegionUrn(Guid Id)
|
2018-11-03 21:21:36 +00:00
|
|
|
|
{
|
2019-07-03 16:21:29 +00:00
|
|
|
|
return $"urn:artist:{Id}";
|
2018-11-03 21:21:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-07-03 16:21:29 +00:00
|
|
|
|
public static string CacheUrn(Guid Id)
|
2018-11-03 21:21:36 +00:00
|
|
|
|
{
|
2019-07-03 16:21:29 +00:00
|
|
|
|
return $"urn:artist_by_id:{Id}";
|
2018-11-03 21:21:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-07-03 16:21:29 +00:00
|
|
|
|
public static string CacheUrnByName(string name)
|
2018-11-03 21:21:36 +00:00
|
|
|
|
{
|
2019-07-03 16:21:29 +00:00
|
|
|
|
return $"urn:artist_by_name:{name}";
|
2018-11-03 21:21:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-07-07 03:16:33 +00:00
|
|
|
|
public string ArtistFileFolder(IRoadieSettings configuration)
|
2018-11-03 21:21:36 +00:00
|
|
|
|
{
|
2019-07-07 03:16:33 +00:00
|
|
|
|
return FolderPathHelper.ArtistPath(configuration, SortNameValue);
|
2018-11-03 21:21:36 +00:00
|
|
|
|
}
|
2018-11-04 20:33:37 +00:00
|
|
|
|
|
|
|
|
|
public override string ToString()
|
|
|
|
|
{
|
2019-07-03 16:21:29 +00:00
|
|
|
|
return string.Format("Id [{0}], Name [{1}], SortName [{2}], RoadieId [{3}]", Id, Name, SortNameValue,
|
|
|
|
|
RoadieId);
|
2018-11-04 20:33:37 +00:00
|
|
|
|
}
|
2018-11-03 21:21:36 +00:00
|
|
|
|
}
|
2018-11-04 20:33:37 +00:00
|
|
|
|
}
|