Skip to content

Commit

Permalink
- audio has been replaced with higher quality AI files from OpenAI
Browse files Browse the repository at this point in the history
- local dagger function for generating AI files for the project
- updated default appsettings
- Added lotus timer setting
- refactoring of settings view to breakdown tab content into separate controls
- improving the integration tab for setting validation
- fixed a bug with profiles not saving when having name changed
- json schemas added purely for dx

Signed-off-by: Patrick Magee <[email protected]>
  • Loading branch information
pjmagee committed Nov 24, 2024
1 parent ec0f56b commit bbdf6db
Show file tree
Hide file tree
Showing 50 changed files with 1,021 additions and 544 deletions.
44 changes: 44 additions & 0 deletions D2Helper.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.002.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{F4C18836-BA5F-4A8F-8C9F-A5EA46CFFDED}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dota2Helper", "src\Dota2Helper\Dota2Helper.csproj", "{D44EF4AF-01AA-48C1-8057-8A2F5880FDE4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dota2Helper.Desktop", "src\Dota2Helper.Desktop\Dota2Helper.Desktop.csproj", "{6BD90C02-5ED5-48C8-8FF3-D06058C8DD08}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dota2Helper.Tests", "src\Dota2Helper.Tests\Dota2Helper.Tests.csproj", "{410882A5-4754-4FAE-89C0-B96579EEDFEF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D44EF4AF-01AA-48C1-8057-8A2F5880FDE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D44EF4AF-01AA-48C1-8057-8A2F5880FDE4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D44EF4AF-01AA-48C1-8057-8A2F5880FDE4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D44EF4AF-01AA-48C1-8057-8A2F5880FDE4}.Release|Any CPU.Build.0 = Release|Any CPU
{6BD90C02-5ED5-48C8-8FF3-D06058C8DD08}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6BD90C02-5ED5-48C8-8FF3-D06058C8DD08}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6BD90C02-5ED5-48C8-8FF3-D06058C8DD08}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6BD90C02-5ED5-48C8-8FF3-D06058C8DD08}.Release|Any CPU.Build.0 = Release|Any CPU
{410882A5-4754-4FAE-89C0-B96579EEDFEF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{410882A5-4754-4FAE-89C0-B96579EEDFEF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{410882A5-4754-4FAE-89C0-B96579EEDFEF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{410882A5-4754-4FAE-89C0-B96579EEDFEF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{D44EF4AF-01AA-48C1-8057-8A2F5880FDE4} = {F4C18836-BA5F-4A8F-8C9F-A5EA46CFFDED}
{6BD90C02-5ED5-48C8-8FF3-D06058C8DD08} = {F4C18836-BA5F-4A8F-8C9F-A5EA46CFFDED}
{410882A5-4754-4FAE-89C0-B96579EEDFEF} = {F4C18836-BA5F-4A8F-8C9F-A5EA46CFFDED}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3E52862B-D75C-4986-8E04-407B092C1187}
EndGlobalSection
EndGlobal
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ I do not own a Mac or Linux machine to test the application, so only Windows is

## Features

- An optimised timers view to overlay on top of Dota 2
- Customisable behaviour for each timer such as audio, show/hide
- Profiles for customisation, e.g. heroes, position, or role
- Optimised timers overlay to place on top of Dota 2
- Customisable behaviour for each timer such as name, interval, audio, show/hide
- Playing audio notifications for each timer
- Dark & light mode themes (dire and radiant style)
- Manual reset for dynamic objectives (e.g. Tormentors, Roshan)
- Profiles for additional customisation, e.g. support heroes, pos, or role.
- Dark & light mode themes (dire and radiant style)
- Fake timers are used when the game is not running for easy configuration
- When the game is running, the timers will automatically start based on the game time
- Automatic installation of the game state integration configuration into your Dota 2 folder
Expand Down
84 changes: 79 additions & 5 deletions dagger/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ type GitVersion struct {
WeightedPreReleaseNumber int `json:"WeightedPreReleaseNumber"`
}

// Build the project
func (m *Dota2Helper) Build(
ctx context.Context,
// +defaultPath="."
// +defaultPath="."
git *dagger.Directory) (string, error) {

cache := dag.CacheVolume("nuget-cache")
Expand All @@ -55,9 +56,10 @@ func (m *Dota2Helper) Build(
Stdout(ctx)
}

// Get the semver details of the current git repository
func (m *Dota2Helper) GitVersion(
ctx context.Context,
// +defaultPath="."
// +defaultPath="."
git *dagger.Directory) (GitVersion, error) {

version, err := dag.Container().
Expand All @@ -80,9 +82,10 @@ func (m *Dota2Helper) GitVersion(
return gitVersion, nil
}

// Publish the project in release mode
func (m *Dota2Helper) PublishWindows(
ctx context.Context,
// +defaultPath="."
// +defaultPath="."
git *dagger.Directory,
version string) *dagger.Container {

Expand Down Expand Up @@ -113,9 +116,10 @@ func (m *Dota2Helper) PublishWindows(
})
}

// Zip the published files
func (m *Dota2Helper) Zip(
ctx context.Context,
// +defaultPath="."
// +defaultPath="."
git *dagger.Directory) (*dagger.File, error) {

gitVersion, err := m.GitVersion(ctx, git)
Expand All @@ -136,9 +140,10 @@ func (m *Dota2Helper) Zip(
return zip, nil
}

// Create a release on github
func (m *Dota2Helper) Release(
ctx context.Context,
// +defaultPath="/"
// +defaultPath="/"
git *dagger.Directory,
token *dagger.Secret) error {

Expand Down Expand Up @@ -173,3 +178,72 @@ func (m *Dota2Helper) Release(

return nil
}

func (m *Dota2Helper) CreateAudioAssets(
ctx context.Context,
// +defaultPath="."
git *dagger.Directory,
secret *dagger.Secret) *dagger.Directory {

// list of tts strings to convert to audio
list := []string{
"Pull",
"Stack",
"Bounty",
"Power rune",
"Lotus Pool",
"Wisdom rune",
"Radiant Tormentor",
"Dire Tormentor",
"Roshan",
"Tier 1s",
"Tier 2s",
"Tier 3s",
"Tier 4s",
"Tier 5s",
}

// loop and create audio files
assets := dag.Directory()
for _, text := range list {
audio, err := m.CreateTextToSpeech(ctx, secret, text)
fileName := fmt.Sprintf("%s.mp3", text)
if err != nil {
panic(err)
}
assets = assets.WithFile(fileName, audio)
}

return assets
}

// Create a text to speech audio file from the given text
func (m *Dota2Helper) CreateTextToSpeech(
ctx context.Context,
secret *dagger.Secret,
text string) (*dagger.File, error) {

payload := fmt.Sprintf(`{
"model": "tts-1-hd",
"input": "%s",
"voice": "nova"
}`, text)

ctr, err := dag.Container().
From("curlimages/curl:latest").
WithSecretVariable("OPEN_AI_API_KEY", secret).
WithExec([]string{
"sh", "-c",
fmt.Sprintf(`curl https://api.openai.com/v1/audio/speech \
-H "Authorization: Bearer $OPEN_AI_API_KEY" \
-H "Content-Type: application/json" \
-d '%s' \
--output speech.mp3`, payload),
}).Sync(ctx)

if err != nil {
return nil, err
}

return ctr.File("speech.mp3"), err
}
43 changes: 28 additions & 15 deletions src/Dota2Helper.Desktop/appsettings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"$schema": "./appsettings.schema.json",
"SelectedProfileIdx": 0,
"Profiles": [
"Profiles": [
{
"Name": "Default",
"Timers": [
Expand All @@ -10,7 +11,7 @@
"IsMuted": true,
"IsInterval": true,
"Name": "Roshan",
"AudioFile": "./audio/roshan.mp3",
"AudioFile": "./audio/Roshan.mp3",
"Time": "00:11:00",
"RemindAt": "00:01:00",
"StopAfter": "01:00:00",
Expand All @@ -22,7 +23,7 @@
"IsMuted": false,
"IsInterval": true,
"Name": "Tormentor Radiant",
"AudioFile": "./audio/tormentor.mp3",
"AudioFile": "./audio/Radiant Tormentor.mp3",
"Time": "00:10:00",
"RemindAt": "00:01:00",
"StopAfter": "00:35:00",
Expand All @@ -34,7 +35,7 @@
"IsMuted": false,
"IsInterval": true,
"Name": "Tormentor Dire",
"AudioFile": "./audio/tormentor.mp3",
"AudioFile": "./audio/Dire Tormentor.mp3",
"Time": "00:10:00",
"RemindAt": "00:01:00",
"StopAfter": "00:35:00",
Expand All @@ -46,7 +47,7 @@
"IsMuted": false,
"IsInterval": true,
"Name": "Power Rune",
"AudioFile": "./audio/power rune.mp3",
"AudioFile": "./audio/Power rune.mp3",
"Time": "00:02:00",
"RemindAt": "00:00:15",
"StopAfter": "00:20:00",
Expand All @@ -58,19 +59,31 @@
"IsMuted": false,
"IsInterval": true,
"Name": "Bounty Rune",
"AudioFile": "./audio/bounty.mp3",
"AudioFile": "./audio/Bounty.mp3",
"Time": "00:03:00",
"RemindAt": "00:00:20",
"StopAfter": "00:30:00",
"StartAfter": "00:02:00"
},
{
"IsEnabled": true,
"IsManualReset": false,
"IsMuted": false,
"IsInterval": true,
"Name": "Lotus Pool",
"AudioFile": "./audio/Lotus Pool.mp3",
"Time": "00:03:00",
"RemindAt": "00:00:20",
"StopAfter": null,
"StartAfter": "00:02:00"
},
{
"IsEnabled": true,
"IsManualReset": false,
"IsMuted": false,
"IsInterval": true,
"Name": "Wisdom Rune",
"AudioFile": "./audio/wisdom rune.mp3",
"AudioFile": "./audio/Wisdom rune.mp3",
"Time": "00:07:00",
"RemindAt": "00:00:45",
"StopAfter": "00:45:00",
Expand All @@ -82,7 +95,7 @@
"IsMuted": false,
"IsInterval": false,
"Name": "Stack Camp",
"AudioFile": "./audio/stack.mp3",
"AudioFile": "./audio/Stack.mp3",
"Time": "00:00:55",
"RemindAt": "00:00:15",
"StopAfter": "00:30:00",
Expand All @@ -94,7 +107,7 @@
"IsMuted": false,
"IsInterval": false,
"Name": "Pull (15s)",
"AudioFile": "./audio/pull.mp3",
"AudioFile": "./audio/Pull.mp3",
"Time": "00:00:15",
"RemindAt": "00:00:05",
"StopAfter": "00:20:00",
Expand All @@ -106,7 +119,7 @@
"IsMuted": false,
"IsInterval": false,
"Name": "Pull (45s)",
"AudioFile": "./audio/pull.mp3",
"AudioFile": "./audio/Pull.mp3",
"Time": "00:00:45",
"RemindAt": "00:00:05",
"StopAfter": "00:20:00",
Expand All @@ -118,7 +131,7 @@
"IsMuted": false,
"IsInterval": true,
"Name": "Tier 1 Neutrals",
"AudioFile": "./audio/neutrals.mp3",
"AudioFile": "./audio/Tier 1s.mp3",
"Time": "00:07:00",
"RemindAt": "00:00:45",
"StopAfter": "00:07:15",
Expand All @@ -130,7 +143,7 @@
"IsMuted": false,
"IsInterval": true,
"Name": "Tier 2 Neutrals",
"AudioFile": "./audio/neutrals.mp3",
"AudioFile": "./audio/Tier 2s.mp3",
"Time": "00:17:00",
"RemindAt": "00:00:10",
"StopAfter": "00:17:00",
Expand All @@ -142,7 +155,7 @@
"IsMuted": false,
"IsInterval": true,
"Name": "Tier 3 Neutrals",
"AudioFile": "./audio/neutrals.mp3",
"AudioFile": "./audio/Tier 3s.mp3",
"Time": "00:27:00",
"RemindAt": "00:00:10",
"StopAfter": "00:27:10",
Expand All @@ -154,7 +167,7 @@
"IsMuted": false,
"IsInterval": true,
"Name": "Tier 4 Neutrals",
"AudioFile": "./audio/neutrals.mp3",
"AudioFile": "./audio/Tier 4s.mp3",
"Time": "00:36:40",
"RemindAt": "00:00:10",
"StopAfter": "00:36:40",
Expand All @@ -166,7 +179,7 @@
"IsMuted": false,
"IsInterval": true,
"Name": "Tier 5 Neutrals",
"AudioFile": "./audio/neutrals.mp3",
"AudioFile": "./audio/Tier 5s.mp3",
"Time": "00:59:59",
"RemindAt": "00:00:10",
"StopAfter": "01:00:00",
Expand Down
Loading

0 comments on commit bbdf6db

Please sign in to comment.