mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 17:58:26 -04:00
Removing bloat, fixing file names
This commit is contained in:
@@ -1,46 +0,0 @@
|
||||
#nullable disable
|
||||
using NadekoBot.Modules.Nsfw.Common;
|
||||
|
||||
namespace NadekoBot.Modules.Searches.Common;
|
||||
|
||||
public class ImageCacherObject : IComparable<ImageCacherObject>
|
||||
{
|
||||
public Booru SearchType { get; }
|
||||
public string FileUrl { get; }
|
||||
public HashSet<string> Tags { get; }
|
||||
public string Rating { get; }
|
||||
|
||||
public ImageCacherObject(DapiImageObject obj, Booru type)
|
||||
{
|
||||
if (type == Booru.Danbooru && !Uri.IsWellFormedUriString(obj.FileUrl, UriKind.Absolute))
|
||||
FileUrl = "https://danbooru.donmai.us" + obj.FileUrl;
|
||||
else
|
||||
{
|
||||
FileUrl = obj.FileUrl.StartsWith("http", StringComparison.InvariantCulture)
|
||||
? obj.FileUrl
|
||||
: "https:" + obj.FileUrl;
|
||||
}
|
||||
|
||||
SearchType = type;
|
||||
Rating = obj.Rating;
|
||||
Tags = new((obj.Tags ?? obj.TagString).Split(' '));
|
||||
}
|
||||
|
||||
public ImageCacherObject(
|
||||
string url,
|
||||
Booru type,
|
||||
string tags,
|
||||
string rating)
|
||||
{
|
||||
SearchType = type;
|
||||
FileUrl = url;
|
||||
Tags = new(tags.Split(' '));
|
||||
Rating = rating;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
=> FileUrl;
|
||||
|
||||
public int CompareTo(ImageCacherObject other)
|
||||
=> string.Compare(FileUrl, other.FileUrl, StringComparison.InvariantCulture);
|
||||
}
|
Reference in New Issue
Block a user