-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
175ba1d
commit 7a6fc02
Showing
26 changed files
with
124 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...oRebirth.Arachne/ImoutoRebirth.Arachne.Infrastructure/LoaderFabrics/Rule34LoaderFabric.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using Flurl.Http.Configuration; | ||
using Imouto.BooruParser; | ||
using Imouto.BooruParser.Implementations.Rule34; | ||
using ImoutoRebirth.Arachne.Core.Models; | ||
using ImoutoRebirth.Arachne.Infrastructure.Abstract; | ||
using Microsoft.Extensions.Options; | ||
|
||
namespace ImoutoRebirth.Arachne.Infrastructure.LoaderFabrics; | ||
|
||
internal class Rule34LoaderFabric : IBooruLoaderFabric | ||
{ | ||
private readonly IFlurlClientFactory _flurlClientFactory; | ||
|
||
public SearchEngineType ForType => SearchEngineType.Rule34; | ||
|
||
public Rule34LoaderFabric(IFlurlClientFactory flurlClientFactory) => _flurlClientFactory = flurlClientFactory; | ||
|
||
public IBooruApiLoader Create() => new Rule34ApiLoader( | ||
_flurlClientFactory, | ||
Options.Create(new Rule34Settings { PauseBetweenRequestsInMs = 1 })); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
5 changes: 5 additions & 0 deletions
5
...h.Arachne/ImoutoRebirth.Arachne.MessageContracts/Commands/IRule34SearchMetadataCommand.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
namespace ImoutoRebirth.Arachne.MessageContracts.Commands; | ||
|
||
public interface IRule34SearchMetadataCommand : ISearchMetadataCommand | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...th.Arachne/ImoutoRebirth.Arachne.Service/Consumers/Rule34SearchMetadataCommandConsumer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using ImoutoRebirth.Arachne.Core.Models; | ||
using ImoutoRebirth.Arachne.MessageContracts.Commands; | ||
using MassTransit; | ||
|
||
namespace ImoutoRebirth.Arachne.Service.Consumers; | ||
|
||
public class Rule34SearchMetadataCommandConsumer : IConsumer<IRule34SearchMetadataCommand> | ||
{ | ||
private readonly ISearchMetadataCommandHandler _searchMetadataCommandHandler; | ||
|
||
public Rule34SearchMetadataCommandConsumer(ISearchMetadataCommandHandler searchMetadataCommandHandler) | ||
=> _searchMetadataCommandHandler = searchMetadataCommandHandler; | ||
|
||
public async Task Consume(ConsumeContext<IRule34SearchMetadataCommand> context) | ||
{ | ||
await _searchMetadataCommandHandler.Search(context, SearchEngineType.Rule34); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,5 +15,6 @@ public enum MetadataSource | |
Danbooru = 1, | ||
Sankaku = 2, | ||
Manual = 3, | ||
Gelbooru = 4 | ||
Gelbooru = 4, | ||
Rule34 = 5, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,6 @@ public enum MetadataSource | |
Danbooru = 1, | ||
Sankaku = 2, | ||
Manual = 3, | ||
Gelbooru = 4 | ||
Gelbooru = 4, | ||
Rule34 = 5, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,6 @@ public enum MetadataSource | |
Yandere = 0, | ||
Danbooru = 1, | ||
Sankaku = 2, | ||
Gelbooru = 4 | ||
Gelbooru = 4, | ||
Rule34 = 5 | ||
} |
17 changes: 17 additions & 0 deletions
17
.../ImoutoRebirth.Meido.Infrastructure/MetadataRequest/Requesters/Rule34MetadataRequester.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using ImoutoRebirth.Arachne.MessageContracts.Commands; | ||
using ImoutoRebirth.Meido.Domain; | ||
using MassTransit; | ||
|
||
namespace ImoutoRebirth.Meido.Infrastructure.MetadataRequest.Requesters; | ||
|
||
internal class Rule34MetadataRequester : IMetadataRequester | ||
{ | ||
private readonly IBus _bus; | ||
|
||
public Rule34MetadataRequester(IBus bus) => _bus = bus; | ||
|
||
public MetadataSource Source => MetadataSource.Rule34; | ||
|
||
public Task SendRequestCommand(Guid fileId, string md5) | ||
=> _bus.Send<IRule34SearchMetadataCommand>(new {FileId = fileId, Md5 = md5}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,6 @@ internal enum FileTagSource | |
Danbooru = 1, | ||
Sankaku = 2, | ||
Manual = 3, | ||
Gelbooru = 4 | ||
Gelbooru = 4, | ||
Rule34 = 5 | ||
} |