Update paths
This commit is contained in:
@@ -19,16 +19,16 @@ namespace Musify.Application.Configuration
|
|||||||
public string ParentFolders { get; set; } = "PlayLists";
|
public string ParentFolders { get; set; } = "PlayLists";
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public string OriginalPictures { get; set; } = "OriginalPictures";
|
public string OriginalPicturesFolder { get; set; } = "OriginalPictures";
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public string SmallPictures { get; set; } = "SmallPictures";
|
public string SmallPicturesFolder { get; set; } = "SmallPictures";
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public string MediumPictures { get; set; } = "MediumPictures";
|
public string MediumPicturesFolder { get; set; } = "MediumPictures";
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public string LargePictures { get; set; } = "LargePictures";
|
public string LargePicturesFolder { get; set; } = "LargePictures";
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public string PresetOriginalPicture { get; set; } = "PresetOriginalPicture.webp";
|
public string PresetOriginalPicture { get; set; } = "PresetOriginalPicture.webp";
|
||||||
@@ -41,6 +41,20 @@ namespace Musify.Application.Configuration
|
|||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public string PresetLargePicture { get; set; } = "PresetLargePicture.webp";
|
public string PresetLargePicture { get; set; } = "PresetLargePicture.webp";
|
||||||
|
|
||||||
|
public string SmallPicturesPath => Path.Combine(ParentFolders, SmallPicturesFolder);
|
||||||
|
|
||||||
|
public string MediumPicturesPath => Path.Combine(ParentFolders, MediumPicturesFolder);
|
||||||
|
|
||||||
|
public string LargePicturesPath => Path.Combine(ParentFolders, LargePicturesFolder);
|
||||||
|
|
||||||
|
public string PresetSmallPicturePath => Path.Combine(ParentFolders, PresetSmallPicture);
|
||||||
|
|
||||||
|
public string PresetMediumPicturePath => Path.Combine(ParentFolders, PresetMediumPicture);
|
||||||
|
|
||||||
|
public string PresetLargePicturePath => Path.Combine(ParentFolders, PresetLargePicture);
|
||||||
|
|
||||||
|
public string OriginalPicturesPath => Path.Combine(ParentFolders, OriginalPicturesFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PlayListPicturesSizes
|
public class PlayListPicturesSizes
|
||||||
|
|||||||
@@ -19,16 +19,16 @@ namespace Musify.Application.Configuration
|
|||||||
public string ParentFolder { get; set; } = "Tracks";
|
public string ParentFolder { get; set; } = "Tracks";
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public string OriginalPictures { get; set; } = "OriginalPictures";
|
public string OriginalPicturesFolder { get; set; } = "OriginalPictures";
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public string SmallPictures { get; set; } = "SmallPictures";
|
public string SmallPicturesFolder { get; set; } = "SmallPictures";
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public string MediumPictures { get; set; } = "MediumPictures";
|
public string MediumPicturesFolder { get; set; } = "MediumPictures";
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public string LargePictures { get; set; } = "LargePictures";
|
public string LargePicturesFolder { get; set; } = "LargePictures";
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public string PresetOriginalPicture { get; set; } = "PresetOriginalPicture.webp";
|
public string PresetOriginalPicture { get; set; } = "PresetOriginalPicture.webp";
|
||||||
@@ -43,10 +43,28 @@ namespace Musify.Application.Configuration
|
|||||||
public string PresetLargePicture { get; set; } = "PresetLargePicture.webp";
|
public string PresetLargePicture { get; set; } = "PresetLargePicture.webp";
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public string OriginalAudios { get; set; } = "OriginalAudios";
|
public string OriginalAudiosFolder { get; set; } = "OriginalAudios";
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public string ProcessedAudio { get; set; } = "ProcessedAudios";
|
public string ProcessedAudioFolder { get; set; } = "ProcessedAudios";
|
||||||
|
|
||||||
|
public string SmallPicturesPath => Path.Combine(ParentFolder, SmallPicturesFolder);
|
||||||
|
|
||||||
|
public string MediumPicturesPath => Path.Combine(ParentFolder, MediumPicturesFolder);
|
||||||
|
|
||||||
|
public string LargePicturesPath => Path.Combine(ParentFolder, LargePicturesFolder);
|
||||||
|
|
||||||
|
public string PresetSmallPicturePath => Path.Combine(ParentFolder, PresetSmallPicture);
|
||||||
|
|
||||||
|
public string PresetMediumPicturePath => Path.Combine(ParentFolder, PresetMediumPicture);
|
||||||
|
|
||||||
|
public string PresetLargePicturePath => Path.Combine(ParentFolder, PresetLargePicture);
|
||||||
|
|
||||||
|
public string OriginalPicturesPath => Path.Combine(ParentFolder, OriginalPicturesFolder);
|
||||||
|
|
||||||
|
public string OriginalAudiosPath => Path.Combine(ParentFolder, OriginalAudiosFolder);
|
||||||
|
|
||||||
|
public string ProcessedAudiosPath => Path.Combine(ParentFolder, ProcessedAudioFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TrackPicturesSizes
|
public class TrackPicturesSizes
|
||||||
|
|||||||
@@ -56,9 +56,7 @@ namespace Musify.Application.PlayLists.Handlers
|
|||||||
{
|
{
|
||||||
var imageId = Guid.NewGuid();
|
var imageId = Guid.NewGuid();
|
||||||
var pictureName = imageId + picture.FileType;
|
var pictureName = imageId + picture.FileType;
|
||||||
var pictureStorageKey = Path.Join(
|
var pictureStorageKey = Path.Join(playListConfiguration.Routes.OriginalPicturesPath,
|
||||||
playListConfiguration.Routes.ParentFolders,
|
|
||||||
playListConfiguration.Routes.OriginalPictures,
|
|
||||||
pictureName);
|
pictureName);
|
||||||
|
|
||||||
var uploadResult = await UploadFile(picture, pictureStorageKey, cancellationToken);
|
var uploadResult = await UploadFile(picture, pictureStorageKey, cancellationToken);
|
||||||
@@ -99,18 +97,12 @@ namespace Musify.Application.PlayLists.Handlers
|
|||||||
|
|
||||||
async Task PublishUpdateEvent(string originalPictureKeyName, PlayList playList, CancellationToken cancellationToken)
|
async Task PublishUpdateEvent(string originalPictureKeyName, PlayList playList, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var smallPictureKeyName = Path.Combine(
|
var smallPictureKeyName = Path.Combine(playListConfiguration.Routes.SmallPicturesPath,
|
||||||
playListConfiguration.Routes.ParentFolders,
|
Guid.NewGuid() + pictureHandler.FileExtension);
|
||||||
playListConfiguration.Routes.SmallPictures,
|
var mediumPictureKeyName = Path.Combine(playListConfiguration.Routes.MediumPicturesPath,
|
||||||
$"{playList.Id}.{pictureHandler.FileExtension}");
|
Guid.NewGuid() + pictureHandler.FileExtension);
|
||||||
var mediumPictureKeyName = Path.Combine(
|
var largePictureKeyName = Path.Combine(playListConfiguration.Routes.LargePicturesPath,
|
||||||
playListConfiguration.Routes.ParentFolders,
|
Guid.NewGuid() + pictureHandler.FileExtension);
|
||||||
playListConfiguration.Routes.MediumPictures,
|
|
||||||
$"{playList.Id}.{pictureHandler.FileExtension}");
|
|
||||||
var largePictureKeyName = Path.Combine(
|
|
||||||
playListConfiguration.Routes.ParentFolders,
|
|
||||||
playListConfiguration.Routes.LargePictures,
|
|
||||||
$"{playList.Id}.{pictureHandler.FileExtension}");
|
|
||||||
|
|
||||||
await eventBus.PublishAsync(new UpdatePlayListPictureEvent(
|
await eventBus.PublishAsync(new UpdatePlayListPictureEvent(
|
||||||
playList.Id,
|
playList.Id,
|
||||||
|
|||||||
@@ -31,19 +31,13 @@ namespace Musify.Application.PlayLists.Handlers
|
|||||||
var keysToRemove = new List<string>();
|
var keysToRemove = new List<string>();
|
||||||
|
|
||||||
if (playList.SmallPictureKeyName != playListConfiguration.Routes.PresetSmallPicture)
|
if (playList.SmallPictureKeyName != playListConfiguration.Routes.PresetSmallPicture)
|
||||||
keysToRemove.Add(Path.Combine(
|
keysToRemove.Add(Path.Combine(playListConfiguration.Routes.SmallPicturesPath,
|
||||||
playListConfiguration.Routes.ParentFolders,
|
|
||||||
playListConfiguration.Routes.SmallPictures,
|
|
||||||
playList.SmallPictureKeyName));
|
playList.SmallPictureKeyName));
|
||||||
if (playList.MediumPictureKeyName != playListConfiguration.Routes.PresetMediumPicture)
|
if (playList.MediumPictureKeyName != playListConfiguration.Routes.PresetMediumPicture)
|
||||||
keysToRemove.Add(Path.Combine(
|
keysToRemove.Add(Path.Combine(playListConfiguration.Routes.MediumPicturesPath,
|
||||||
playListConfiguration.Routes.ParentFolders,
|
|
||||||
playListConfiguration.Routes.MediumPictures,
|
|
||||||
playList.MediumPictureKeyName));
|
playList.MediumPictureKeyName));
|
||||||
if (playList.LargePictureKeyName != playListConfiguration.Routes.PresetLargePicture)
|
if (playList.LargePictureKeyName != playListConfiguration.Routes.PresetLargePicture)
|
||||||
keysToRemove.Add(Path.Combine(
|
keysToRemove.Add(Path.Combine(playListConfiguration.Routes.LargePicturesPath,
|
||||||
playListConfiguration.Routes.ParentFolders,
|
|
||||||
playListConfiguration.Routes.LargePictures,
|
|
||||||
playList.LargePictureKeyName));
|
playList.LargePictureKeyName));
|
||||||
|
|
||||||
foreach (var key in keysToRemove)
|
foreach (var key in keysToRemove)
|
||||||
|
|||||||
@@ -53,20 +53,23 @@ namespace Musify.Application.PlayLists.Handlers
|
|||||||
|
|
||||||
if (playList.SmallPictureKeyName != playListConfiguration.Routes.PresetSmallPicture)
|
if (playList.SmallPictureKeyName != playListConfiguration.Routes.PresetSmallPicture)
|
||||||
await PublishRemoveFileEvent(Path.Combine(
|
await PublishRemoveFileEvent(Path.Combine(
|
||||||
playListConfiguration.Routes.SmallPictures,
|
playListConfiguration.Routes.SmallPicturesPath,
|
||||||
playList.SmallPictureKeyName), cancellationToken);
|
playList.SmallPictureKeyName),
|
||||||
|
cancellationToken);
|
||||||
if (playList.MediumPictureKeyName != playListConfiguration.Routes.PresetMediumPicture)
|
if (playList.MediumPictureKeyName != playListConfiguration.Routes.PresetMediumPicture)
|
||||||
await PublishRemoveFileEvent(Path.Combine(
|
await PublishRemoveFileEvent(Path.Combine(
|
||||||
playListConfiguration.Routes.MediumPictures,
|
playListConfiguration.Routes.MediumPicturesPath,
|
||||||
playList.MediumPictureKeyName), cancellationToken);
|
playList.MediumPictureKeyName),
|
||||||
|
cancellationToken);
|
||||||
if (playList.LargePictureKeyName != playListConfiguration.Routes.PresetLargePicture)
|
if (playList.LargePictureKeyName != playListConfiguration.Routes.PresetLargePicture)
|
||||||
await PublishRemoveFileEvent(Path.Combine(
|
await PublishRemoveFileEvent(Path.Combine(
|
||||||
playListConfiguration.Routes.LargePictures,
|
playListConfiguration.Routes.LargePicturesPath,
|
||||||
playList.LargePictureKeyName), cancellationToken);
|
playList.LargePictureKeyName),
|
||||||
|
cancellationToken);
|
||||||
|
|
||||||
var newImageId = Guid.NewGuid();
|
var newImageId = Guid.NewGuid();
|
||||||
var pictureName = newImageId + request.NewPicture.FileType;
|
var pictureName = newImageId + request.NewPicture.FileType;
|
||||||
var newImageStorageKey = Path.Join(playListConfiguration.Routes.OriginalPictures, pictureName);
|
var newImageStorageKey = Path.Combine(playListConfiguration.Routes.OriginalPicturesPath, pictureName);
|
||||||
|
|
||||||
var uploadResult = await UploadFile(request.NewPicture, newImageStorageKey, cancellationToken);
|
var uploadResult = await UploadFile(request.NewPicture, newImageStorageKey, cancellationToken);
|
||||||
if (!uploadResult.IsSuccess)
|
if (!uploadResult.IsSuccess)
|
||||||
@@ -127,14 +130,14 @@ namespace Musify.Application.PlayLists.Handlers
|
|||||||
async Task PublishUpdateEvent(string originalPictureKeyName, PlayList playList, CancellationToken cancellationToken)
|
async Task PublishUpdateEvent(string originalPictureKeyName, PlayList playList, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var smallPictureKeyName = Path.Combine(
|
var smallPictureKeyName = Path.Combine(
|
||||||
playListConfiguration.Routes.SmallPictures,
|
playListConfiguration.Routes.SmallPicturesPath,
|
||||||
$"{playList.Id}.{pictureHandler.FileExtension}");
|
Guid.NewGuid() + pictureHandler.FileExtension);
|
||||||
var mediumPictureKeyName = Path.Combine(
|
var mediumPictureKeyName = Path.Combine(
|
||||||
playListConfiguration.Routes.MediumPictures,
|
playListConfiguration.Routes.MediumPicturesPath,
|
||||||
$"{playList.Id}.{pictureHandler.FileExtension}");
|
Guid.NewGuid() + pictureHandler.FileExtension);
|
||||||
var largePictureKeyName = Path.Combine(
|
var largePictureKeyName = Path.Combine(
|
||||||
playListConfiguration.Routes.LargePictures,
|
playListConfiguration.Routes.LargePicturesPath,
|
||||||
$"{playList.Id}.{pictureHandler.FileExtension}");
|
Guid.NewGuid() + pictureHandler.FileExtension);
|
||||||
|
|
||||||
await eventBus.PublishAsync(new UpdatePlayListPictureEvent(
|
await eventBus.PublishAsync(new UpdatePlayListPictureEvent(
|
||||||
playList.Id,
|
playList.Id,
|
||||||
|
|||||||
@@ -33,14 +33,12 @@ namespace Musify.Application.Tracks.Handler
|
|||||||
NormalizedTitle = request.Title.Trim().ToUpperInvariant(),
|
NormalizedTitle = request.Title.Trim().ToUpperInvariant(),
|
||||||
OriginalPictureKeyName = originalPictureFileName,
|
OriginalPictureKeyName = originalPictureFileName,
|
||||||
OriginalAudioKeyName = originalAudioFileName,
|
OriginalAudioKeyName = originalAudioFileName,
|
||||||
SmallPictureKeyName = trackConfiguration.Routes.PresetSmallPicture,
|
SmallPictureKeyName = trackConfiguration.Routes.PresetMediumPicture,
|
||||||
MediumPictureKeyName = trackConfiguration.Routes.PresetMediumPicture,
|
MediumPictureKeyName = trackConfiguration.Routes.PresetMediumPicture,
|
||||||
LargePictureKeyName = trackConfiguration.Routes.PresetLargePicture,
|
LargePictureKeyName = trackConfiguration.Routes.PresetLargePicture,
|
||||||
};
|
};
|
||||||
|
|
||||||
var originalPictureKeyName = Path.Combine(
|
var originalPictureKeyName = Path.Combine(trackConfiguration.Routes.PresetMediumPicture,
|
||||||
trackConfiguration.Routes.ParentFolder,
|
|
||||||
trackConfiguration.Routes.OriginalPictures,
|
|
||||||
originalPictureFileName);
|
originalPictureFileName);
|
||||||
var pictureUploadResult = await UploadFile(request.Picture, originalPictureKeyName, cancellationToken);
|
var pictureUploadResult = await UploadFile(request.Picture, originalPictureKeyName, cancellationToken);
|
||||||
if (!pictureUploadResult.IsSuccess)
|
if (!pictureUploadResult.IsSuccess)
|
||||||
@@ -50,9 +48,7 @@ namespace Musify.Application.Tracks.Handler
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var audioKeyName = Path.Combine(
|
var audioKeyName = Path.Combine(trackConfiguration.Routes.OriginalAudiosFolder,
|
||||||
trackConfiguration.Routes.ParentFolder,
|
|
||||||
trackConfiguration.Routes.OriginalAudios,
|
|
||||||
Guid.NewGuid() + request.Audio.FileType);
|
Guid.NewGuid() + request.Audio.FileType);
|
||||||
var audioUploadResult = await UploadFile(request.Audio, audioKeyName, cancellationToken);
|
var audioUploadResult = await UploadFile(request.Audio, audioKeyName, cancellationToken);
|
||||||
if (!audioUploadResult.IsSuccess)
|
if (!audioUploadResult.IsSuccess)
|
||||||
@@ -101,18 +97,12 @@ namespace Musify.Application.Tracks.Handler
|
|||||||
|
|
||||||
async Task PublishUpdateEvent(string originalPictureKeyName, Track track, CancellationToken cancellationToken)
|
async Task PublishUpdateEvent(string originalPictureKeyName, Track track, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var smallPictureKeyName = Path.Combine(
|
var smallPictureKeyName = Path.Combine(trackConfiguration.Routes.MediumPicturesPath,
|
||||||
trackConfiguration.Routes.ParentFolder,
|
track.Id + pictureHandler.FileExtension);
|
||||||
trackConfiguration.Routes.SmallPictures,
|
var mediumPictureKeyName = Path.Combine(trackConfiguration.Routes.MediumPicturesPath,
|
||||||
$"{track.Id}.{pictureHandler.FileExtension}");
|
track.Id + pictureHandler.FileExtension);
|
||||||
var mediumPictureKeyName = Path.Combine(
|
var largePictureKeyName = Path.Combine(trackConfiguration.Routes.LargePicturesPath,
|
||||||
trackConfiguration.Routes.ParentFolder,
|
track.Id + pictureHandler.FileExtension);
|
||||||
trackConfiguration.Routes.MediumPictures,
|
|
||||||
$"{track.Id}.{pictureHandler.FileExtension}");
|
|
||||||
var largePictureKeyName = Path.Combine(
|
|
||||||
trackConfiguration.Routes.ParentFolder,
|
|
||||||
trackConfiguration.Routes.LargePictures,
|
|
||||||
$"{track.Id}.{pictureHandler.FileExtension}");
|
|
||||||
|
|
||||||
await eventBus.PublishAsync(new UpdateTrackPictureEvent(
|
await eventBus.PublishAsync(new UpdateTrackPictureEvent(
|
||||||
track.Id,
|
track.Id,
|
||||||
@@ -131,9 +121,7 @@ namespace Musify.Application.Tracks.Handler
|
|||||||
|
|
||||||
async Task PublishTranscodeEvent(Guid trackId, string audioKeyName, CancellationToken cancellationToken)
|
async Task PublishTranscodeEvent(Guid trackId, string audioKeyName, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var destinationFolderAudio = Path.Combine(
|
var destinationFolderAudio = Path.Combine(trackConfiguration.Routes.ProcessedAudioFolder,
|
||||||
trackConfiguration.Routes.ParentFolder,
|
|
||||||
trackConfiguration.Routes.ProcessedAudio,
|
|
||||||
Guid.NewGuid().ToString());
|
Guid.NewGuid().ToString());
|
||||||
|
|
||||||
await eventBus.PublishAsync(new UpdateTrackAudioEvent(
|
await eventBus.PublishAsync(new UpdateTrackAudioEvent(
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
|||||||
var sourceFileExtension = Path.GetExtension(originalFileName);
|
var sourceFileExtension = Path.GetExtension(originalFileName);
|
||||||
var workingDirectory = Path.Combine(executeContext.Arguments.TemporaryRootDirectory, destinationFolderName);
|
var workingDirectory = Path.Combine(executeContext.Arguments.TemporaryRootDirectory, destinationFolderName);
|
||||||
|
|
||||||
|
|
||||||
var sourceFileName = Guid.NewGuid().ToString() + sourceFileExtension;
|
var sourceFileName = Guid.NewGuid().ToString() + sourceFileExtension;
|
||||||
var smallPictureFileName = Guid.NewGuid().ToString() + sourceFileExtension;
|
var smallPictureFileName = Guid.NewGuid().ToString() + sourceFileExtension;
|
||||||
var mediumPictureFileName = Guid.NewGuid().ToString() + sourceFileExtension;
|
var mediumPictureFileName = Guid.NewGuid().ToString() + sourceFileExtension;
|
||||||
|
|||||||
Reference in New Issue
Block a user