Skip to content

Commit

Permalink
release v0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm360 committed Jun 23, 2023
2 parents 816824d + 50609a5 commit b0f5805
Show file tree
Hide file tree
Showing 79 changed files with 2,408 additions and 1,129 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ dotnet_diagnostic.CA1056.severity = none # Asp.Net Core Pages uses strings na
# CA1303: Do not pass literals as localized parameters
dotnet_diagnostic.CA1303.severity = none # Don't need translated exceptions

# CA1308: Normalize strings to uppercase
dotnet_diagnostic.CA1308.severity = none # Also to lower is required

# CA1707: Identifiers should not contain underscores
dotnet_diagnostic.CA1707.severity = none # I like underscores into constants name

Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/publish-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

strategy:
matrix:
kind: ['linux', 'linuxselfcontained', 'macos', 'macosselfcontained', 'windows']
kind: ['linux', 'linuxselfcontained', 'macos', 'macosselfcontained', 'windows', 'windowsselfcontained']
include:
- kind: linux
os: ubuntu-latest
Expand All @@ -33,6 +33,10 @@ jobs:
os: windows-latest
target: win-x64
frameworktype: --no-self-contained
- kind: windowsselfcontained
os: windows-latest
target: win-x64
frameworktype: --self-contained

runs-on: ${{ matrix.os }}

Expand Down
51 changes: 50 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Currently exists two versions:
* `EthernaVideoImporter` for a generic use
* `EthernaVideoImporter.Devcon` to import specifically Devcon Archive's videos

Etherna Video Importer requires at least [.Net 7](https://dotnet.microsoft.com/en-us/download) installed on local machine to run, or it needs the `selfcontained` version of package, that already contains framework dependencies.
Etherna Video Importer requires at least [.NET 7 Runtime](https://dotnet.microsoft.com/download/dotnet/7.0) and [ASP.NET Core 7 Runtime](https://dotnet.microsoft.com/download/dotnet/7.0) installed on local machine to run, or it needs the `selfcontained` version of package, that already contains framework dependencies.

**Warning**: this client still requires to be able to open a browser to provide authentication.
Future releases will improve this aspect accepting API keys instead.
Expand All @@ -27,6 +27,7 @@ Usage: EthernaVideoImporter SOURCE_TYPE SOURCE_URI [OPTIONS]
Source types:
ytchannel YouTube channel
ytvideo YouTube video
local Local videos
Options:
-ff Path FFmpeg (default dir: .\FFmpeg\)
Expand All @@ -36,6 +37,16 @@ Options:
-m Remove indexed videos generated with this tool but missing from source
-e Remove indexed videos not generated with this tool
-u Try to unpin contents removed from index
-i Ignore new version of EthernaVideoImporter
--beenode Use bee native node
--beenodeurl Url of Bee node (default value: http://localhost/)
--beenodeapiport Port used by API (default value: 1633)
--beenodedebugport Port used by Debug (default value: 1635)
--skip1440 Skip upload resolution 1440p
--skip1080 Skip upload resolution 1080p
--skip720 Skip upload resolution 720p
--skip480 Skip upload resolution 480p
--skip360 Skip upload resolution 360p
Run 'EthernaVideoImporter -h' to print help
```
Expand All @@ -52,10 +63,48 @@ Options:
-m Remove indexed videos generated with this tool but missing from source
-e Remove indexed videos not generated with this tool
-u Try to unpin contents removed from index
-i Ignore new version of EthernaVideoImporter.Devcon
--beenode Use bee native node
--beenodeurl Url of Bee node (default value: http://localhost/)
--beenodeapiport Port used by API (default value: 1633)
--beenodedebugport Port used by Debug (default value: 1635)
--skip1440 Skip upload resolution 1440p
--skip1080 Skip upload resolution 1080p
--skip720 Skip upload resolution 720p
--skip480 Skip upload resolution 480p
--skip360 Skip upload resolution 360p
Run 'EthernaVideoImporter.Devcon -h' to print help
```

#### Local videos

To import from local videos you will need a metadata descriptor file.
Metadata is a Json file with following structure.

```
[
{
"Id": "myId1",
"Title": "My video 1 title",
"Description": "My video description",
"VideoFilePath": "my/source/local/video/path.mp4",
"ThumbnailFilePath": "my/optional/thumbnail/path.jpg"
},
{
"Id": "myId2",
"Title": "My video 2 title",
...
},
...
]
```

The `Id` field is mandatory, and is needed to trace same video through different executions. Each Id needs to be unique in the file.
The `ThumbnailFilePath` field is optional.

The Json file path needs to be passed as source uri with the source type `local`.

# Issue reports
If you've discovered a bug, or have an idea for a new feature, please report it to our issue manager based on Jira https://etherna.atlassian.net/projects/EVI.

Expand Down
26 changes: 24 additions & 2 deletions src/EthernaVideoImporter.Core/CommonConsts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,30 @@
using Etherna.BeeNet.Clients.DebugApi;
using Etherna.BeeNet.Clients.GatewayApi;
using System;
using System.IO;
using System.Runtime.InteropServices;

namespace Etherna.VideoImporter.Core
{
public sealed class CommonConsts
{
public const int BeeNodeGatewayPort = 443;
public const int BeeApiPort = 1633;
public const int BeeDebugPort = 1635;
public const string BeeNodeUrl = "http://localhost/";
public const GatewayApiVersion BeeNodeGatewayVersion = GatewayApiVersion.v4_0_0;
public const DebugApiVersion BeeNodeDebugVersion = DebugApiVersion.v4_0_0;
public const string DefaultFFmpegFolder = @".\FFmpeg\";
public const int DownloadMaxRetry = 3;
public static readonly TimeSpan DownloadTimespanRetry = TimeSpan.FromMilliseconds(3500);
public const string EthernaCreditUrl = "https://credit.etherna.io/";
public const string EthernaIndexUrl = "https://index.etherna.io/";
public const string EthernaIndexContentUrlPrefix = "https://etherna.io/embed/";
public const int EthernaGatewayPort = 443;
public const string EthernaGatewayUrl = "https://gateway.etherna.io/";
public const string EthernaPermalinkContentUrlPrefix = "https://etherna.io/embed/";
public const string EthernaSsoClientId = "ethernaVideoImporterId";
public const string EthernaServicesClientName = "ethernaServicesClient";
public const string EthernaSsoUrl = "https://sso.etherna.io/";
public const string EthernaVideoImporterClientId = "ethernaVideoImporterId";
public static string FFMpegBinaryName
{
get
Expand All @@ -47,7 +53,23 @@ public static string FFMpegBinaryName
throw new InvalidOperationException("OS not supported");
}
}
public static string FFProbeBinaryName
{
get
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
return "ffprobe.exe";
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
return "ffprobe";
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
return "ffprobe";

throw new InvalidOperationException("OS not supported");
}
}
public static readonly TimeSpan GnosisBlockTime = TimeSpan.FromSeconds(5);
public const string ImporterIdentifier = "EthernaImporter";
public const string SwarmNullReference = "0000000000000000000000000000000000000000000000000000000000000000";
public static DirectoryInfo TempDirectory { get; } = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), ImporterIdentifier));
}
}
82 changes: 82 additions & 0 deletions src/EthernaVideoImporter.Core/EthernaVersionControl.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Json;
using System.Reflection;
using System.Threading.Tasks;
using Etherna.VideoImporter.Core.Models.GitHubDto;

