Skip to content

Commit 519611e

Browse files
ElevenLabs-DotNet 3.0.3 (#62)
- Fix DubbingRequest.DropBackgroundAudio flag not properly being set - Added DubbingRequest.UseProfanityFilter flag
1 parent e642904 commit 519611e

File tree

5 files changed

+30
-7
lines changed

5 files changed

+30
-7
lines changed

ElevenLabs-DotNet-Tests/TestFixture_08_DubbingEndpoint.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public async Task Test_02_Dubbing_Url()
6262
{
6363
Assert.NotNull(ElevenLabsClient.DubbingEndpoint);
6464

65-
var request = new DubbingRequest(new Uri("https://youtu.be/Zo5-rhYOlNk"), "ja", "en", 1, true);
65+
var request = new DubbingRequest(new Uri("https://youtu.be/Zo5-rhYOlNk"), "ja", "en", 1, watermark: true, dropBackgroundAudio: true);
6666
var metadata = await ElevenLabsClient.DubbingEndpoint.DubAsync(request, progress: new Progress<DubbingProjectMetadata>(metadata =>
6767
{
6868
switch (metadata.Status)

ElevenLabs-DotNet/Dubbing/DubbingEndpoint.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,16 @@ public async Task<DubbingProjectMetadata> DubAsync(DubbingRequest request, int?
8888
{
8989
payload.Add(new StringContent(request.HighestResolution.Value.ToString()), "highest_resolution");
9090
}
91+
92+
if (request.DropBackgroundAudio.HasValue)
93+
{
94+
payload.Add(new StringContent(request.DropBackgroundAudio.ToString().ToLower()), "drop_background_audio");
95+
}
96+
97+
if (request.UseProfanityFilter.HasValue)
98+
{
99+
payload.Add(new StringContent(request.UseProfanityFilter.ToString().ToLower()), "use_profanity_filter");
100+
}
91101
}
92102
finally
93103
{

ElevenLabs-DotNet/Dubbing/DubbingRequest.cs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ public DubbingRequest(
1818
int? endTime = null,
1919
bool? highestResolution = null,
2020
bool? dropBackgroundAudio = null,
21+
bool? useProfanityFilter = null,
2122
string projectName = null)
22-
: this([filePath], targetLanguage, sourceLanguage, numberOfSpeakers, watermark, startTime, endTime, highestResolution, dropBackgroundAudio, projectName)
23+
: this([filePath], targetLanguage, sourceLanguage, numberOfSpeakers, watermark, startTime, endTime, highestResolution, dropBackgroundAudio, useProfanityFilter, projectName)
2324
{
2425
}
2526

@@ -33,8 +34,9 @@ public DubbingRequest(
3334
int? endTime = null,
3435
bool? highestResolution = null,
3536
bool? dropBackgroundAudio = null,
37+
bool? useProfanityFilter = null,
3638
string projectName = null)
37-
: this(targetLanguage, null, filePaths, sourceLanguage, numberOfSpeakers, watermark, startTime, endTime, highestResolution, dropBackgroundAudio, projectName)
39+
: this(targetLanguage, null, filePaths, sourceLanguage, numberOfSpeakers, watermark, startTime, endTime, highestResolution, dropBackgroundAudio, useProfanityFilter, projectName)
3840
{
3941
}
4042

@@ -48,8 +50,9 @@ public DubbingRequest(
4850
int? endTime = null,
4951
bool? highestResolution = null,
5052
bool? dropBackgroundAudio = null,
53+
bool? useProfanityFilter = null,
5154
string projectName = null)
52-
: this(targetLanguage, sourceUrl, null, sourceLanguage, numberOfSpeakers, watermark, startTime, endTime, highestResolution, dropBackgroundAudio, projectName)
55+
: this(targetLanguage, sourceUrl, null, sourceLanguage, numberOfSpeakers, watermark, startTime, endTime, highestResolution, dropBackgroundAudio, useProfanityFilter, projectName)
5356
{
5457
}
5558

@@ -64,6 +67,7 @@ private DubbingRequest(
6467
int? endTime = null,
6568
bool? highestResolution = null,
6669
bool? dropBackgroundAudio = null,
70+
bool? useProfanityFilter = null,
6771
string projectName = null)
6872
{
6973
ArgumentException.ThrowIfNullOrWhiteSpace(targetLanguage);
@@ -122,6 +126,7 @@ private DubbingRequest(
122126
EndTime = endTime;
123127
HighestResolution = highestResolution;
124128
DropBackgroundAudio = dropBackgroundAudio;
129+
UseProfanityFilter = useProfanityFilter;
125130
ProjectName = projectName;
126131
}
127132

@@ -184,6 +189,11 @@ private DubbingRequest(
184189
/// </summary>
185190
public bool? DropBackgroundAudio { get; }
186191

192+
/// <summary>
193+
/// [BETA] Whether transcripts should have profanities censored with the words '[censored]'.
194+
/// </summary>
195+
public bool? UseProfanityFilter { get; }
196+
187197
/// <summary>
188198
/// Name of the dubbing project.
189199
/// </summary>

ElevenLabs-DotNet/ElevenLabs-DotNet.csproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@ All copyrights, trademarks, logos, and assets are the property of their respecti
2525
<SignAssembly>false</SignAssembly>
2626
<IncludeSymbols>true</IncludeSymbols>
2727
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
28-
<Version>3.0.2</Version>
28+
<Version>3.0.3</Version>
2929
<PackageReleaseNotes>
30+
Version 3.0.3
31+
- Fix DubbingRequest.DropBackgroundAudio flag not properly being set
32+
- Added DubbingRequest.UseProfanityFilter flag
3033
Version 3.0.2
3134
- Cleanup and polish for Dubbing API
3235
Version 3.0.1

ElevenLabs-DotNet/Voices/SharedVoicesEndpoint.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ public SharedVoicesEndpoint(ElevenLabsClient client) : base(client) { }
2121
/// <returns><see cref="SharedVoiceList"/>.</returns>
2222
public async Task<SharedVoiceList> GetSharedVoicesAsync(SharedVoiceQuery query = null, CancellationToken cancellationToken = default)
2323
{
24-
using var response = await client.Client.GetAsync(GetUrl(queryParameters: query?.ToQueryParams()), cancellationToken);
25-
var responseAsString = await response.ReadAsStringAsync(EnableDebug, cancellationToken);
24+
using var response = await client.Client.GetAsync(GetUrl(queryParameters: query?.ToQueryParams()), cancellationToken).ConfigureAwait(false);
25+
var responseAsString = await response.ReadAsStringAsync(EnableDebug, cancellationToken).ConfigureAwait(false);
2626
return JsonSerializer.Deserialize<SharedVoiceList>(responseAsString, ElevenLabsClient.JsonSerializationOptions);
2727
}
2828
}

0 commit comments

Comments
 (0)