Skip to content

Commit

Permalink
Merge pull request #3 from Anime-Manga/dev
Browse files Browse the repository at this point in the history
## [2.0.2] - 16-10-2023
  • Loading branch information
cesxhin authored Oct 16, 2023
2 parents 17a3ee1 + e56505a commit c06436e
Show file tree
Hide file tree
Showing 25 changed files with 339 additions and 178 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ jobs:
id: meta
uses: docker/[email protected]
with:
images: ${{ secrets.DOCKER_USER }}/animemanga-conversionservice:1.0.1
images: ${{ secrets.DOCKER_USER }}/animemanga-conversionservice:2.0.2

- name: Build the Docker image Conversion Service
uses: docker/build-push-action@v3
with:
context: .
file: Dockerfile
push: true
tags: ${{ secrets.DOCKER_USER }}/animemanga-conversionservice:1.0.1, ${{ secrets.DOCKER_USER }}/animemanga-conversionservice:latest
tags: ${{ secrets.DOCKER_USER }}/animemanga-conversionservice:2.0.2, ${{ secrets.DOCKER_USER }}/animemanga-conversionservice:latest
8 changes: 8 additions & 0 deletions changelog
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Released]
## [2.0.2] - 16-10-2023
### Fixed
- Problem folder not exist

### Removed
- Scale video
- Check healt

