Skip to content

Commit

Permalink
Merge pull request #88 from haevg-rz/feature/clientRework
Browse files Browse the repository at this point in the history
update clients for small and large videos
  • Loading branch information
TobiasMeissner2000 authored Oct 26, 2022
2 parents e348139 + 415a6c4 commit be886ab
Show file tree
Hide file tree
Showing 17 changed files with 924 additions and 540 deletions.
30 changes: 15 additions & 15 deletions CfStreamUploader/CfStreamUploader.Core.Test/VideoUploaderTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,29 @@ public class VideoUploaderTest

#region tests

[Fact]
public void GetCmdScriptsTest()
{
#region Assign
//[Fact]
//public void GetCmdScriptsTest()
//{
// #region Assign

const string expectedResult =
"curl -X POST -H \"Authorization: Bearer TestCfToken\" -F file=@TestVideoPath https://api.cloudflare.com/client/v4/accounts/TestCfAccount/stream";
this.VideoManager.VideoPath = "TestVideoPath";
// const string expectedResult =
// "curl -X POST -H \"Authorization: Bearer TestCfToken\" -F file=@TestVideoPath https://api.cloudflare.com/client/v4/accounts/TestCfAccount/stream";
// this.VideoManager.VideoPath = "TestVideoPath";

#endregion
// #endregion

#region Act
// #region Act

var result = this.VideoManager.GetCmdVideoUploadScript(Samples.ConfigSample);
// var result = this.VideoManager.GetCmdVideoUploadScript(Samples.ConfigSample);

#endregion
// #endregion

#region Assert
// #region Assert

Assert.Equal(expectedResult, result);
// Assert.Equal(expectedResult, result);

#endregion
}
// #endregion
//}

#endregion
}
Expand Down
22 changes: 22 additions & 0 deletions CfStreamUploader/CfStreamUploader.Core/CfLogger.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;
using System.IO;
using System.Threading.Tasks;

namespace CfStreamUploader.Core
{
public class CfLogger
{
private string folderpath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "CfStreamUploader", "Logger");

public async Task WriteLogFileAsync(Exception e)
{
if (!File.Exists(folderpath))
Directory.CreateDirectory(folderpath);

var filePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "CfStreamUploader", "Logger", DateTime.Now.ToString("yyyyMMddHHmmssfff") + "log.txt");
var stream = File.CreateText(filePath);
await stream.WriteLineAsync(DateTime.Now.ToString("o")+ e.Message + e.StackTrace);
stream.Close();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,8 @@
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.11.1" />
</ItemGroup>

<ItemGroup>
<None Include="TusClient\TusDotNetClient.csproj" />
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions CfStreamUploader/CfStreamUploader.Core/Core.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ public class Core
public HtmlLayout HtmlLayout { get; } = new HtmlLayout();
public VideoManager VideoManager { get; } = new VideoManager();
public UploadHistoryManager UploadHistoryManager { get; } = new UploadHistoryManager();
public CfLogger Logger { get;} = new CfLogger();
}
}
Loading

0 comments on commit be886ab

Please sign in to comment.