Add Darth Vader as ditto speaker

This commit is contained in:
Brandon Thomas committed 2020-10-08 23:56:14 -04:00
1 parent 57148b7b4b
commit 2e769b5dc8
4 files changed
+25 -3

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 KiB

+24 -2
View File
@@ -34,6 +34,10 @@ const SPEAKER_CATEGORIES : Map<String, SpeakerCategory> = new Map([
class Speaker {
name: string;
slug: string;
// Used for speakers like "darth-vader" who are backed by "james-earl-jones".
apiSlugOverride?: string;
defaultVoice: boolean;
description: string;
avatarUrl?: string;
@@ -41,7 +45,7 @@ class Speaker {
voiceQuality?: number;
categories: SpeakerCategory[];
constructor(name: string, slug: string, description: string, categories: SpeakerCategory[], avatarUrl?: string, fullUrl?: string, voiceQuality?: number, defaultVoice?: boolean) {
constructor(name: string, slug: string, description: string, categories: SpeakerCategory[], avatarUrl?: string, fullUrl?: string, voiceQuality?: number, defaultVoice?: boolean, apiSlugOverride?: string) {
this.name = name;
this.slug = slug;
this.description = description;
@@ -50,6 +54,7 @@ class Speaker {
this.voiceQuality = voiceQuality;
this.defaultVoice = defaultVoice !== undefined && defaultVoice;
this.categories = categories;
this.apiSlugOverride = apiSlugOverride;
}
static fromJson(json: any) : Speaker {
@@ -75,6 +80,13 @@ class Speaker {
return this.name;
}
getApiSlug(): string {
if (this.apiSlugOverride !== undefined) {
return this.apiSlugOverride;
}
return this.slug;
}
getSlug() : string {
return this.slug;
}
@@ -247,6 +259,16 @@ const SPEAKERS : Speaker[] = [
fullUrl: "danny-devito-full.png",
voiceQuality: 6.9,
}),
Speaker.fromJson({
name: "Darth Vader",
slug: "darth-vader",
apiSlugOverride: "james-earl-jones",
description: "Star Wars",
avatarUrl: "darth-vader.jpg",
fullUrl: "darth-vader-full.png",
voiceQuality: 5.5,
categories: ["celebrities"],
}),
Speaker.fromJson({
name: "David Cross",
slug: "david-cross",
@@ -314,7 +336,7 @@ const SPEAKERS : Speaker[] = [
name: "James Earl Jones",
slug: "james-earl-jones",
description: "Actor and voice actor.",
avatarUrl: "darth-vader.jpg",
avatarUrl: "james-earl-jones.jpg",
fullUrl: "james-earl-jones-full.png",
voiceQuality: 5.5,
categories: ["celebrities"],
+1 -1
View File
@@ -40,7 +40,7 @@ class Form extends React.Component<Props, State> {
}
public speak(sentence: string, speaker: Speaker) {
let request = new SpeakRequest(sentence, speaker.getSlug());
let request = new SpeakRequest(sentence, speaker.getApiSlug());
console.log("Making SpeakRequest:", request);