mirror of
https://github.com/sphildreth/roadie
synced 2024-11-15 00:47:17 +00:00
55 lines
No EOL
1.4 KiB
C#
55 lines
No EOL
1.4 KiB
C#
using Roadie.Library.Configuration;
|
|
using Roadie.Library.Utility;
|
|
using System;
|
|
using System.Linq;
|
|
using System.Security.Cryptography;
|
|
|
|
namespace Roadie.Library.Data
|
|
{
|
|
public partial class Artist
|
|
{
|
|
public string CacheKey => CacheUrn(RoadieId);
|
|
|
|
public string CacheRegion => CacheRegionUrn(RoadieId);
|
|
|
|
public string Etag
|
|
{
|
|
get
|
|
{
|
|
return HashHelper.CreateMD5($"{ RoadieId }{ LastUpdated }");
|
|
}
|
|
}
|
|
|
|
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)
|
|
{
|
|
return $"urn:artist:{Id}";
|
|
}
|
|
|
|
public static string CacheUrn(Guid Id)
|
|
{
|
|
return $"urn:artist_by_id:{Id}";
|
|
}
|
|
|
|
public static string CacheUrnByName(string name)
|
|
{
|
|
return $"urn:artist_by_name:{name}";
|
|
}
|
|
|
|
public string ArtistFileFolder(IRoadieSettings configuration)
|
|
{
|
|
return FolderPathHelper.ArtistPath(configuration, SortNameValue);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return string.Format("Id [{0}], Name [{1}], SortName [{2}], RoadieId [{3}]", Id, Name, SortNameValue,
|
|
RoadieId);
|
|
}
|
|
}
|
|
} |