Skip to content

Commit

Permalink
merge hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm360 committed Jul 20, 2023
2 parents 2fe6b68 + fc6d922 commit 96fb8b0
Show file tree
Hide file tree
Showing 40 changed files with 1,729 additions and 467 deletions.
9 changes: 9 additions & 0 deletions EthernaVideoImporter.sln
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EthernaVideoImporter.Core",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EthernaVideoImporter.Devcon", "src\EthernaVideoImporter.Devcon\EthernaVideoImporter.Devcon.csproj", "{9CBEB485-1E55-4457-B127-7E0A75602939}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{E8E17BD2-C38A-46B5-BA9D-B5A9561BAFC8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EthernaVideoImporter.Core.Tests", "test\EthernaVideoImporter.Core.Tests\EthernaVideoImporter.Core.Tests.csproj", "{CBC4D9D1-6291-433F-80D7-4607D1CABC48}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -41,6 +45,10 @@ Global
{9CBEB485-1E55-4457-B127-7E0A75602939}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9CBEB485-1E55-4457-B127-7E0A75602939}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9CBEB485-1E55-4457-B127-7E0A75602939}.Release|Any CPU.Build.0 = Release|Any CPU
{CBC4D9D1-6291-433F-80D7-4607D1CABC48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CBC4D9D1-6291-433F-80D7-4607D1CABC48}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CBC4D9D1-6291-433F-80D7-4607D1CABC48}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CBC4D9D1-6291-433F-80D7-4607D1CABC48}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -50,6 +58,7 @@ Global
{1E5D1B5B-4926-4F7F-97A9-19DAE5065550} = {6647EBF4-A8E7-4987-9A43-CF6F9DA1A3AF}
{CD81CBF2-FBFE-4BB2-A777-5F5B9EFAB80E} = {0A3B4988-7F19-430D-BF6C-31AFD0234C44}
{9CBEB485-1E55-4457-B127-7E0A75602939} = {0A3B4988-7F19-430D-BF6C-31AFD0234C44}
{CBC4D9D1-6291-433F-80D7-4607D1CABC48} = {E8E17BD2-C38A-46B5-BA9D-B5A9561BAFC8}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {09CED59B-3404-49D6-ADE2-70D93A110B72}
Expand Down
5 changes: 3 additions & 2 deletions src/EthernaVideoImporter.Core/CommonConsts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public sealed class CommonConsts
public static readonly string DefaultFFmpegFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "FFmpeg");
public const int DownloadMaxRetry = 3;
public static readonly TimeSpan DownloadTimespanRetry = TimeSpan.FromMilliseconds(3500);
public const string EthereumNullAddress = "0x0000000000000000000000000000000000000000";
public const string EthernaCreditUrl = "https://credit.etherna.io/";
public const string EthernaIndexUrl = "https://index.etherna.io/";
public const string EthernaIndexContentUrlPrefix = "https://etherna.io/embed/";
Expand All @@ -39,7 +40,7 @@ public sealed class CommonConsts
public const string EthernaServicesClientName = "ethernaServicesClient";
public const string EthernaSsoUrl = "https://sso.etherna.io/";
public const string EthernaVideoImporterClientId = "ethernaVideoImporterId";
public static string FFMpegBinaryName
public static string FFmpegBinaryName
{
get
{
Expand All @@ -53,7 +54,7 @@ public static string FFMpegBinaryName
throw new InvalidOperationException("OS not supported");
}
}
public static string FFProbeBinaryName
public static string FFprobeBinaryName
{
get
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<ItemGroup>
<PackageReference Include="Bee.Net" Version="0.2.0-alpha.189" />
<PackageReference Include="Blurhash.SkiaSharp" Version="2.0.0" />
<PackageReference Include="Etherna.YoutubeDownloader.Converter" Version="6.3.4" />
<PackageReference Include="Etherna.YoutubeDownloader.Converter" Version="6.3.5" />
<PackageReference Include="EthernaServicesClient.Users.Native" Version="0.3.2" />
<PackageReference Include="GitVersion.MsBuild" Version="5.12.0">
<PrivateAssets>all</PrivateAssets>
Expand Down
2 changes: 1 addition & 1 deletion src/EthernaVideoImporter.Core/EthernaVideoImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public async Task RunAsync(
var video = new Video(videoMetadata, videoSwarmFile, thumbnailFiles);

// Upload new manifest.
var metadataVideo = new ManifestDto(video, alreadyPresentVideo.LastValidManifest.BatchId, userEthAddress);
var metadataVideo = await ManifestDto.BuildNewAsync(video, alreadyPresentVideo.LastValidManifest.BatchId, userEthAddress);
updatedPermalinkHash = await videoUploaderService.UploadVideoManifestAsync(metadataVideo, pinVideos, offerVideos);

// Update on index.
Expand Down
31 changes: 0 additions & 31 deletions src/EthernaVideoImporter.Core/Extensions/StringExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,44 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.

using Etherna.VideoImporter.Core.Models.Domain;
using System;
using System.IO;
using System.Linq;
using System.Text;

namespace Etherna.VideoImporter.Core.Extensions
{
public static class StringExtensions
{
public static PathType GetPathType(this string path)
{
if (string.IsNullOrEmpty(path))
throw new ArgumentException("Path cannot be null or empty", nameof(path));
if (path.Intersect(Path.GetInvalidPathChars()).Any())
throw new ArgumentException("Path contains invalid chars", nameof(path));

// Check if it's a URL.
if (Uri.TryCreate(path, UriKind.Absolute, out var _))
return PathType.Url;

// Check if it's an absolute path.
if (Path.IsPathRooted(path))
return PathType.Absolute;

// If it's not a URL or an absolute path, it's a relative path.
return PathType.Relative;
}

public static string ToAbsolutePath(this string path, string currentDirectory) =>
path.GetPathType() switch
{
PathType.Relative => Path.Combine(currentDirectory, path),
PathType.Absolute => path,
PathType.Url => path,
_ => throw new InvalidOperationException()
};

public static string ToSafeFileName(this string value)
{
var strBuilder = new StringBuilder(value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,17 @@
// See the License for the specific language governing permissions and
// limitations under the License.

using System.Net.Http;

namespace Etherna.VideoImporter.Core.Models.Domain
{
public class AudioLocalFile : LocalFileBase
public sealed class AudioSourceFile : SourceFile
{
// Constructors.
public AudioLocalFile(
string filePath,
long byteSize)
: base(filePath, byteSize)
public AudioSourceFile(
SourceUri fileUri,
IHttpClientFactory httpClientFactory)
: base(fileUri, httpClientFactory)
{ }
}
}
12 changes: 5 additions & 7 deletions src/EthernaVideoImporter.Core/Models/Domain/FileBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,16 @@
// See the License for the specific language governing permissions and
// limitations under the License.

using System.Threading.Tasks;

namespace Etherna.VideoImporter.Core.Models.Domain
{
public abstract class FileBase : IFile
{
// Constructors.
protected FileBase(long byteSize)
{
ByteSize = byteSize;
}

// Properties.
public long ByteSize { get; }
public string? SwarmHash { get; protected set; }

// Methods.
public abstract Task<long> GetByteSizeAsync();
}
}
9 changes: 7 additions & 2 deletions src/EthernaVideoImporter.Core/Models/Domain/IFile.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
namespace Etherna.VideoImporter.Core.Models.Domain
using System.Threading.Tasks;

namespace Etherna.VideoImporter.Core.Models.Domain
{
public interface IFile
{
long ByteSize { get; }
// Properties.
string? SwarmHash { get; }

// Methods.
Task<long> GetByteSizeAsync();
}
}
27 changes: 0 additions & 27 deletions src/EthernaVideoImporter.Core/Models/Domain/LocalFileBase.cs

This file was deleted.

9 changes: 0 additions & 9 deletions src/EthernaVideoImporter.Core/Models/Domain/PathType.cs

This file was deleted.

Loading

0 comments on commit 96fb8b0

Please sign in to comment.