namespace Etherna.VideoImporter.Core
{
public static class EthernaVersionControl
{
// Fields.
private static Version? _currentVersion;

// Properties.
public static Version CurrentVersion
{
get
{
if (_currentVersion is null)
{
var assemblyVersion = Assembly.GetExecutingAssembly().GetCustomAttribute<AssemblyFileVersionAttribute>()?.Version ??
throw new InvalidOperationException("Invalid assembly version");
_currentVersion = new Version(assemblyVersion);
}
return _currentVersion;
}
}

// Public methods.
public static async Task<bool> CheckNewVersionAsync()
{
// Get current version.

Console.WriteLine();
Console.WriteLine($"Etherna Video Importer (v{CurrentVersion})");
Console.WriteLine();

// Get last version form github releases.
try
{
using HttpClient httpClient = new();
httpClient.DefaultRequestHeaders.Add("User-Agent", "EthernaImportClient");
var gitUrl = "https://api.github.com/repos/Etherna/etherna-video-importer/releases";
var response = await httpClient.GetAsync(gitUrl);
var gitReleaseVersionsDto = await response.Content.ReadFromJsonAsync<List<GitReleaseVersionDto>>();

if (gitReleaseVersionsDto is null || !gitReleaseVersionsDto.Any())
return false;

var lastVersion = gitReleaseVersionsDto
.Select(git => new
{
Version = new Version(git.Tag_name.Replace("v", "", StringComparison.OrdinalIgnoreCase)),
Url = git.Html_url
})
.OrderByDescending(v => v.Version)
.First();

if (lastVersion.Version > CurrentVersion)
{
Console.WriteLine($"A new release is available: {lastVersion.Version}");
Console.WriteLine($"Upgrade now, or check out the release page at:");
Console.WriteLine($" {lastVersion.Url}");
return true;
}
else
return false;
}
catch (Exception ex)
{
Console.ForegroundColor = ConsoleColor.DarkRed;
Console.WriteLine("Unable to check last version on GitHub");
Console.WriteLine($"Error: {ex.Message}");
Console.ResetColor();
return false;
}
}
}
}
32 changes: 24 additions & 8 deletions src/EthernaVideoImporter.Core/EthernaVideoImporter.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
Expand All @@ -11,20 +11,36 @@
<Nullable>enable</Nullable>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AnalysisMode>AllEnabledByDefault</AnalysisMode>

<RepositoryUrl>https://github.com/Etherna/etherna-video-importer</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Bee.Net" Version="0.2.0-alpha.172" />
<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.2.11" />
<PackageReference Include="EthernaServicesClient" Version="0.3.0-alpha.60" />
<PackageReference Include="Etherna.YoutubeDownloader.Converter" Version="6.3.4" />
<PackageReference Include="EthernaServicesClient.Users.Native" Version="0.3.0" />
<PackageReference Include="GitVersion.MsBuild" Version="5.12.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Keccak256" Version="1.0.0" />
<PackageReference Include="MedallionShell" Version="1.6.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.4" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="2.88.3" />
<PackageReference Include="IdentityModel.OidcClient" Version="5.2.1" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.27.0" />
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit b0f5805

Please sign in to comment.