Skip to content

Commit

Permalink
ElevenLabs-DotNet 3.0.3
Browse files Browse the repository at this point in the history
- Fix DubbingRequest.DropBackgroundAudio flag not properly being set
- Added DubbingRequest.UseProfanityFilter flag
  • Loading branch information
StephenHodgson committed Sep 14, 2024
1 parent e642904 commit e4c0a69
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 7 deletions.
2 changes: 1 addition & 1 deletion ElevenLabs-DotNet-Tests/TestFixture_08_DubbingEndpoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public async Task Test_02_Dubbing_Url()
{
Assert.NotNull(ElevenLabsClient.DubbingEndpoint);

var request = new DubbingRequest(new Uri("https://youtu.be/Zo5-rhYOlNk"), "ja", "en", 1, true);
var request = new DubbingRequest(new Uri("https://youtu.be/Zo5-rhYOlNk"), "ja", "en", 1, watermark: true, dropBackgroundAudio: true);
var metadata = await ElevenLabsClient.DubbingEndpoint.DubAsync(request, progress: new Progress<DubbingProjectMetadata>(metadata =>
{
switch (metadata.Status)
Expand Down
10 changes: 10 additions & 0 deletions ElevenLabs-DotNet/Dubbing/DubbingEndpoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,16 @@ public async Task<DubbingProjectMetadata> DubAsync(DubbingRequest request, int?
{
payload.Add(new StringContent(request.HighestResolution.Value.ToString()), "highest_resolution");
}

if (request.DropBackgroundAudio.HasValue)
{
payload.Add(new StringContent(request.DropBackgroundAudio.ToString().ToLower()), "drop_background_audio");
}

if (request.UseProfanityFilter.HasValue)
{
payload.Add(new StringContent(request.UseProfanityFilter.ToString().ToLower()), "use_profanity_filter");
}
}
finally
{
Expand Down
16 changes: 13 additions & 3 deletions ElevenLabs-DotNet/Dubbing/DubbingRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ public DubbingRequest(
int? endTime = null,
bool? highestResolution = null,
bool? dropBackgroundAudio = null,
bool? useProfanityFilter = null,
string projectName = null)
: this([filePath], targetLanguage, sourceLanguage, numberOfSpeakers, watermark, startTime, endTime, highestResolution, dropBackgroundAudio, projectName)
: this([filePath], targetLanguage, sourceLanguage, numberOfSpeakers, watermark, startTime, endTime, highestResolution, dropBackgroundAudio, useProfanityFilter, projectName)
{
}

Expand All @@ -33,8 +34,9 @@ public DubbingRequest(
int? endTime = null,
bool? highestResolution = null,
bool? dropBackgroundAudio = null,
bool? useProfanityFilter = null,
string projectName = null)
: this(targetLanguage, null, filePaths, sourceLanguage, numberOfSpeakers, watermark, startTime, endTime, highestResolution, dropBackgroundAudio, projectName)
: this(targetLanguage, null, filePaths, sourceLanguage, numberOfSpeakers, watermark, startTime, endTime, highestResolution, dropBackgroundAudio, useProfanityFilter, projectName)
{
}

Expand All @@ -48,8 +50,9 @@ public DubbingRequest(
int? endTime = null,
bool? highestResolution = null,
bool? dropBackgroundAudio = null,
bool? useProfanityFilter = null,
string projectName = null)
: this(targetLanguage, sourceUrl, null, sourceLanguage, numberOfSpeakers, watermark, startTime, endTime, highestResolution, dropBackgroundAudio, projectName)
: this(targetLanguage, sourceUrl, null, sourceLanguage, numberOfSpeakers, watermark, startTime, endTime, highestResolution, dropBackgroundAudio, useProfanityFilter, projectName)
{
}

Expand All @@ -64,6 +67,7 @@ private DubbingRequest(
int? endTime = null,
bool? highestResolution = null,
bool? dropBackgroundAudio = null,
bool? useProfanityFilter = null,
string projectName = null)
{
ArgumentException.ThrowIfNullOrWhiteSpace(targetLanguage);
Expand Down Expand Up @@ -122,6 +126,7 @@ private DubbingRequest(
EndTime = endTime;
HighestResolution = highestResolution;
DropBackgroundAudio = dropBackgroundAudio;
UseProfanityFilter = useProfanityFilter;
ProjectName = projectName;
}

Expand Down Expand Up @@ -184,6 +189,11 @@ private DubbingRequest(
/// </summary>
public bool? DropBackgroundAudio { get; }

/// <summary>
/// [BETA] Whether transcripts should have profanities censored with the words '[censored]'.
/// </summary>
public bool? UseProfanityFilter { get; }

/// <summary>
/// Name of the dubbing project.
/// </summary>
Expand Down
5 changes: 4 additions & 1 deletion ElevenLabs-DotNet/ElevenLabs-DotNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ All copyrights, trademarks, logos, and assets are the property of their respecti
<SignAssembly>false</SignAssembly>
<IncludeSymbols>true</IncludeSymbols>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Version>3.0.2</Version>
<Version>3.0.3</Version>
<PackageReleaseNotes>
Version 3.0.3
- Fix DubbingRequest.DropBackgroundAudio flag not properly being set
- Added DubbingRequest.UseProfanityFilter flag
Version 3.0.2
- Cleanup and polish for Dubbing API
Version 3.0.1
Expand Down
4 changes: 2 additions & 2 deletions ElevenLabs-DotNet/Voices/SharedVoicesEndpoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public SharedVoicesEndpoint(ElevenLabsClient client) : base(client) { }
/// <returns><see cref="SharedVoiceList"/>.</returns>
public async Task<SharedVoiceList> GetSharedVoicesAsync(SharedVoiceQuery query = null, CancellationToken cancellationToken = default)
{
using var response = await client.Client.GetAsync(GetUrl(queryParameters: query?.ToQueryParams()), cancellationToken);
var responseAsString = await response.ReadAsStringAsync(EnableDebug, cancellationToken);
using var response = await client.Client.GetAsync(GetUrl(queryParameters: query?.ToQueryParams()), cancellationToken).ConfigureAwait(false);
var responseAsString = await response.ReadAsStringAsync(EnableDebug, cancellationToken).ConfigureAwait(false);
return JsonSerializer.Deserialize<SharedVoiceList>(responseAsString, ElevenLabsClient.JsonSerializationOptions);
}
}
Expand Down

0 comments on commit e4c0a69

Please sign in to comment.