Skip to content

Commit

Permalink
FakeYou.NET -> FakeYouSharp
Browse files Browse the repository at this point in the history
  • Loading branch information
dclipca committed Jan 1, 2025
1 parent 61e4e15 commit bc77d11
Show file tree
Hide file tree
Showing 31 changed files with 102 additions and 133 deletions.
12 changes: 6 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Contributing to FakeYou.NET
# Contributing to FakeYouSharp

## Publishing to NuGet

Expand All @@ -7,16 +7,16 @@
2. Generate an API key:
- Go to https://www.nuget.org/account/apikeys
- Click "Create"
- Name: "FakeYou.NET Publishing" (or your preferred name)
- Name: "FakeYouSharp Publishing" (or your preferred name)
- Expiration: 365 days
- Select "Push new packages and package versions"
- Glob Pattern: "FakeYou.NET*"
- Glob Pattern: "FakeYouSharp*"
- Save the generated key securely

### Publishing Process
1. Update version in `FakeYou.NET/FakeYou.NET.csproj`:
1. Update version in `FakeYouSharp/FakeYouSharp.NET.csproj`:
```xml
<Version>1.0.0</Version> <!-- Change this to new version -->
<Version>1.1.0</Version> <!-- Change this to new version -->
```

2. Clean and pack:
Expand All @@ -27,7 +27,7 @@

3. Push to NuGet:
```bash
dotnet nuget push .\FakeYou.NET\bin\Release\FakeYou.NET.1.0.0.nupkg --api-key YOUR_API_KEY --source https://api.nuget.org/v3/index.json
dotnet nuget push .\FakeYouSharp\bin\Release\FakeYouSharp.1.0.0.nupkg --api-key YOUR_API_KEY --source https://api.nuget.org/v3/index.json
```
Replace:
- `1.0.0` with your new version number
Expand Down
13 changes: 0 additions & 13 deletions FakeYou.NET.Tests/.idea/.idea.FakeYou.NET.dir/.idea/.gitignore

This file was deleted.

1 change: 0 additions & 1 deletion FakeYou.NET.Tests/.idea/.idea.FakeYou.NET.dir/.idea/.name

This file was deleted.

This file was deleted.

6 changes: 0 additions & 6 deletions FakeYou.NET.Tests/.idea/.idea.FakeYou.NET.dir/.idea/vcs.xml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using Xunit;
using FluentAssertions;
using FakeYou.NET.Audio;
using System.Buffers.Binary;
using FakeYouSharp.Audio;
using FluentAssertions;
using Xunit;

namespace FakeYou.NET.Tests.Audio
namespace FakeYouSharp.Tests.Audio
{
public class WavProcessorTests
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
using Xunit;
using System.Text;
using FakeYouSharp.Client;
using FakeYouSharp.Models;
using FakeYouSharp.Models.Configuration;
using FluentAssertions;
using FakeYou.NET.Client;
using FakeYou.NET.Models;
using FakeYou.NET.Models.Configuration;
using WireMock.Server;
using WireMock.RequestBuilders;
using WireMock.ResponseBuilders;
using Microsoft.Extensions.Logging;
using Moq;
using System.Text;
using Newtonsoft.Json;
using WireMock.Logging;
using WireMock.RequestBuilders;
using WireMock.ResponseBuilders;
using WireMock.Server;
using Xunit;

namespace FakeYou.NET.Tests.Client
namespace FakeYouSharp.Tests.Client
{
public class FakeYouClientTests : IDisposable
{
Expand Down Expand Up @@ -172,7 +172,7 @@ public async Task GenerateAudioAsync_Failed_ThrowsException()
// Act & Assert
await _client.Invoking(c => c.GenerateAudioAsync(modelToken, text))
.Should()
.ThrowAsync<FakeYouException>()
.ThrowAsync<FakeYouSharpException>()
.Where(ex => ex.StatusCode == 500);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<ProjectReference Include="..\FakeYou.NET\FakeYou.NET.csproj" />
<ProjectReference Include="..\FakeYouSharp\FakeYouSharp.csproj" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using Xunit;
using System.Diagnostics;
using FakeYouSharp.Audio;
using FakeYouSharp.Client;
using FluentAssertions;
using FakeYou.NET.Client;
using Microsoft.Extensions.Logging;
using System.Diagnostics;
using Xunit;
using Xunit.Abstractions;
using FakeYou.NET.Audio;

namespace FakeYou.NET.Tests.Integration
namespace FakeYouSharp.Tests.Integration
{
[Collection("FakeYou Tests")]
public class FakeYouClientIntegrationTests : IDisposable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
using Xunit;
using FakeYouSharp.Models;
using FakeYouSharp.Policies;
using FluentAssertions;
using FakeYou.NET.Policies;
using Microsoft.Extensions.Logging;
using Moq;
using System.Net;
using FakeYou.NET.Models;
using Xunit;

namespace FakeYou.NET.Tests.Policies
namespace FakeYouSharp.Tests.Policies
{
public class RetryPolicyTests
{
Expand Down Expand Up @@ -72,7 +71,7 @@ async Task<string> TestOperation()
// Act & Assert
await _policy.Invoking(p => p.ExecuteAsync(TestOperation))
.Should()
.ThrowAsync<FakeYouException>()
.ThrowAsync<FakeYouSharpException>()
.Where(ex => ex.Message.Contains("Operation failed after") &&
ex.InnerException is HttpRequestException);

Expand All @@ -96,7 +95,7 @@ async Task<string> TestOperation()
attempts++;
if (attempts < maxAttempts)
{
throw new FakeYouException("Retry needed", statusCode);
throw new FakeYouSharpException("Retry needed", statusCode);
}
return "success";
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Diagnostics;

namespace FakeYou.NET.Tests.Utils
namespace FakeYouSharp.Tests.Utils
{
public class TestLogger
{
Expand Down
4 changes: 2 additions & 2 deletions FakeYou.NET.sln → FakeYouSharp.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FakeYou.NET", "FakeYou.NET\FakeYou.NET.csproj", "{3AA31654-601E-4A2D-ABAB-66B2C99C9886}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FakeYouSharp", "FakeYouSharp\FakeYouSharp.csproj", "{3AA31654-601E-4A2D-ABAB-66B2C99C9886}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FakeYou.NET.Tests", "FakeYou.NET.Tests\FakeYou.NET.Tests.csproj", "{B4C06852-1A11-45B9-8E83-CF7ABEE36F12}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FakeYouSharp.Tests", "FakeYouSharp.Tests\FakeYouSharp.Tests.csproj", "{B4C06852-1A11-45B9-8E83-CF7ABEE36F12}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace FakeYou.NET.Audio
namespace FakeYouSharp.Audio
{
/// <summary>
/// Represents WAV audio format parameters
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using System;
using System.Buffers.Binary;
using System.IO;

namespace FakeYou.NET.Audio
namespace FakeYouSharp.Audio
{
/// <summary>
/// Platform-agnostic WAV audio processor that can be used with any game engine or application
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
using System.Net.Http.Headers;
using FakeYou.NET.Audio;
using FakeYou.NET.Models.Configuration;
using FakeYou.NET.Models.Progress;
using FakeYou.NET.Models.Requests;
using FakeYou.NET.Models.Responses;
using FakeYou.NET.Models;
using FakeYou.NET.Policies;
using FakeYouSharp.Audio;
using FakeYouSharp.Models;
using FakeYouSharp.Models.Configuration;
using FakeYouSharp.Models.Progress;
using FakeYouSharp.Models.Requests;
using FakeYouSharp.Models.Responses;
using FakeYouSharp.Policies;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;

namespace FakeYou.NET.Client
namespace FakeYouSharp.Client
{
public class FakeYouClient : IFakeYouClient
{
Expand Down Expand Up @@ -78,7 +78,7 @@ public async Task<byte[]> GenerateAudioAsync(string modelToken, string text, Can
var ttsResponse = await RequestTtsAsync(ttsRequest, cancellationToken);

if (!ttsResponse.Success)
throw new FakeYouException("Failed to start TTS generation");
throw new FakeYouSharpException("Failed to start TTS generation");

ReportProgress(FakeYouProgressState.Queued, "Request queued...");

Expand All @@ -94,7 +94,7 @@ public async Task<byte[]> GenerateAudioAsync(string modelToken, string text, Can
var jobResponse = await GetTtsJobStatusAsync(jobToken, cancellationToken);

if (!jobResponse.Success)
throw new FakeYouException("Failed to get job status");
throw new FakeYouSharpException("Failed to get job status");

var status = jobResponse.State?.Status?.ToLower();
var message = jobResponse.State?.StatusDescription ?? status;
Expand Down Expand Up @@ -125,7 +125,7 @@ public async Task<byte[]> GenerateAudioAsync(string modelToken, string text, Can
return processedAudio;

case "complete_failure" or "dead":
throw new FakeYouException("TTS generation failed: " + message);
throw new FakeYouSharpException("TTS generation failed: " + message);

default:
if (elapsed > _options.TtsTimeout)
Expand Down Expand Up @@ -156,7 +156,7 @@ private async Task<byte[]> DownloadAudioAsync(string audioUrl, CancellationToken
_logger?.LogDebug("Downloaded {Bytes} bytes of audio data", data.Length);

if (data.Length == 0)
throw new FakeYouException("Received empty audio data");
throw new FakeYouSharpException("Received empty audio data");

return data;
}
Expand All @@ -178,7 +178,7 @@ private async Task<TtsResponse> RequestTtsAsync(TtsRequest request, Cancellation

if (!response.IsSuccessStatusCode)
{
throw new FakeYouException(
throw new FakeYouSharpException(
$"TTS request failed: {response.StatusCode}",
(int)response.StatusCode,
responseContent);
Expand All @@ -187,15 +187,15 @@ private async Task<TtsResponse> RequestTtsAsync(TtsRequest request, Cancellation
var result = JsonConvert.DeserializeObject<TtsResponse>(responseContent, _jsonSettings);
if (result == null || string.IsNullOrEmpty(result.InferenceJobToken))
{
throw new FakeYouException("Invalid TTS response - missing job token");
throw new FakeYouSharpException("Invalid TTS response - missing job token");
}

_logger?.LogDebug("Received job token: {JobToken}", result.InferenceJobToken);
return result;
}
catch (Exception ex) when (ex is not FakeYouException)
catch (Exception ex) when (ex is not FakeYouSharpException)
{
throw new FakeYouException("TTS request failed", ex);
throw new FakeYouSharpException("TTS request failed", ex);
}
}

Expand All @@ -214,7 +214,7 @@ private async Task<TtsJobResponse> GetTtsJobStatusAsync(string jobToken, Cancell

if (!response.IsSuccessStatusCode)
{
throw new FakeYouException(
throw new FakeYouSharpException(
$"Failed to get job status with code {(int)response.StatusCode}",
(int)response.StatusCode,
content);
Expand All @@ -223,7 +223,7 @@ private async Task<TtsJobResponse> GetTtsJobStatusAsync(string jobToken, Cancell
var result = JsonConvert.DeserializeObject<TtsJobResponse>(content, _jsonSettings);
if (result == null)
{
throw new FakeYouException("Failed to deserialize job response");
throw new FakeYouSharpException("Failed to deserialize job response");
}

_logger?.LogDebug("Job status: {Status}, Audio path: {Path}, Description: {Description}",
Expand All @@ -233,10 +233,10 @@ private async Task<TtsJobResponse> GetTtsJobStatusAsync(string jobToken, Cancell

return result;
}
catch (Exception ex) when (ex is not FakeYouException)
catch (Exception ex) when (ex is not FakeYouSharpException)
{
_logger?.LogError(ex, "Failed to get job status for token {JobToken}", jobToken);
throw new FakeYouException("Failed to get job status", ex);
throw new FakeYouSharpException("Failed to get job status", ex);
}
}

Expand All @@ -254,7 +254,7 @@ public async Task<IReadOnlyList<VoiceModel>> GetVoiceModelsAsync(CancellationTok

if (!response.IsSuccessStatusCode)
{
throw new FakeYouException(
throw new FakeYouSharpException(
$"Request failed: {response.StatusCode}",
(int)response.StatusCode,
content);
Expand All @@ -273,7 +273,7 @@ public async Task<IReadOnlyList<VoiceModel>> GetVoiceModelsAsync(CancellationTok

if (result == null || !result.Success)
{
throw new FakeYouException("Failed to get voice models");
throw new FakeYouSharpException("Failed to get voice models");
}

foreach (var model in result.Models.Take(5))
Expand All @@ -284,7 +284,7 @@ public async Task<IReadOnlyList<VoiceModel>> GetVoiceModelsAsync(CancellationTok

if (!result.Models.Any())
{
throw new FakeYouException("No voice models found in response");
throw new FakeYouSharpException("No voice models found in response");
}

return result.Models;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using FakeYou.NET.Models.Progress;
using FakeYou.NET.Models.Responses;
using FakeYouSharp.Models.Progress;
using FakeYouSharp.Models.Responses;

namespace FakeYou.NET.Client
namespace FakeYouSharp.Client
{
/// <summary>
/// Interface for interacting with the FakeYou TTS API
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using FakeYou.NET.Audio;
using FakeYouSharp.Audio;

namespace FakeYou.NET.Extensions
namespace FakeYouSharp.Extensions
{
/// <summary>
/// Extension methods for audio processing operations
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace FakeYou.NET.Extensions;
namespace FakeYouSharp.Extensions;

public class AudioStreamExtensions
{
Expand Down
Loading

0 comments on commit bc77d11

Please sign in to comment.