## [2.0.1] - 17-06-2023
### Fixed
- Class of models
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ public Task Consume(ConsumeContext<ConversionDTO> context)
.UsingThreads(int.Parse(MAX_THREAD))
.WithVideoCodec(VideoCodec.LibX264)
.WithAudioCodec(AudioCodec.Aac)
.WithVideoFilters(filterOptions => filterOptions
.Scale(VideoSize.FullHd))
.WithFastStart())
.NotifyOnError((outLine) =>
{
Expand Down Expand Up @@ -151,6 +149,11 @@ public Task Consume(ConsumeContext<ConversionDTO> context)
if (episode.StateDownload == "failed")
return Task.CompletedTask;

string pathPublic = Path.GetDirectoryName(message.FilePath);

if(!Directory.Exists(pathPublic))
Directory.CreateDirectory(pathPublic);

File.Move(tempMp4, message.FilePath, true);

//delete old file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.18.1" />
<PackageReference Include="NLog" Version="5.1.3" />
<PackageReference Include="Quartz.Extensions.DependencyInjection" Version="3.4.0" />
<PackageReference Include="Quartz.Extensions.Hosting" Version="3.4.0" />
</ItemGroup>

<ItemGroup>
Expand Down
12 changes: 0 additions & 12 deletions src/Cesxhin.AnimeManga.ConversionService/Program.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
using Cesxhin.AnimeManga.Application.Consumers;
using Cesxhin.AnimeManga.Modules.CronJob;
using Cesxhin.AnimeManga.Modules.Generic;
using FFMpegCore;
using MassTransit;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using NLog;
using Quartz;
using System;

namespace Cesxhin.AnimeManga.ConversionService
Expand Down Expand Up @@ -54,16 +52,6 @@ public static IHostBuilder CreateHostBuilder(string[] args) =>
LogLevel logLevel = NLogManager.GetLevel(level);
NLogManager.Configure(logLevel);

//cronjob for check health
services.AddQuartz(q =>
{
q.UseMicrosoftDependencyInjectionJobFactory();
q.ScheduleJob<HealthJob>(trigger => trigger
.StartNow()
.WithDailyTimeIntervalSchedule(x => x.WithIntervalInSeconds(60)), job => job.WithIdentity("conversion"));
});
services.AddQuartzHostedService(q => q.WaitForJobsToComplete = true);

//set ffmpeg
GlobalFFOptions.Configure(options => options.BinaryFolder = Environment.GetEnvironmentVariable("PATH_FFMPEG").ToLower() ?? "./bin");

Expand Down
4 changes: 3 additions & 1 deletion src/references/Cesxhin.AnimeManga.Domain/DTO/AuthDTO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ namespace Cesxhin.AnimeManga.Domain.DTO
public class AuthDTO
{
public string Username { get; set; }
public int Role { get; set; }

//convert Auth to AuthDTO
public static AuthDTO AuthToAuthDTO(Auth auth)
{
return new AuthDTO
{
Username = auth.Username
Username = auth.Username,
Role = auth.Role
};
}
}
Expand Down
10 changes: 0 additions & 10 deletions src/references/Cesxhin.AnimeManga.Domain/DTO/DiskSpaceDTO.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using Cesxhin.AnimeManga.Domain.Models;

namespace Cesxhin.AnimeManga.Domain.DTO
{
public class GenericBlackListDTO
{
public string Name { get; set; }
public string Url { get; set; }
public string NameCfg { get; set; }

//convert EpisodeBlackList to GenericBlackListDTO
public static GenericBlackListDTO EpisodeBlackListToGenericBlackListDTO(EpisodeBlacklist auth)
{
return new GenericBlackListDTO
{
Name = auth.Name,
Url = auth.Url,
NameCfg = auth.NameCfg,
};
}

//convert ChapterBlackList to GenericBlackListDTO
public static GenericBlackListDTO ChapterBlackListToGenericBlackListDTO(ChapterBlacklist auth)
{
return new GenericBlackListDTO
{
Name = auth.Name,
Url = auth.Url,
NameCfg = auth.NameCfg,
};
}
}
}
37 changes: 37 additions & 0 deletions src/references/Cesxhin.AnimeManga.Domain/DTO/GenericQueueDTO.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using Cesxhin.AnimeManga.Domain.Models;
using System;

namespace Cesxhin.AnimeManga.Domain.DTO
{
public class GenericQueueDTO
{
public string Name { get; set; }
public string Url { get; set; }
public string NameCfg { get; set; }
public long TimeRequest { get; set; } = ((DateTimeOffset)DateTime.UtcNow).ToUnixTimeMilliseconds();

//convert ChapterQueue to GenericQueueDTO
public static GenericQueueDTO ChapterQueueToGenericQueueDTO(ChapterQueue queue)
{
return new GenericQueueDTO
{
Name = queue.Name,
Url = queue.Url,
NameCfg = queue.NameCfg,
TimeRequest = queue.TimeRequest
};
}

//convert EpisodeQueue to GenericQueueDTO
public static GenericQueueDTO EpisodeQueueToGenericQueueDTO(EpisodeQueue queue)
{
return new GenericQueueDTO
{
Name = queue.Name,
Url = queue.Url,
NameCfg = queue.NameCfg,
TimeRequest = queue.TimeRequest
};
}
}
}
9 changes: 0 additions & 9 deletions src/references/Cesxhin.AnimeManga.Domain/DTO/HealthDTO.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Cesxhin.AnimeManga.Domain.DTO
{
public class NotifyDTO
public class NotifyAnimeDTO
{
public string Message { get; set; }
public string Image { get; set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Cesxhin.AnimeManga.Domain.DTO
{
public class NotifyMangaDTO
{
public string Message { get; set; }
public string Image { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Cesxhin.AnimeManga.Domain.DTO
{
public class NotifyRequestAnimeDTO
{
public string Message { get; set; }
public string Image { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Cesxhin.AnimeManga.Domain.DTO
{
public class NotifyRequestMangaDTO
{
public string Message { get; set; }
public string Image { get; set; }
}
}
8 changes: 8 additions & 0 deletions src/references/Cesxhin.AnimeManga.Domain/DTO/ProxyDTO.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Cesxhin.AnimeManga.Domain.DTO
{
public class ProxyDTO
{
public string Action { get; set; } = "restart";
public string Endpoint { get; set; }
}
}
6 changes: 5 additions & 1 deletion src/references/Cesxhin.AnimeManga.Domain/Models/Auth.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@ public class Auth
[Map("password")]
public string Password { get; set; }

[Map("role")]
public int Role { get; set; }

//convert AuthDTO to Auth
public static Auth AuthDTOToAuth(AuthDTO auth)
{
return new Auth
{
Username = auth.Username
Username = auth.Username,
Role = auth.Role,
};
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using Cesxhin.AnimeManga.Domain.DTO;
using RepoDb.Attributes;

namespace Cesxhin.AnimeManga.Domain.Models
{
[Map("chapterblacklist")]
public class ChapterBlacklist
{
[Primary]
[Map("namemanga")]
public string Name { get; set; }

[Map("url")]
public string Url { get; set; }

[Primary]
[Map("namecfg")]
public string NameCfg { get; set; }

//convert GenericBlackListDTO to ChapterBlacklist
public static ChapterBlacklist GenericQueueDTOToChapterBlacklist(GenericBlackListDTO blackList)
{
return new ChapterBlacklist
{
Url = blackList.Url,
NameCfg = blackList.NameCfg,
Name = blackList.Name
};
}
}
}
42 changes: 42 additions & 0 deletions src/references/Cesxhin.AnimeManga.Domain/Models/ChapterQueue.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using Cesxhin.AnimeManga.Domain.DTO;
using RepoDb.Attributes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Cesxhin.AnimeManga.Domain.Models
{
[Map("chapterqueue")]
public class ChapterQueue
{
[Primary]
[Map("namemanga")]
public string Name { get; set; }

[Primary]
[Map("url")]
public string Url { get; set; }

[Primary]
[Map("namecfg")]
public string NameCfg { get; set; }

[Map("timerequest")]
public long TimeRequest { get; set; }


//convert GenericQueueDTO to ChapterQueue
public static ChapterQueue GenericQueueDTOToChapterQueue(GenericQueueDTO queue)
{
return new ChapterQueue
{
Name = queue.Name,
Url = queue.Url,
NameCfg = queue.NameCfg,
TimeRequest = queue.TimeRequest
};
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using Cesxhin.AnimeManga.Domain.DTO;
using RepoDb.Attributes;

namespace Cesxhin.AnimeManga.Domain.Models
{
[Map("episodeblacklist")]
public class EpisodeBlacklist
{
[Primary]
[Map("videoid")]
public string Name { get; set; }

[Map("url")]
public string Url { get; set; }

[Primary]
[Map("namecfg")]
public string NameCfg { get; set; }

//convert GenericBlackListDTO to EpisodeBlacklist
public static EpisodeBlacklist GenericQueueDTOToEpisodeBlacklist(GenericBlackListDTO blackList)
{
return new EpisodeBlacklist
{
Url = blackList.Url,
NameCfg = blackList.NameCfg,
Name = blackList.Name
};
}
}
}
Loading

0 comments on commit c06436e

Please sign in to comment.