mirror of
https://github.com/sphildreth/roadie
synced 2024-11-24 21:23:24 +00:00
Nuget updates, docker work and minor bug fixes.
This commit is contained in:
parent
2e0759ab21
commit
9d3d3f5c61
25 changed files with 271 additions and 245 deletions
|
@ -19,12 +19,8 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.3.1">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
|
||||
<PackageReference Include="xunit" Version="2.4.1" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
|
|
|
@ -10,7 +10,7 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace Roadie.Library.Data.Context
|
||||
{
|
||||
public interface IRoadieDbContext : IRoadieDbRandomizer, IRoadieDbUserStats, IDisposable, IInfrastructure<IServiceProvider>, IDbContextDependencies, IDbSetCache, IDbContextPoolable
|
||||
public interface IRoadieDbContext : IRoadieDbRandomizer, IRoadieDbUserStats, IDisposable, IInfrastructure<IServiceProvider>
|
||||
{
|
||||
DbSet<ArtistAssociation> ArtistAssociations { get; set; }
|
||||
DbSet<ArtistGenre> ArtistGenres { get; set; }
|
||||
|
|
|
@ -91,24 +91,24 @@ namespace Roadie.Library.Data.Context
|
|||
.HasDefaultValue(BandStatus.Unknown);
|
||||
|
||||
entity.HasIndex(e => e.Name)
|
||||
.HasName("ix_artist_name")
|
||||
.HasDatabaseName("ix_artist_name")
|
||||
.IsUnique();
|
||||
|
||||
entity.HasIndex(e => e.RoadieId)
|
||||
.HasName("ix_artist_roadieId");
|
||||
.HasDatabaseName("ix_artist_roadieId");
|
||||
|
||||
entity.HasIndex(e => e.SortName)
|
||||
.HasName("ix_artist_sortname")
|
||||
.HasDatabaseName("ix_artist_sortname")
|
||||
.IsUnique();
|
||||
});
|
||||
|
||||
builder.Entity<ArtistAssociation>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.AssociatedArtistId)
|
||||
.HasName("ix_associatedArtistId");
|
||||
.HasDatabaseName("ix_associatedArtistId");
|
||||
|
||||
entity.HasIndex(e => new { e.ArtistId, e.AssociatedArtistId })
|
||||
.HasName("ix__artistAssociation");
|
||||
.HasDatabaseName("ix__artistAssociation");
|
||||
|
||||
entity.HasOne(d => d.Artist)
|
||||
.WithMany(p => p.AssociatedArtists)
|
||||
|
@ -120,13 +120,13 @@ namespace Roadie.Library.Data.Context
|
|||
builder.Entity<ArtistGenre>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.ArtistId)
|
||||
.HasName("ix_artistGenreTable_artistId");
|
||||
.HasDatabaseName("ix_artistGenreTable_artistId");
|
||||
|
||||
entity.HasIndex(e => e.GenreId)
|
||||
.HasName("ix_artistGenre_genreId");
|
||||
.HasDatabaseName("ix_artistGenre_genreId");
|
||||
|
||||
entity.HasIndex(e => new { e.ArtistId, e.GenreId })
|
||||
.HasName("ix__artistGenreAssociation");
|
||||
.HasDatabaseName("ix__artistGenreAssociation");
|
||||
|
||||
entity.HasOne(d => d.Artist)
|
||||
.WithMany(p => p.Genres)
|
||||
|
@ -144,10 +144,10 @@ namespace Roadie.Library.Data.Context
|
|||
builder.Entity<ArtistSimilar>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.SimilarArtistId)
|
||||
.HasName("ix_similarArtistId");
|
||||
.HasDatabaseName("ix_similarArtistId");
|
||||
|
||||
entity.HasIndex(e => new { e.ArtistId, e.SimilarArtistId })
|
||||
.HasName("ix_artistSimilar");
|
||||
.HasDatabaseName("ix_artistSimilar");
|
||||
|
||||
entity.HasOne(d => d.Artist)
|
||||
.WithMany(p => p.SimilarArtists)
|
||||
|
@ -158,13 +158,13 @@ namespace Roadie.Library.Data.Context
|
|||
builder.Entity<Bookmark>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.RoadieId)
|
||||
.HasName("ix_bookmark_roadieId");
|
||||
.HasDatabaseName("ix_bookmark_roadieId");
|
||||
|
||||
entity.HasIndex(e => e.UserId)
|
||||
.HasName("ix_bookmark_userId");
|
||||
.HasDatabaseName("ix_bookmark_userId");
|
||||
|
||||
entity.HasIndex(e => new { e.BookmarkType, e.BookmarkTargetId, e.UserId })
|
||||
.HasName("ix_bookmark_bookmarkType")
|
||||
.HasDatabaseName("ix_bookmark_bookmarkType")
|
||||
.IsUnique();
|
||||
|
||||
entity.HasOne(d => d.User)
|
||||
|
@ -177,7 +177,7 @@ namespace Roadie.Library.Data.Context
|
|||
builder.Entity<ChatMessage>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.UserId)
|
||||
.HasName("ix__chatMessage_user");
|
||||
.HasDatabaseName("ix__chatMessage_user");
|
||||
|
||||
entity.HasOne(d => d.User)
|
||||
.WithMany(p => p.ChatMessages)
|
||||
|
@ -197,14 +197,14 @@ namespace Roadie.Library.Data.Context
|
|||
.HasDefaultValue(CollectionType.Unknown);
|
||||
|
||||
entity.HasIndex(e => e.MaintainerId)
|
||||
.HasName("ix_collection_maintainerId");
|
||||
.HasDatabaseName("ix_collection_maintainerId");
|
||||
|
||||
entity.HasIndex(e => e.Name)
|
||||
.HasName("ix_collection_name")
|
||||
.HasDatabaseName("ix_collection_name")
|
||||
.IsUnique();
|
||||
|
||||
entity.HasIndex(e => e.RoadieId)
|
||||
.HasName("ix_collection_roadieId");
|
||||
.HasDatabaseName("ix_collection_roadieId");
|
||||
|
||||
entity.HasOne(d => d.Maintainer)
|
||||
.WithMany(p => p.Collections)
|
||||
|
@ -216,7 +216,7 @@ namespace Roadie.Library.Data.Context
|
|||
builder.Entity<CollectionMissing>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.CollectionId)
|
||||
.HasName("ix_collection_collectionId");
|
||||
.HasDatabaseName("ix_collection_collectionId");
|
||||
|
||||
entity.HasOne(d => d.Collection)
|
||||
.WithMany(p => p.MissingReleases)
|
||||
|
@ -228,13 +228,13 @@ namespace Roadie.Library.Data.Context
|
|||
builder.Entity<CollectionRelease>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.ReleaseId)
|
||||
.HasName("ix_collectionrelease_releaseId");
|
||||
.HasDatabaseName("ix_collectionrelease_releaseId");
|
||||
|
||||
entity.HasIndex(e => e.RoadieId)
|
||||
.HasName("ix_collectionrelease_roadieId");
|
||||
.HasDatabaseName("ix_collectionrelease_roadieId");
|
||||
|
||||
entity.HasIndex(e => new { e.CollectionId, e.ReleaseId })
|
||||
.HasName("ix__collection_release");
|
||||
.HasDatabaseName("ix__collection_release");
|
||||
|
||||
entity.HasOne(d => d.Collection)
|
||||
.WithMany(p => p.Releases)
|
||||
|
@ -252,31 +252,31 @@ namespace Roadie.Library.Data.Context
|
|||
builder.Entity<Comment>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.ArtistId)
|
||||
.HasName("ix_commentartist_ibfk_1");
|
||||
.HasDatabaseName("ix_commentartist_ibfk_1");
|
||||
|
||||
entity.HasIndex(e => e.CollectionId)
|
||||
.HasName("ix_commentcollection_ibfk_1");
|
||||
.HasDatabaseName("ix_commentcollection_ibfk_1");
|
||||
|
||||
entity.HasIndex(e => e.GenreId)
|
||||
.HasName("ix_commentgenre_ibfk_1");
|
||||
.HasDatabaseName("ix_commentgenre_ibfk_1");
|
||||
|
||||
entity.HasIndex(e => e.LabelId)
|
||||
.HasName("ix_commentlabel_ibfk_1");
|
||||
.HasDatabaseName("ix_commentlabel_ibfk_1");
|
||||
|
||||
entity.HasIndex(e => e.PlaylistId)
|
||||
.HasName("ix_commentplaylist_ibfk_1");
|
||||
.HasDatabaseName("ix_commentplaylist_ibfk_1");
|
||||
|
||||
entity.HasIndex(e => e.ReleaseId)
|
||||
.HasName("ix_commentrelease_ibfk_1");
|
||||
.HasDatabaseName("ix_commentrelease_ibfk_1");
|
||||
|
||||
entity.HasIndex(e => e.RoadieId)
|
||||
.HasName("ix_comment_roadieId");
|
||||
.HasDatabaseName("ix_comment_roadieId");
|
||||
|
||||
entity.HasIndex(e => e.TrackId)
|
||||
.HasName("ix_commenttrack_ibfk_1");
|
||||
.HasDatabaseName("ix_commenttrack_ibfk_1");
|
||||
|
||||
entity.HasIndex(e => e.UserId)
|
||||
.HasName("ix_commentuser_ibfk_1");
|
||||
.HasDatabaseName("ix_commentuser_ibfk_1");
|
||||
|
||||
entity.HasOne(d => d.Artist)
|
||||
.WithMany(p => p.Comments)
|
||||
|
@ -329,16 +329,16 @@ namespace Roadie.Library.Data.Context
|
|||
builder.Entity<CommentReaction>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.CommentId)
|
||||
.HasName("ix_commentReactioncomment_ibfk_1");
|
||||
.HasDatabaseName("ix_commentReactioncomment_ibfk_1");
|
||||
|
||||
entity.HasIndex(e => e.RoadieId)
|
||||
.HasName("ix_commentReaction_roadieId");
|
||||
.HasDatabaseName("ix_commentReaction_roadieId");
|
||||
|
||||
entity.HasIndex(e => e.UserId)
|
||||
.HasName("ix_commentReactionuser_ibfk_1");
|
||||
.HasDatabaseName("ix_commentReactionuser_ibfk_1");
|
||||
|
||||
entity.HasIndex(e => new { e.UserId, e.CommentId })
|
||||
.HasName("ix_commentReaction_userId")
|
||||
.HasDatabaseName("ix_commentReaction_userId")
|
||||
.IsUnique();
|
||||
|
||||
entity.HasOne(d => d.Comment)
|
||||
|
@ -355,19 +355,19 @@ namespace Roadie.Library.Data.Context
|
|||
builder.Entity<Credit>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.ArtistId)
|
||||
.HasName("ix_credit_artist_ibfk_1");
|
||||
.HasDatabaseName("ix_credit_artist_ibfk_1");
|
||||
|
||||
entity.HasIndex(e => e.CreditCategoryId)
|
||||
.HasName("ix_credit_category_ibfk_1");
|
||||
.HasDatabaseName("ix_credit_category_ibfk_1");
|
||||
|
||||
entity.HasIndex(e => e.RoadieId)
|
||||
.HasName("ix_credit_roadieId");
|
||||
.HasDatabaseName("ix_credit_roadieId");
|
||||
|
||||
entity.HasIndex(e => new { e.ReleaseId, e.Id })
|
||||
.HasName("ix_creditCreditandRelease");
|
||||
.HasDatabaseName("ix_creditCreditandRelease");
|
||||
|
||||
entity.HasIndex(e => new { e.TrackId, e.Id })
|
||||
.HasName("ix_creditCreditandTrack");
|
||||
.HasDatabaseName("ix_creditCreditandTrack");
|
||||
|
||||
entity.HasOne(d => d.Artist)
|
||||
.WithMany(p => p.Credits)
|
||||
|
@ -396,29 +396,29 @@ namespace Roadie.Library.Data.Context
|
|||
builder.Entity<CreditCategory>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.RoadieId)
|
||||
.HasName("ix_creditCategory_roadieId");
|
||||
.HasDatabaseName("ix_creditCategory_roadieId");
|
||||
});
|
||||
|
||||
builder.Entity<Genre>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.Name)
|
||||
.HasName("ix_genre_name")
|
||||
.HasDatabaseName("ix_genre_name")
|
||||
.IsUnique();
|
||||
|
||||
entity.HasIndex(e => e.NormalizedName)
|
||||
.HasName("ix_genre_normalizedName");
|
||||
.HasDatabaseName("ix_genre_normalizedName");
|
||||
|
||||
entity.HasIndex(e => e.RoadieId)
|
||||
.HasName("ix_genre_roadieId");
|
||||
.HasDatabaseName("ix_genre_roadieId");
|
||||
});
|
||||
|
||||
builder.Entity<InviteToken>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.CreatedByUserId)
|
||||
.HasName("inviteToken_fk_1");
|
||||
.HasDatabaseName("inviteToken_fk_1");
|
||||
|
||||
entity.HasIndex(e => e.RoadieId)
|
||||
.HasName("ix_inviteToken_roadieId");
|
||||
.HasDatabaseName("ix_inviteToken_roadieId");
|
||||
|
||||
entity.HasOne(d => d.CreatedByUser)
|
||||
.WithMany(p => p.InviteTokens)
|
||||
|
@ -429,23 +429,23 @@ namespace Roadie.Library.Data.Context
|
|||
builder.Entity<Label>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.Name)
|
||||
.HasName("ix_label_name")
|
||||
.HasDatabaseName("ix_label_name")
|
||||
.IsUnique();
|
||||
|
||||
entity.HasIndex(e => e.RoadieId)
|
||||
.HasName("ix_label_roadieId");
|
||||
.HasDatabaseName("ix_label_roadieId");
|
||||
});
|
||||
|
||||
builder.Entity<Playlist>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.RoadieId)
|
||||
.HasName("ix_playlist_roadieId");
|
||||
.HasDatabaseName("ix_playlist_roadieId");
|
||||
|
||||
entity.HasIndex(e => e.UserId)
|
||||
.HasName("ix_playlist_userId");
|
||||
.HasDatabaseName("ix_playlist_userId");
|
||||
|
||||
entity.HasIndex(e => new { e.Name, e.UserId })
|
||||
.HasName("ix_playlist_name")
|
||||
.HasDatabaseName("ix_playlist_name")
|
||||
.IsUnique();
|
||||
|
||||
entity.HasOne(d => d.User)
|
||||
|
@ -458,13 +458,13 @@ namespace Roadie.Library.Data.Context
|
|||
builder.Entity<PlaylistTrack>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.PlayListId)
|
||||
.HasName("ix_playListId");
|
||||
.HasDatabaseName("ix_playListId");
|
||||
|
||||
entity.HasIndex(e => e.RoadieId)
|
||||
.HasName("ix_playlisttrack_roadieId");
|
||||
.HasDatabaseName("ix_playlisttrack_roadieId");
|
||||
|
||||
entity.HasIndex(e => e.TrackId)
|
||||
.HasName("trackId");
|
||||
.HasDatabaseName("trackId");
|
||||
|
||||
entity.HasOne(d => d.Playlist)
|
||||
.WithMany(p => p.Tracks)
|
||||
|
@ -500,13 +500,13 @@ namespace Roadie.Library.Data.Context
|
|||
.HasDefaultValue(LibraryStatus.Incomplete);
|
||||
|
||||
entity.HasIndex(e => e.RoadieId)
|
||||
.HasName("ix_release_roadieId");
|
||||
.HasDatabaseName("ix_release_roadieId");
|
||||
|
||||
entity.HasIndex(e => e.Title)
|
||||
.HasName("ix_release_title");
|
||||
.HasDatabaseName("ix_release_title");
|
||||
|
||||
entity.HasIndex(e => new { e.ArtistId, e.Title })
|
||||
.HasName("ix_releaseArtistAndTitle")
|
||||
.HasDatabaseName("ix_releaseArtistAndTitle")
|
||||
.IsUnique();
|
||||
|
||||
entity.HasOne(d => d.Artist)
|
||||
|
@ -519,10 +519,10 @@ namespace Roadie.Library.Data.Context
|
|||
builder.Entity<ReleaseGenre>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.GenreId)
|
||||
.HasName("ix_releaseGenre_genreId");
|
||||
.HasDatabaseName("ix_releaseGenre_genreId");
|
||||
|
||||
entity.HasIndex(e => new { e.ReleaseId, e.GenreId })
|
||||
.HasName("ix_releaseGenreTableReleaseAndGenre");
|
||||
.HasDatabaseName("ix_releaseGenreTableReleaseAndGenre");
|
||||
|
||||
entity.HasOne(d => d.Genre)
|
||||
.WithMany(p => p.Releases)
|
||||
|
@ -540,13 +540,13 @@ namespace Roadie.Library.Data.Context
|
|||
builder.Entity<ReleaseLabel>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.LabelId)
|
||||
.HasName("ix_releaselabel_labelId");
|
||||
.HasDatabaseName("ix_releaselabel_labelId");
|
||||
|
||||
entity.HasIndex(e => e.RoadieId)
|
||||
.HasName("ix_releaselabel_roadieId");
|
||||
.HasDatabaseName("ix_releaselabel_roadieId");
|
||||
|
||||
entity.HasIndex(e => new { e.ReleaseId, e.LabelId })
|
||||
.HasName("ix_release_label");
|
||||
.HasDatabaseName("ix_release_label");
|
||||
|
||||
entity.HasOne(d => d.Label)
|
||||
.WithMany(p => p.ReleaseLabels)
|
||||
|
@ -564,10 +564,10 @@ namespace Roadie.Library.Data.Context
|
|||
builder.Entity<ReleaseMedia>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.RoadieId)
|
||||
.HasName("ix_releasemedia_roadieId");
|
||||
.HasDatabaseName("ix_releasemedia_roadieId");
|
||||
|
||||
entity.HasIndex(e => new { e.ReleaseId, e.MediaNumber })
|
||||
.HasName("ix_releasemedia_releaseId");
|
||||
.HasDatabaseName("ix_releasemedia_releaseId");
|
||||
|
||||
entity.HasOne(d => d.Release)
|
||||
.WithMany(p => p.Medias)
|
||||
|
@ -579,10 +579,10 @@ namespace Roadie.Library.Data.Context
|
|||
builder.Entity<Request>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.RoadieId)
|
||||
.HasName("ix_request_roadieId");
|
||||
.HasDatabaseName("ix_request_roadieId");
|
||||
|
||||
entity.HasIndex(e => e.UserId)
|
||||
.HasName("ix_requestartist_ibfk_1");
|
||||
.HasDatabaseName("ix_requestartist_ibfk_1");
|
||||
|
||||
entity.HasOne(d => d.User)
|
||||
.WithMany(p => p.Requests)
|
||||
|
@ -594,19 +594,19 @@ namespace Roadie.Library.Data.Context
|
|||
builder.Entity<ScanHistory>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.RoadieId)
|
||||
.HasName("ix_scanHistory_roadieId");
|
||||
.HasDatabaseName("ix_scanHistory_roadieId");
|
||||
|
||||
entity.HasIndex(e => e.UserId)
|
||||
.HasName("ix_rscanHistoryt_ibfk_1");
|
||||
.HasDatabaseName("ix_rscanHistoryt_ibfk_1");
|
||||
});
|
||||
|
||||
builder.Entity<Submission>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.RoadieId)
|
||||
.HasName("ix_submission_roadieId");
|
||||
.HasDatabaseName("ix_submission_roadieId");
|
||||
|
||||
entity.HasIndex(e => e.UserId)
|
||||
.HasName("ix_submission_ibfk_1");
|
||||
.HasDatabaseName("ix_submission_ibfk_1");
|
||||
|
||||
entity.HasOne(d => d.User)
|
||||
.WithMany(p => p.Submissions)
|
||||
|
@ -618,23 +618,23 @@ namespace Roadie.Library.Data.Context
|
|||
builder.Entity<Track>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.ArtistId)
|
||||
.HasName("ix_track_artistId");
|
||||
.HasDatabaseName("ix_track_artistId");
|
||||
|
||||
entity.HasIndex(e => e.Hash)
|
||||
.HasName("ix_track_hash")
|
||||
.HasDatabaseName("ix_track_hash")
|
||||
.IsUnique();
|
||||
|
||||
entity.HasIndex(e => e.ReleaseMediaId)
|
||||
.HasName("ix_track_releaseMediaId");
|
||||
.HasDatabaseName("ix_track_releaseMediaId");
|
||||
|
||||
entity.HasIndex(e => e.RoadieId)
|
||||
.HasName("ix_track_roadieId");
|
||||
.HasDatabaseName("ix_track_roadieId");
|
||||
|
||||
entity.HasIndex(e => e.Title)
|
||||
.HasName("ix_track_title");
|
||||
.HasDatabaseName("ix_track_title");
|
||||
|
||||
entity.HasIndex(e => new { e.ReleaseMediaId, e.TrackNumber })
|
||||
.HasName("ix_track_unique_to_eleasemedia")
|
||||
.HasDatabaseName("ix_track_unique_to_eleasemedia")
|
||||
.IsUnique();
|
||||
|
||||
entity.HasOne(d => d.TrackArtist)
|
||||
|
@ -653,10 +653,10 @@ namespace Roadie.Library.Data.Context
|
|||
builder.Entity<UserQue>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.TrackId)
|
||||
.HasName("ix_userQue_ibfk_2");
|
||||
.HasDatabaseName("ix_userQue_ibfk_2");
|
||||
|
||||
entity.HasIndex(e => e.UserId)
|
||||
.HasName("ix_user");
|
||||
.HasDatabaseName("ix_user");
|
||||
|
||||
entity.HasOne(d => d.Track)
|
||||
.WithMany(p => p.UserQues)
|
||||
|
@ -672,13 +672,13 @@ namespace Roadie.Library.Data.Context
|
|||
builder.Entity<UserArtist>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.ArtistId)
|
||||
.HasName("ix_userartist_artistId");
|
||||
.HasDatabaseName("ix_userartist_artistId");
|
||||
|
||||
entity.HasIndex(e => e.RoadieId)
|
||||
.HasName("ix_userartist_roadieId");
|
||||
.HasDatabaseName("ix_userartist_roadieId");
|
||||
|
||||
entity.HasIndex(e => new { e.UserId, e.ArtistId })
|
||||
.HasName("ix_userartist_userId")
|
||||
.HasDatabaseName("ix_userartist_userId")
|
||||
.IsUnique();
|
||||
|
||||
entity.HasOne(d => d.Artist)
|
||||
|
@ -697,13 +697,13 @@ namespace Roadie.Library.Data.Context
|
|||
builder.Entity<UserRelease>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.ReleaseId)
|
||||
.HasName("ix_userrelease_releaseId");
|
||||
.HasDatabaseName("ix_userrelease_releaseId");
|
||||
|
||||
entity.HasIndex(e => e.RoadieId)
|
||||
.HasName("ix_userrelease_roadieId");
|
||||
.HasDatabaseName("ix_userrelease_roadieId");
|
||||
|
||||
entity.HasIndex(e => new { e.UserId, e.ReleaseId })
|
||||
.HasName("ix_userrelease_userId_ix")
|
||||
.HasDatabaseName("ix_userrelease_userId_ix")
|
||||
.IsUnique();
|
||||
|
||||
entity.HasOne(d => d.Release)
|
||||
|
@ -722,13 +722,13 @@ namespace Roadie.Library.Data.Context
|
|||
builder.Entity<UserTrack>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.RoadieId)
|
||||
.HasName("ix_usertrack_roadieId");
|
||||
.HasDatabaseName("ix_usertrack_roadieId");
|
||||
|
||||
entity.HasIndex(e => e.TrackId)
|
||||
.HasName("ix_usertrack_trackId");
|
||||
.HasDatabaseName("ix_usertrack_trackId");
|
||||
|
||||
entity.HasIndex(e => new { e.UserId, e.TrackId })
|
||||
.HasName("ix_usertrack_userId_ix")
|
||||
.HasDatabaseName("ix_usertrack_userId_ix")
|
||||
.IsUnique();
|
||||
|
||||
entity.HasOne(d => d.Track)
|
||||
|
@ -747,21 +747,21 @@ namespace Roadie.Library.Data.Context
|
|||
builder.Entity<User>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.Email)
|
||||
.HasName("ix_user_email")
|
||||
.HasDatabaseName("ix_user_email")
|
||||
.IsUnique();
|
||||
|
||||
entity.HasIndex(e => e.RoadieId)
|
||||
.HasName("ix_user_roadieId");
|
||||
.HasDatabaseName("ix_user_roadieId");
|
||||
|
||||
entity.HasIndex(e => e.UserName)
|
||||
.HasName("ix_user_username")
|
||||
.HasDatabaseName("ix_user_username")
|
||||
.IsUnique();
|
||||
});
|
||||
|
||||
builder.Entity<UserClaims>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.UserId)
|
||||
.HasName("ix_userClaims_userId");
|
||||
.HasDatabaseName("ix_userClaims_userId");
|
||||
|
||||
entity.HasOne(d => d.User)
|
||||
.WithMany(p => p.UserClaims)
|
||||
|
@ -772,7 +772,7 @@ namespace Roadie.Library.Data.Context
|
|||
builder.Entity<UserRoleClaims>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.RoleId)
|
||||
.HasName("ix_userRoleClaims_userRoleId");
|
||||
.HasDatabaseName("ix_userRoleClaims_userRoleId");
|
||||
|
||||
entity.HasOne(d => d.UserRole)
|
||||
.WithMany(p => p.RoleClaims)
|
||||
|
@ -783,20 +783,20 @@ namespace Roadie.Library.Data.Context
|
|||
builder.Entity<UserRole>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.Name)
|
||||
.HasName("ix_userrole_name")
|
||||
.HasDatabaseName("ix_userrole_name")
|
||||
.IsUnique();
|
||||
|
||||
entity.HasIndex(e => e.RoadieId)
|
||||
.HasName("ix_userrole_roadieId");
|
||||
.HasDatabaseName("ix_userrole_roadieId");
|
||||
});
|
||||
|
||||
builder.Entity<UsersInRoles>(entity =>
|
||||
{
|
||||
entity.HasIndex(e => e.UserId)
|
||||
.HasName("ix_usersInRoles_userId");
|
||||
.HasDatabaseName("ix_usersInRoles_userId");
|
||||
|
||||
entity.HasIndex(e => e.RoleId)
|
||||
.HasName("ix_usersInRoles_userRoleId");
|
||||
.HasDatabaseName("ix_usersInRoles_userRoleId");
|
||||
|
||||
entity.HasOne(d => d.User)
|
||||
.WithMany(p => p.UserRoles)
|
||||
|
|
|
@ -887,7 +887,7 @@ namespace Roadie.Library.Engines
|
|||
{
|
||||
result.Genres.Add(new ReleaseGenre
|
||||
{
|
||||
Genre = DbContext.Genres.Where(x => string.Equals(x.Name, g, StringComparison.OrdinalIgnoreCase)).FirstOrDefault() ?? new Genre
|
||||
Genre = DbContext.Genres.Where(x => x.Name == g).FirstOrDefault() ?? new Genre
|
||||
{
|
||||
Name = g,
|
||||
NormalizedName = g.ToAlphanumericName()
|
||||
|
|
|
@ -9,35 +9,6 @@ namespace Roadie.Library.Extensions
|
|||
{
|
||||
public static class GenericExt
|
||||
{
|
||||
/// <summary>
|
||||
/// Perform a deep Copy of the object using a BinaryFormatter.
|
||||
/// IMPORTANT: the object class must be marked as [Serializable] and have an parameterless constructor.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of object being copied.</typeparam>
|
||||
/// <param name="source">The object instance to copy.</param>
|
||||
/// <returns>The copied object.</returns>
|
||||
public static T Clone<T>(this T source)
|
||||
{
|
||||
if (!typeof(T).IsSerializable)
|
||||
{
|
||||
throw new ArgumentException("The type must be serializable.", nameof(source));
|
||||
}
|
||||
|
||||
// Don't serialize a null object, simply return the default for that object
|
||||
if (ReferenceEquals(source, null))
|
||||
{
|
||||
return default(T);
|
||||
}
|
||||
|
||||
IFormatter formatter = new BinaryFormatter();
|
||||
using (Stream stream = new MemoryStream())
|
||||
{
|
||||
formatter.Serialize(stream, source);
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
return (T)formatter.Deserialize(stream);
|
||||
}
|
||||
}
|
||||
|
||||
public static TEntity CopyTo<TEntity>(this TEntity OriginalEntity, TEntity NewEntity)
|
||||
{
|
||||
var oProperties = OriginalEntity.GetType().GetProperties();
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Roadie.Library.Extensions
|
|||
{
|
||||
public static string ToDuration(this TimeSpan input)
|
||||
{
|
||||
if (input == null || input.TotalMilliseconds == 0)
|
||||
if (input == default || input.TotalMilliseconds == 0)
|
||||
{
|
||||
return "--/--/--";
|
||||
}
|
||||
|
|
|
@ -9,26 +9,26 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoCompare.Core" Version="1.0.0" />
|
||||
<PackageReference Include="CsvHelper" Version="16.0.0" />
|
||||
<PackageReference Include="CsvHelper" Version="18.0.0" />
|
||||
<PackageReference Include="EFCore.BulkExtensions" Version="3.2.5" />
|
||||
<PackageReference Include="FluentFTP" Version="33.0.2" />
|
||||
<PackageReference Include="FluentFTP" Version="33.0.3" />
|
||||
<PackageReference Include="Hashids.net" Version="1.3.0" />
|
||||
<PackageReference Include="HtmlAgilityPack" Version="1.11.28" />
|
||||
<PackageReference Include="IdSharp.Common" Version="1.0.1" />
|
||||
<PackageReference Include="IdSharp.Tagging" Version="1.0.0-rc3" />
|
||||
<PackageReference Include="Inflatable.Lastfm" Version="1.2.0" />
|
||||
<PackageReference Include="LiteDB" Version="5.0.9" />
|
||||
<PackageReference Include="Magick.NET-Q16-x64" Version="7.22.1" />
|
||||
<PackageReference Include="Mapster" Version="7.0.0" />
|
||||
<PackageReference Include="Magick.NET-Q16-x64" Version="7.22.2.2" />
|
||||
<PackageReference Include="Mapster" Version="7.0.1" />
|
||||
<PackageReference Include="MetadataExtractor" Version="2.4.3" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="5.0.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Redis" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="1.3.5" />
|
||||
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="1.3.6" />
|
||||
<PackageReference Include="Microsoft.Net.Http.Headers" Version="2.2.8" />
|
||||
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.1.0" />
|
||||
<PackageReference Include="MimeMapping" Version="1.0.1.30" />
|
||||
|
@ -40,7 +40,7 @@
|
|||
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="5.0.0" />
|
||||
<PackageReference Include="System.Runtime.Caching" Version="5.0.0" />
|
||||
<PackageReference Include="Utf8Json" Version="1.3.7" />
|
||||
<PackageReference Include="z440.atl.core" Version="3.13.0" />
|
||||
<PackageReference Include="z440.atl.core" Version="3.15.0" />
|
||||
<PackageReference Include="zlib.net-mutliplatform" Version="1.0.4" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
@ -37,10 +37,10 @@ namespace Roadie.Library.SearchEngines.Imaging
|
|||
|
||||
request.AddHeader("Ocp-Apim-Subscription-Key", ApiKey.Key);
|
||||
|
||||
request.AddParameter(new Parameter("count", resultsCount > 0 ? resultsCount : 10, ParameterType.GetOrPost));
|
||||
request.AddParameter(new Parameter("safeSearch", "Off", ParameterType.GetOrPost));
|
||||
request.AddParameter(new Parameter("aspect", "Square", ParameterType.GetOrPost));
|
||||
request.AddParameter(new Parameter("q", string.Format("'{0}'", query.Trim()), ParameterType.GetOrPost));
|
||||
request.AddParameter("count", resultsCount > 0 ? resultsCount : 10, ParameterType.GetOrPost);
|
||||
request.AddParameter("safeSearch", "Off", ParameterType.GetOrPost);
|
||||
request.AddParameter("aspect", "Square", ParameterType.GetOrPost);
|
||||
request.AddParameter("q", string.Format("'{0}'", query.Trim()), ParameterType.GetOrPost);
|
||||
return request;
|
||||
}
|
||||
|
||||
|
|
|
@ -170,11 +170,11 @@ namespace Roadie.Library.SearchEngines.Imaging
|
|||
|
||||
if (resultsCount > 0)
|
||||
{
|
||||
request.AddParameter(new Parameter("limit", resultsCount, ParameterType.GetOrPost));
|
||||
request.AddParameter("limit", resultsCount, ParameterType.GetOrPost);
|
||||
}
|
||||
request.AddParameter(new Parameter("entity", entityType, ParameterType.GetOrPost));
|
||||
request.AddParameter(new Parameter("country", "us", ParameterType.GetOrPost));
|
||||
request.AddParameter(new Parameter("term", string.Format("'{0}'", query.Trim()), ParameterType.GetOrPost));
|
||||
request.AddParameter("entity", entityType, ParameterType.GetOrPost);
|
||||
request.AddParameter("country", "us", ParameterType.GetOrPost);
|
||||
request.AddParameter("term", string.Format("'{0}'", query.Trim()), ParameterType.GetOrPost);
|
||||
return request;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ namespace Roadie.Library.SearchEngines.MetaData.Discogs
|
|||
{
|
||||
UserAgent = WebHelper.UserAgent
|
||||
};
|
||||
var artistResponse = await c2.ExecuteTaskAsync<DiscogArtistResponse>(request).ConfigureAwait(false);
|
||||
var artistResponse = await c2.ExecuteAsync<DiscogArtistResponse>(request).ConfigureAwait(false);
|
||||
var artist = artistResponse.Data;
|
||||
if (artist != null)
|
||||
{
|
||||
|
@ -144,7 +144,7 @@ namespace Roadie.Library.SearchEngines.MetaData.Discogs
|
|||
request = BuildLabelRequest(responseData.id);
|
||||
var c2 = new RestClient("https://api.discogs.com/");
|
||||
c2.UserAgent = WebHelper.UserAgent;
|
||||
var labelResponse = await c2.ExecuteTaskAsync<DiscogsLabelResult>(request).ConfigureAwait(false);
|
||||
var labelResponse = await c2.ExecuteAsync<DiscogsLabelResult>(request).ConfigureAwait(false);
|
||||
var label = labelResponse.Data;
|
||||
if (label != null)
|
||||
{
|
||||
|
@ -225,7 +225,7 @@ namespace Roadie.Library.SearchEngines.MetaData.Discogs
|
|||
{
|
||||
UserAgent = WebHelper.UserAgent
|
||||
};
|
||||
var releaseResult = await c2.ExecuteTaskAsync<DiscogReleaseDetail>(request).ConfigureAwait(false);
|
||||
var releaseResult = await c2.ExecuteAsync<DiscogReleaseDetail>(request).ConfigureAwait(false);
|
||||
var release = releaseResult?.Data;
|
||||
if (release != null)
|
||||
{
|
||||
|
@ -328,8 +328,8 @@ namespace Roadie.Library.SearchEngines.MetaData.Discogs
|
|||
RequestFormat = DataFormat.Json
|
||||
};
|
||||
request.AddUrlSegment("id", artistId.ToString());
|
||||
request.AddParameter(new Parameter("key", ApiKey.Key, ParameterType.GetOrPost));
|
||||
request.AddParameter(new Parameter("secret", ApiKey.KeySecret, ParameterType.GetOrPost));
|
||||
request.AddParameter("key", ApiKey.Key, ParameterType.GetOrPost);
|
||||
request.AddParameter("secret", ApiKey.KeySecret, ParameterType.GetOrPost);
|
||||
return request;
|
||||
}
|
||||
|
||||
|
@ -342,8 +342,8 @@ namespace Roadie.Library.SearchEngines.MetaData.Discogs
|
|||
RequestFormat = DataFormat.Json
|
||||
};
|
||||
request.AddUrlSegment("id", artistId.ToString());
|
||||
request.AddParameter(new Parameter("key", ApiKey.Key, ParameterType.GetOrPost));
|
||||
request.AddParameter(new Parameter("secret", ApiKey.KeySecret, ParameterType.GetOrPost));
|
||||
request.AddParameter("key", ApiKey.Key, ParameterType.GetOrPost);
|
||||
request.AddParameter("secret", ApiKey.KeySecret, ParameterType.GetOrPost);
|
||||
return request;
|
||||
}
|
||||
|
||||
|
@ -356,8 +356,8 @@ namespace Roadie.Library.SearchEngines.MetaData.Discogs
|
|||
RequestFormat = DataFormat.Json
|
||||
};
|
||||
request.AddUrlSegment("id", releaseId.ToString());
|
||||
request.AddParameter(new Parameter("key", ApiKey.Key, ParameterType.GetOrPost));
|
||||
request.AddParameter(new Parameter("secret", ApiKey.KeySecret, ParameterType.GetOrPost));
|
||||
request.AddParameter("key", ApiKey.Key, ParameterType.GetOrPost);
|
||||
request.AddParameter("secret", ApiKey.KeySecret, ParameterType.GetOrPost);
|
||||
return request;
|
||||
}
|
||||
|
||||
|
@ -371,18 +371,18 @@ namespace Roadie.Library.SearchEngines.MetaData.Discogs
|
|||
};
|
||||
if (resultsCount > 0)
|
||||
{
|
||||
request.AddParameter(new Parameter("page", 1, ParameterType.GetOrPost));
|
||||
request.AddParameter(new Parameter("per_page", resultsCount, ParameterType.GetOrPost));
|
||||
request.AddParameter("page", 1, ParameterType.GetOrPost);
|
||||
request.AddParameter("per_page", resultsCount, ParameterType.GetOrPost);
|
||||
}
|
||||
|
||||
request.AddParameter(new Parameter("type", entityType, ParameterType.GetOrPost));
|
||||
request.AddParameter(new Parameter("q", string.Format("'{0}'", query.Trim()), ParameterType.GetOrPost));
|
||||
request.AddParameter("type", entityType, ParameterType.GetOrPost);
|
||||
request.AddParameter("q", string.Format("'{0}'", query.Trim()), ParameterType.GetOrPost);
|
||||
if (!string.IsNullOrEmpty(artist))
|
||||
{
|
||||
request.AddParameter(new Parameter("artist", string.Format("'{0}'", artist.Trim()), ParameterType.GetOrPost));
|
||||
request.AddParameter("artist", string.Format("'{0}'", artist.Trim()), ParameterType.GetOrPost);
|
||||
}
|
||||
request.AddParameter(new Parameter("key", ApiKey.Key, ParameterType.GetOrPost));
|
||||
request.AddParameter(new Parameter("secret", ApiKey.KeySecret, ParameterType.GetOrPost));
|
||||
request.AddParameter("key", ApiKey.Key, ParameterType.GetOrPost);
|
||||
request.AddParameter("secret", ApiKey.KeySecret, ParameterType.GetOrPost);
|
||||
return request;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,6 +78,14 @@ namespace Roadie.Library.MetaData.MusicBrainz
|
|||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError(ex);
|
||||
try
|
||||
{
|
||||
File.Delete(FileName);
|
||||
Logger.LogWarning($"Deleted corrupt MusicBrainzRepository [{ FileName }].");
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -117,12 +125,13 @@ namespace Roadie.Library.MetaData.MusicBrainz
|
|||
page++;
|
||||
mbReleaseBrowseResult = await MusicBrainzRequestHelper.GetAsync<ReleaseBrowseResult>(MusicBrainzRequestHelper.CreateArtistBrowseTemplate(artistMbId, pageSize, pageSize * page)).ConfigureAwait(false);
|
||||
} while (page < totalPages);
|
||||
col.InsertBulk(fetchResult.Select(x => new RepositoryRelease
|
||||
var releasesToInsert = fetchResult.GroupBy(x => x.title).Select(x => x.OrderBy(x => x.date).First()).OrderBy(x => x.date).ThenBy(x => x.title);
|
||||
col.InsertBulk(releasesToInsert.Where(x => x != null).Select(x => new RepositoryRelease
|
||||
{
|
||||
ArtistMbId = artistMbId,
|
||||
Release = x
|
||||
}));
|
||||
results = fetchResult;
|
||||
results = releasesToInsert;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -231,9 +231,9 @@ namespace Roadie.Library.SearchEngines.MetaData.Spotify
|
|||
Method = Method.GET,
|
||||
RequestFormat = DataFormat.Json
|
||||
};
|
||||
request.AddParameter(new Parameter("type", entityType, ParameterType.GetOrPost));
|
||||
request.AddParameter(new Parameter("q", string.Format("{0}", query.Trim()), ParameterType.GetOrPost));
|
||||
request.AddParameter(new Parameter("market", "US", ParameterType.GetOrPost));
|
||||
request.AddParameter("type", entityType, ParameterType.GetOrPost);
|
||||
request.AddParameter("q", string.Format("{0}", query.Trim()), ParameterType.GetOrPost);
|
||||
request.AddParameter("market", "US", ParameterType.GetOrPost);
|
||||
return request;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,62 +21,52 @@ namespace Roadie.Library.SearchEngines.MetaData.Wikipedia
|
|||
HttpEncoder = httpEncoder;
|
||||
}
|
||||
|
||||
public Task<OperationResult<IEnumerable<ArtistSearchResult>>> PerformArtistSearchAsync(string query, int resultsCount)
|
||||
public async Task<OperationResult<IEnumerable<ArtistSearchResult>>> PerformArtistSearchAsync(string query, int resultsCount)
|
||||
{
|
||||
if(string.IsNullOrEmpty(query) || resultsCount == 0)
|
||||
{
|
||||
return Task.FromResult(new OperationResult<IEnumerable<ArtistSearchResult>>());
|
||||
return new OperationResult<IEnumerable<ArtistSearchResult>>();
|
||||
}
|
||||
var tcs = new TaskCompletionSource<OperationResult<IEnumerable<ArtistSearchResult>>>();
|
||||
var client = new RestClient("https://en.wikipedia.org/w/api.php?format=xml&action=query&redirects=1&prop=extracts&exintro=&explaintext=&titles=" + HttpEncoder.UrlEncode(query ?? string.Empty));
|
||||
var request = new RestRequest(Method.GET);
|
||||
client.ExecuteAsync<api>(request, response =>
|
||||
var response = await client.ExecuteAsync<api>(request).ConfigureAwait(false);
|
||||
ArtistSearchResult data = null;
|
||||
if (response?.Data?.query?.pages?.Any() ?? false)
|
||||
{
|
||||
ArtistSearchResult data = null;
|
||||
if (response?.Data?.query?.pages?.Any() ?? false)
|
||||
var bio = response?.Data?.query?.pages.FirstOrDefault()?.extract;
|
||||
if (bio != null)
|
||||
{
|
||||
var bio = response?.Data?.query?.pages.FirstOrDefault()?.extract;
|
||||
if (bio != null)
|
||||
{
|
||||
data = new ArtistSearchResult
|
||||
{
|
||||
Bio = response.Data.query.pages.First().extract
|
||||
};
|
||||
}
|
||||
}
|
||||
tcs.SetResult(new OperationResult<IEnumerable<ArtistSearchResult>>
|
||||
{
|
||||
IsSuccess = data != null,
|
||||
Data = data != null ? new[] { data } : null
|
||||
});
|
||||
});
|
||||
return tcs.Task;
|
||||
}
|
||||
|
||||
public Task<OperationResult<IEnumerable<ReleaseSearchResult>>> PerformReleaseSearch(string artistName,
|
||||
string query, int resultsCount)
|
||||
{
|
||||
var tcs = new TaskCompletionSource<OperationResult<IEnumerable<ReleaseSearchResult>>>();
|
||||
|
||||
var client = new RestClient("https://en.wikipedia.org/w/api.php?format=xml&action=query&redirects=1&prop=extracts&exintro=&explaintext=&titles=" + HttpEncoder.UrlEncode(query ?? string.Empty) + " (album)");
|
||||
var request = new RestRequest(Method.GET);
|
||||
client.ExecuteAsync<api>(request, response =>
|
||||
{
|
||||
ReleaseSearchResult data = null;
|
||||
if (response?.Data?.query?.pages != null)
|
||||
{
|
||||
data = new ReleaseSearchResult
|
||||
data = new ArtistSearchResult
|
||||
{
|
||||
Bio = response.Data.query.pages.First().extract
|
||||
};
|
||||
}
|
||||
tcs.SetResult(new OperationResult<IEnumerable<ReleaseSearchResult>>
|
||||
}
|
||||
return new OperationResult<IEnumerable<ArtistSearchResult>>
|
||||
{
|
||||
IsSuccess = data != null,
|
||||
Data = data != null ? new[] { data } : null
|
||||
};
|
||||
}
|
||||
|
||||
public async Task<OperationResult<IEnumerable<ReleaseSearchResult>>> PerformReleaseSearch(string artistName, string query, int resultsCount)
|
||||
{
|
||||
var client = new RestClient("https://en.wikipedia.org/w/api.php?format=xml&action=query&redirects=1&prop=extracts&exintro=&explaintext=&titles=" + HttpEncoder.UrlEncode(query ?? string.Empty) + " (album)");
|
||||
var request = new RestRequest(Method.GET);
|
||||
var response = await client.ExecuteAsync<api>(request).ConfigureAwait(false);
|
||||
ReleaseSearchResult data = null;
|
||||
if (response?.Data?.query?.pages != null)
|
||||
{
|
||||
data = new ReleaseSearchResult
|
||||
{
|
||||
IsSuccess = data != null,
|
||||
Data = new[] { data }
|
||||
});
|
||||
});
|
||||
return tcs.Task;
|
||||
Bio = response.Data.query.pages.First().extract
|
||||
};
|
||||
}
|
||||
return new OperationResult<IEnumerable<ReleaseSearchResult>>
|
||||
{
|
||||
IsSuccess = data != null,
|
||||
Data = new[] { data }
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
|
@ -692,10 +692,17 @@ namespace Roadie.Api.Services
|
|||
Directory.CreateDirectory(Configuration.LabelImageFolder);
|
||||
Logger.LogInformation($"Created Label Image Folder [{Configuration.LabelImageFolder}]");
|
||||
}
|
||||
if (Configuration.DbContextToUse != DbContexts.MySQL && !Directory.Exists(Configuration.FileDatabaseOptions.DatabaseFolder))
|
||||
if (Configuration.DbContextToUse != DbContexts.MySQL)
|
||||
{
|
||||
Directory.CreateDirectory(Configuration.FileDatabaseOptions.DatabaseFolder);
|
||||
Logger.LogInformation($"Created File Database Folder [{Configuration.FileDatabaseOptions.DatabaseFolder}]");
|
||||
if (!Directory.Exists(Configuration.FileDatabaseOptions.DatabaseFolder))
|
||||
{
|
||||
Directory.CreateDirectory(Configuration.FileDatabaseOptions.DatabaseFolder);
|
||||
Logger.LogInformation($"Created File Database Folder [{Configuration.FileDatabaseOptions.DatabaseFolder}]");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogInformation($"Administration Information: DatabaseFolder [{ Configuration.FileDatabaseOptions.DatabaseFolder }], Size [{ GetDirectorySize(Configuration.FileDatabaseOptions.DatabaseFolder) }] ");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -707,9 +714,17 @@ namespace Roadie.Api.Services
|
|||
#endregion Setup Configured storage folders
|
||||
|
||||
sw.Stop();
|
||||
Logger.LogInformation($"Administration Information: LibraryFolder [{ Configuration.LibraryFolder }]");
|
||||
Logger.LogInformation($"Administration Information: InboundFolder [{ Configuration.InboundFolder }]");
|
||||
Logger.LogInformation($"Administration startup tasks completed, elapsed time [{ sw.ElapsedMilliseconds }]");
|
||||
}
|
||||
|
||||
private static long GetDirectorySize(string folderPath)
|
||||
{
|
||||
DirectoryInfo di = new DirectoryInfo(folderPath);
|
||||
return di.EnumerateFiles("*.*", SearchOption.AllDirectories).Sum(fi => fi.Length);
|
||||
}
|
||||
|
||||
public async Task<OperationResult<bool>> ScanAllCollectionsAsync(User user, bool isReadOnly = false, bool doPurgeFirst = false)
|
||||
{
|
||||
var sw = new Stopwatch();
|
||||
|
|
|
@ -604,7 +604,7 @@ namespace Roadie.Api.Services
|
|||
foreach (var artistRelease in artistReleases)
|
||||
{
|
||||
// See if there is already a release by the same name for the artist to merge into, if so then merge releases
|
||||
var artistToMergeHasRelease = DbContext.Releases.FirstOrDefault(x => x.ArtistId == artistToMerge.Id && string.Equals(x.Title, artistRelease.Title, StringComparison.OrdinalIgnoreCase));
|
||||
var artistToMergeHasRelease = DbContext.Releases.FirstOrDefault(x => x.ArtistId == artistToMerge.Id && x.Title == artistRelease.Title);
|
||||
if (artistToMergeHasRelease != null)
|
||||
{
|
||||
await ReleaseService.MergeReleasesAsync(user, artistRelease, artistToMergeHasRelease, false).ConfigureAwait(false);
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Hashids.net" Version="1.3.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="5.0.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.8.0" />
|
||||
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.2.5" />
|
||||
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.2.6" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
40
Roadie.Api/Controllers/SystemController.cs
Normal file
40
Roadie.Api/Controllers/SystemController.cs
Normal file
|
@ -0,0 +1,40 @@
|
|||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Roadie.Api.Services;
|
||||
using Roadie.Library.Caching;
|
||||
using Roadie.Library.Configuration;
|
||||
using Roadie.Library.Identity;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Roadie.Api.Controllers
|
||||
{
|
||||
[Produces("application/json")]
|
||||
[Route("system")]
|
||||
[ApiController]
|
||||
[Authorize]
|
||||
public class SystemController : EntityControllerBase
|
||||
{
|
||||
public SystemController(
|
||||
ILogger<StatsController> logger,
|
||||
ICacheManager cacheManager,
|
||||
UserManager<User> userManager,
|
||||
IRoadieSettings roadieSettings)
|
||||
: base(cacheManager, roadieSettings, userManager)
|
||||
{
|
||||
Logger = logger;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[HttpPut]
|
||||
[AllowAnonymous]
|
||||
[Route("ping/{pong}")]
|
||||
public IActionResult Ping(string pong)
|
||||
{
|
||||
return Ok(pong);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,10 +1,9 @@
|
|||
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
|
||||
FROM mcr.microsoft.com/dotnet/aspnet AS base
|
||||
WORKDIR /app
|
||||
EXPOSE 80
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
|
||||
FROM mcr.microsoft.com/dotnet/sdk AS build
|
||||
WORKDIR /src
|
||||
COPY ["Roadie.Api/Roadie.Api.csproj", "Roadie.Api/"]
|
||||
COPY ["Roadie.Api.Services/Roadie.Api.Services.csproj", "Roadie.Api.Services/"]
|
||||
|
@ -23,4 +22,11 @@ RUN dotnet publish "Roadie.Api.csproj" -c Release -o /app/publish
|
|||
FROM base AS final
|
||||
WORKDIR /app
|
||||
COPY --from=publish /app/publish .
|
||||
EXPOSE 80
|
||||
ENV ASPNETCORE_URLS=http://*:80
|
||||
ENV RoadieSettings:SiteName="Roadie"
|
||||
ENV RoadieSettings:DbContextToUse="SQLite"
|
||||
ENV RoadieSettings:LibraryFolder="library"
|
||||
ENV RoadieSettings:InboundFolder="inbound"
|
||||
ENV RoadieSettings:FileDatabaseOptions:DatabaseFolder="data"
|
||||
ENTRYPOINT ["dotnet", "Roadie.Api.dll"]
|
|
@ -3,9 +3,9 @@
|
|||
"Roadie.Api": {
|
||||
"commandName": "Project",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_URLS": "http://+:5123",
|
||||
"ASPNETCORE_ENVIRONMENT": "Production"
|
||||
},
|
||||
"applicationUrl": "http://localhost:5123/"
|
||||
}
|
||||
},
|
||||
"Docker": {
|
||||
"commandName": "Docker",
|
||||
|
|
|
@ -30,29 +30,29 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BCrypt-Core" Version="2.0.0" />
|
||||
<PackageReference Include="Mapster" Version="7.0.0" />
|
||||
<PackageReference Include="Mapster" Version="7.0.1" />
|
||||
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.16.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.1" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="3.8.0" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.8.0" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="3.8.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.9" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="5.0.0" />
|
||||
<PackageReference Include="Pastel" Version="2.0.0" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="5.0.1" />
|
||||
<PackageReference Include="Pastel" Version="2.1.0" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
|
||||
<PackageReference Include="Serilog.Enrichers.Environment" Version="2.1.3" />
|
||||
<PackageReference Include="Serilog.Enrichers.Thread" Version="3.1.0" />
|
||||
<PackageReference Include="Serilog.Exceptions" Version="5.7.0" />
|
||||
<PackageReference Include="Serilog.Exceptions" Version="6.0.0" />
|
||||
<PackageReference Include="Serilog.Settings.Configuration" Version="3.1.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
|
||||
<PackageReference Include="Serilog.Sinks.LiteDB.NetStandard" Version="1.0.14" />
|
||||
<PackageReference Include="Serilog.Sinks.RollingFileAlternate" Version="2.0.9" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.8.0" />
|
||||
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.2.5" />
|
||||
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.2.6" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -224,7 +224,7 @@ namespace Roadie.Api
|
|||
configuration.GetSection("RoadieSettings").Bind(settings);
|
||||
var hostingEnvironment = ctx.GetService<IWebHostEnvironment>();
|
||||
settings.ContentPath = hostingEnvironment.WebRootPath;
|
||||
settings.ConnectionString = _configuration.GetConnectionString("RoadieDatabaseConnection");
|
||||
settings.ConnectionString = _configuration.GetConnectionString("RoadieDatabaseConnection");
|
||||
|
||||
// This is so 'User Secrets' can be used in Debugging
|
||||
var integrationKeys = _configuration.GetSection("IntegrationKeys").Get<IntegrationKey>();
|
||||
|
|
|
@ -1,11 +1,4 @@
|
|||
{
|
||||
"Kestrel": {
|
||||
"EndPoints": {
|
||||
"Http": {
|
||||
"Url": "http://192.168.1.177:5123/"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Serilog": {
|
||||
"Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.RollingFileAlternate" ],
|
||||
"MinimumLevel": {
|
||||
|
|
8
Roadie.Dlna/GlobalSuppressions.cs
Normal file
8
Roadie.Dlna/GlobalSuppressions.cs
Normal file
|
@ -0,0 +1,8 @@
|
|||
// This file is used by Code Analysis to maintain SuppressMessage
|
||||
// attributes that are applied to this project.
|
||||
// Project-level suppressions either have no target or are given
|
||||
// a specific target and scoped to a namespace, type, member, etc.
|
||||
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
[assembly: SuppressMessage("Design", "RCS1075:Avoid empty catch clause that catches System.Exception.", Justification = "<Pending>", Scope = "member", Target = "~M:Roadie.Dlna.Utility.FFmpeg.FindExecutable(System.String)~System.String")]
|
|
@ -166,7 +166,6 @@ namespace Roadie.Dlna.Utility
|
|||
sti.UseShellExecute = false;
|
||||
sti.FileName = FFmpegExecutable;
|
||||
sti.Arguments = $"-i \"{file.FullName}\"";
|
||||
sti.LoadUserProfile = false;
|
||||
sti.RedirectStandardError = true;
|
||||
p.Start();
|
||||
IDictionary<string, string> rv = new Dictionary<string, string>();
|
||||
|
@ -282,7 +281,6 @@ namespace Roadie.Dlna.Utility
|
|||
sti.UseShellExecute = false;
|
||||
sti.FileName = FFmpegExecutable;
|
||||
sti.Arguments = $"-i \"{file.FullName}\" -map s:0 -f srt pipe:";
|
||||
sti.LoadUserProfile = false;
|
||||
sti.RedirectStandardOutput = true;
|
||||
p.Start();
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ namespace Roadie.Dlna.Utility
|
|||
}
|
||||
}
|
||||
return Path.GetFileNameWithoutExtension(
|
||||
Assembly.GetExecutingAssembly().CodeBase);
|
||||
Assembly.GetExecutingAssembly().Location);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue