Skip to content

Commit

Permalink
renamed unexported functions
Browse files Browse the repository at this point in the history
  • Loading branch information
talkkonnect committed Jan 23, 2021
1 parent bac5e73 commit d5e3d97
Show file tree
Hide file tree
Showing 9 changed files with 85 additions and 83 deletions.
4 changes: 2 additions & 2 deletions autoprovision.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func autoProvision() error {

fileURL := URL + TkID
log.Println("info: Trying to Autoprovision with URL: ", fileURL)
err := DownloadFile(SaveFilePath, SaveFilename, fileURL)
err := downloadFile(SaveFilePath, SaveFilename, fileURL)
if err != nil {
return errors.New(fmt.Sprintf("error: DownloadFile Module Returned an Error: ", err))
}
Expand All @@ -80,7 +80,7 @@ func autoProvision() error {

}

func DownloadFile(SaveFilePath string, SaveFilename string, URL string) error {
func downloadFile(SaveFilePath string, SaveFilename string, URL string) error {
resp, err := http.Get(URL)
if err != nil {
return err
Expand Down
24 changes: 12 additions & 12 deletions avrecord.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ func AudioRecordTraffic() {
log.Println("debug: Old sox instance was Killed Before Running New")
}

CreateDirIfNotExist(AudioRecordSavePath)
CreateDirIfNotExist(AudioRecordArchivePath)
emptydirchk, err := DirIsEmpty(AudioRecordSavePath)
createDirIfNotExist(AudioRecordSavePath)
createDirIfNotExist(AudioRecordArchivePath)
emptydirchk, err := dirIsEmpty(AudioRecordSavePath)
if err == nil && emptydirchk == false {

filezip := time.Now().Format("20060102150405") + ".zip"
Expand All @@ -84,9 +84,9 @@ func AudioRecordTraffic() {

func AudioRecordAmbient() {

CreateDirIfNotExist(AudioRecordSavePath)
CreateDirIfNotExist(AudioRecordArchivePath)
emptydirchk, err := DirIsEmpty(AudioRecordSavePath)
createDirIfNotExist(AudioRecordSavePath)
createDirIfNotExist(AudioRecordArchivePath)
emptydirchk, err := dirIsEmpty(AudioRecordSavePath)
if err == nil && emptydirchk == false {
filezip := time.Now().Format("20060102150405") + ".zip"
go zipit(AudioRecordSavePath+"/", AudioRecordArchivePath+"/"+filezip) // path to end with "/" or not?
Expand All @@ -106,9 +106,9 @@ func AudioRecordAmbient() {

func AudioRecordCombo() {

CreateDirIfNotExist(AudioRecordSavePath)
CreateDirIfNotExist(AudioRecordArchivePath)
emptydirchk, err := DirIsEmpty(AudioRecordSavePath)
createDirIfNotExist(AudioRecordSavePath)
createDirIfNotExist(AudioRecordArchivePath)
emptydirchk, err := dirIsEmpty(AudioRecordSavePath)
if err == nil && emptydirchk == false {
filezip := time.Now().Format("20060102150405") + ".zip"
go zipit(AudioRecordSavePath+"/", AudioRecordArchivePath+"/"+filezip)
Expand Down Expand Up @@ -204,7 +204,7 @@ func audiorecordtraffic() {
check(err)
time.Sleep(2 * time.Second)

emptydirchk, err := DirIsEmpty(AudioRecordSavePath) // If sox didn't start recording for wrong parameters or any reason... No file.
emptydirchk, err := dirIsEmpty(AudioRecordSavePath) // If sox didn't start recording for wrong parameters or any reason... No file.

if err == nil && emptydirchk == false {
log.Println("info: sox is Recording Traffic to", AudioRecordSavePath)
Expand Down Expand Up @@ -306,7 +306,7 @@ func audiorecordambient() {
err := cmd.Start()
check(err)

emptydirchk, err := DirIsEmpty(AudioRecordSavePath) // If sox didn't start recording for wrong parameters or any reason... No file.
emptydirchk, err := dirIsEmpty(AudioRecordSavePath) // If sox didn't start recording for wrong parameters or any reason... No file.

if err == nil && emptydirchk == false {
log.Println("info: sox is Recording Ambient Audio to", AudioRecordSavePath)
Expand Down Expand Up @@ -414,7 +414,7 @@ func audiorecordcombo() {
check(err)
time.Sleep(2 * time.Second)

emptydirchk, err := DirIsEmpty(AudioRecordSavePath) // If sox didn't start recording for wrong parameters or any reason... No files.
emptydirchk, err := dirIsEmpty(AudioRecordSavePath) // If sox didn't start recording for wrong parameters or any reason... No files.

if err == nil && emptydirchk == false {
log.Println("info: sox is Recording Mixed Audio to", AudioRecordSavePath)
Expand Down
2 changes: 1 addition & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ func (b *Talkkonnect) ClientStart() {
}

if TTSEnabled && TTSTalkkonnectLoaded {
err := PlayWavLocal(TTSTalkkonnectLoadedFilenameAndPath, TTSVolumeLevel)
err := playWavLocal(TTSTalkkonnectLoadedFilenameAndPath, TTSVolumeLevel)
if err != nil {
log.Println("error: PlayWavLocal(TTSTalkkonnectLoadedFilenameAndPath) Returned Error: ", err)
}
Expand Down
12 changes: 6 additions & 6 deletions clientcommands.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,9 @@ func (b *Talkkonnect) ParticipantLEDUpdate(verbose bool) {

if participantCount != prevParticipantCount {
if EventSoundEnabled {
err := PlayWavLocal(EventSoundFilenameAndPath, 100)
err := playWavLocal(EventSoundFilenameAndPath, 100)
if err != nil {
log.Println("error: PlayWavLocal(EventSoundFilenameAndPath) Returned Error: ", err)
log.Println("error: playWavLocal(EventSoundFilenameAndPath) Returned Error: ", err)
}
}
}
Expand Down Expand Up @@ -382,9 +382,9 @@ func (b *Talkkonnect) ChannelUp() {
}

if TTSEnabled && TTSChannelUp {
err := PlayWavLocal(TTSChannelUpFilenameAndPath, TTSVolumeLevel)
err := playWavLocal(TTSChannelUpFilenameAndPath, TTSVolumeLevel)
if err != nil {
log.Println("error: PlayWavLocal(TTSChannelDownFilenameAndPath) Returned Error: ", err)
log.Println("error: playWavLocal(TTSChannelDownFilenameAndPath) Returned Error: ", err)
}

}
Expand Down Expand Up @@ -454,9 +454,9 @@ func (b *Talkkonnect) ChannelDown() {
}

if TTSEnabled && TTSChannelDown {
err := PlayWavLocal(TTSChannelDownFilenameAndPath, TTSVolumeLevel)
err := playWavLocal(TTSChannelDownFilenameAndPath, TTSVolumeLevel)
if err != nil {
log.Println("error: PlayWavLocal(TTSChannelDownFilenameAndPath) Returned Error: ", err)
log.Println("error: playWavLocal(TTSChannelDownFilenameAndPath) Returned Error: ", err)
}

}
Expand Down
78 changes: 39 additions & 39 deletions commandkeys.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ func (b *Talkkonnect) cmdKeyDel() {
log.Println("debug: Delete Key Pressed Menu and Session Information Requested")

if TTSEnabled && TTSDisplayMenu {
err := PlayWavLocal(TTSDisplayMenuFilenameAndPath, TTSVolumeLevel)
err := playWavLocal(TTSDisplayMenuFilenameAndPath, TTSVolumeLevel)
if err != nil {
log.Println("error: PlayWavLocal(TTSDisplayMenuFilenameAndPath) Returned Error: ", err)
log.Println("error: playWavLocal(TTSDisplayMenuFilenameAndPath) Returned Error: ", err)
}

}
Expand Down Expand Up @@ -95,9 +95,9 @@ func (b *Talkkonnect) cmdMuteUnmute(subCommand string) {

log.Println("debug: F3 pressed Mute/Unmute Speaker Requested Now UnMuted")
if TTSEnabled && TTSMuteUnMuteSpeaker {
err := PlayWavLocal(TTSMuteUnMuteSpeakerFilenameAndPath, TTSVolumeLevel)
err := playWavLocal(TTSMuteUnMuteSpeakerFilenameAndPath, TTSVolumeLevel)
if err != nil {
log.Println("error: PlayWavLocal(TTSMuteUnMuteSpeakerFilenameAndPath) Returned Error: ", err)
log.Println("error: playWavLocal(TTSMuteUnMuteSpeakerFilenameAndPath) Returned Error: ", err)
}

}
Expand All @@ -113,9 +113,9 @@ func (b *Talkkonnect) cmdMuteUnmute(subCommand string) {
}
} else {
if TTSEnabled && TTSMuteUnMuteSpeaker {
err := PlayWavLocal(TTSMuteUnMuteSpeakerFilenameAndPath, TTSVolumeLevel)
err := playWavLocal(TTSMuteUnMuteSpeakerFilenameAndPath, TTSVolumeLevel)
if err != nil {
log.Println("error: PlayWavLocal(TTSMuteUnMuteSpeakerFilenameAndPath) Returned Error: ", err)
log.Println("error: playWavLocal(TTSMuteUnMuteSpeakerFilenameAndPath) Returned Error: ", err)
}

}
Expand Down Expand Up @@ -149,9 +149,9 @@ func (b *Talkkonnect) cmdCurrentVolume() {
log.Println("info: Volume Level is at", origVolume, "%")

if TTSEnabled && TTSCurrentVolumeLevel {
err := PlayWavLocal(TTSCurrentVolumeLevelFilenameAndPath, TTSVolumeLevel)
err := playWavLocal(TTSCurrentVolumeLevelFilenameAndPath, TTSVolumeLevel)
if err != nil {
log.Println("error: PlayWavLocal(TTSCurrentVolumeLevelFilenameAndPath) Returned Error: ", err)
log.Println("error: playWavLocal(TTSCurrentVolumeLevelFilenameAndPath) Returned Error: ", err)
}

}
Expand Down Expand Up @@ -205,9 +205,9 @@ func (b *Talkkonnect) cmdVolumeUp() {
}

if TTSEnabled && TTSDigitalVolumeUp {
err := PlayWavLocal(TTSDigitalVolumeUpFilenameAndPath, TTSVolumeLevel)
err := playWavLocal(TTSDigitalVolumeUpFilenameAndPath, TTSVolumeLevel)
if err != nil {
log.Println("error: PlayWavLocal(TTSDigitalVolumeUpFilenameAndPath) Returned Error: ", err)
log.Println("error: playWavLocal(TTSDigitalVolumeUpFilenameAndPath) Returned Error: ", err)
}

}
Expand Down Expand Up @@ -254,9 +254,9 @@ func (b *Talkkonnect) cmdVolumeDown() {
}

if TTSEnabled && TTSDigitalVolumeDown {
err := PlayWavLocal(TTSDigitalVolumeDownFilenameAndPath, TTSVolumeLevel)
err := playWavLocal(TTSDigitalVolumeDownFilenameAndPath, TTSVolumeLevel)
if err != nil {
log.Println("error: PlayWavLocal(TTSDigitalVolumeDownFilenameAndPath) Returned Error: ", err)
log.Println("error: playWavLocal(TTSDigitalVolumeDownFilenameAndPath) Returned Error: ", err)
}

}
Expand All @@ -267,9 +267,9 @@ func (b *Talkkonnect) cmdListServerChannels() {
log.Println("debug: F7 pressed Channel List Requested")

if TTSEnabled && TTSListServerChannels {
err := PlayWavLocal(TTSListServerChannelsFilenameAndPath, TTSVolumeLevel)
err := playWavLocal(TTSListServerChannelsFilenameAndPath, TTSVolumeLevel)
if err != nil {
log.Println("error: PlayWavLocal(TTSListServerChannelsFilenameAndPath) Returned Error: ", err)
log.Println("error: playWavLocal(TTSListServerChannelsFilenameAndPath) Returned Error: ", err)
}

}
Expand All @@ -283,9 +283,9 @@ func (b *Talkkonnect) cmdStartTransmitting() {
log.Println("info: Start Transmitting")

if TTSEnabled && TTSStartTransmitting {
err := PlayWavLocal(TTSStartTransmittingFilenameAndPath, TTSVolumeLevel)
err := playWavLocal(TTSStartTransmittingFilenameAndPath, TTSVolumeLevel)
if err != nil {
log.Println("error: PlayWavLocal(TTSStartTransmittingFilenameAndPath) Returned Error: ", err)
log.Println("error: playWavLocal(TTSStartTransmittingFilenameAndPath) Returned Error: ", err)
}

}
Expand All @@ -310,7 +310,7 @@ func (b *Talkkonnect) cmdStopTransmitting() {
log.Println("info: Stop Transmitting")

if TTSEnabled && TTSStopTransmitting {
err := PlayWavLocal(TTSStopTransmittingFilenameAndPath, TTSVolumeLevel)
err := playWavLocal(TTSStopTransmittingFilenameAndPath, TTSVolumeLevel)
if err != nil {
log.Println("error: Play Wav Local Module Returned Error: ", err)
}
Expand All @@ -337,9 +337,9 @@ func (b *Talkkonnect) cmdListOnlineUsers() {
log.Println("info: F10 Online User(s) in Current Channel")

if TTSEnabled && TTSListOnlineUsers {
err := PlayWavLocal(TTSListOnlineUsersFilenameAndPath, TTSVolumeLevel)
err := playWavLocal(TTSListOnlineUsersFilenameAndPath, TTSVolumeLevel)
if err != nil {
log.Println("error: PlayWavLocal(TTSListOnlineUsersFilenameAndPath) Returned Error: ", err)
log.Println("error: playWavLocal(TTSListOnlineUsersFilenameAndPath) Returned Error: ", err)
}

}
Expand All @@ -356,9 +356,9 @@ func (b *Talkkonnect) cmdPlayback() {
b.BackLightTimer()

if TTSEnabled && TTSPlayChimes {
err := PlayWavLocal(TTSPlayChimesFilenameAndPath, TTSVolumeLevel)
err := playWavLocal(TTSPlayChimesFilenameAndPath, TTSVolumeLevel)
if err != nil {
log.Println("error: PlayWavLocal(TTSPlayChimesFilenameAndPath) Returned Error: ", err)
log.Println("error: playWavLocal(TTSPlayChimesFilenameAndPath) Returned Error: ", err)

}

Expand All @@ -385,9 +385,9 @@ func (b *Talkkonnect) cmdGPSPosition() {
log.Println("info: GPS details requested")

if TTSEnabled && TTSRequestGpsPosition {
err := PlayWavLocal(TTSRequestGpsPositionFilenameAndPath, TTSVolumeLevel)
err := playWavLocal(TTSRequestGpsPositionFilenameAndPath, TTSVolumeLevel)
if err != nil {
log.Println("error: PlayWavLocal(TTSRequestGpsPositionFilenameAndPath) Returned Error: ", err)
log.Println("error: playWavLocal(TTSRequestGpsPositionFilenameAndPath) Returned Error: ", err)
}

}
Expand Down Expand Up @@ -421,9 +421,9 @@ func (b *Talkkonnect) cmdQuitTalkkonnect() {
log.Printf("info: Talkkonnect Now Running For %v \n", secondsToHuman(int(duration.Seconds())))

if TTSEnabled && TTSQuitTalkkonnect {
err := PlayWavLocal(TTSQuitTalkkonnectFilenameAndPath, TTSVolumeLevel)
err := playWavLocal(TTSQuitTalkkonnectFilenameAndPath, TTSVolumeLevel)
if err != nil {
log.Println("error: PlayWavLocal(TTSQuitTalkkonnectFilenameAndPath) Returned Error: ", err)
log.Println("error: playWavLocal(TTSQuitTalkkonnectFilenameAndPath) Returned Error: ", err)
}

}
Expand Down Expand Up @@ -473,9 +473,9 @@ func (b *Talkkonnect) cmdSendEmail() {
}

if TTSEnabled && TTSSendEmail {
err := PlayWavLocal(TTSSendEmailFilenameAndPath, TTSVolumeLevel)
err := playWavLocal(TTSSendEmailFilenameAndPath, TTSVolumeLevel)
if err != nil {
log.Println("warn: PlayWavLocal(TTSSendEmailFilenameAndPath) Returned Error: ", err)
log.Println("warn: playWavLocal(TTSSendEmailFilenameAndPath) Returned Error: ", err)
}

}
Expand Down Expand Up @@ -512,9 +512,9 @@ func (b *Talkkonnect) cmdConnPreviousServer() {
log.Println("info: Previous Server Requested")

if TTSEnabled && TTSPreviousServer {
err := PlayWavLocal(TTSPreviousServerFilenameAndPath, TTSVolumeLevel)
err := playWavLocal(TTSPreviousServerFilenameAndPath, TTSVolumeLevel)
if err != nil {
log.Println("error: PlayWavLocal(TTSPreviousServerFilenameAndPath) Returned Error: ", err)
log.Println("error: playWavLocal(TTSPreviousServerFilenameAndPath) Returned Error: ", err)
}

}
Expand Down Expand Up @@ -554,9 +554,9 @@ func (b *Talkkonnect) cmdPingServers() {
log.Println("info: Ping Servers")

if TTSEnabled && TTSPingServers {
err := PlayWavLocal(TTSPingServersFilenameAndPath, TTSVolumeLevel)
err := playWavLocal(TTSPingServersFilenameAndPath, TTSVolumeLevel)
if err != nil {
log.Println("alert: PlayWavLocal(TTSPingServersFilenameAndPath) Returned Error: ", err)
log.Println("alert: playWavLocal(TTSPingServersFilenameAndPath) Returned Error: ", err)
}

}
Expand All @@ -569,9 +569,9 @@ func (b *Talkkonnect) cmdConnNextServer() {
log.Println("info: Next Server Requested Killing This Session, talkkonnect should be restarted by systemd")

if TTSEnabled && TTSNextServer {
err := PlayWavLocal(TTSNextServerFilenameAndPath, TTSVolumeLevel)
err := playWavLocal(TTSNextServerFilenameAndPath, TTSVolumeLevel)
if err != nil {
log.Println("alert: PlayWavLocal(TTSNextServerFilenameAndPath) Returned Error: ", err)
log.Println("alert: playWavLocal(TTSNextServerFilenameAndPath) Returned Error: ", err)
}

}
Expand Down Expand Up @@ -693,9 +693,9 @@ func (b *Talkkonnect) cmdPanicSimulation() {
log.Println("info: Panic Button Start/Stop Simulation Requested")

if TTSEnabled && TTSPanicSimulation {
err := PlayWavLocal(TTSPanicSimulationFilenameAndPath, TTSVolumeLevel)
err := playWavLocal(TTSPanicSimulationFilenameAndPath, TTSVolumeLevel)
if err != nil {
log.Println("error: PlayWavLocal(TTSPanicSimulationFilenameAndPath) Returned Error: ", err)
log.Println("error: playWavLocal(TTSPanicSimulationFilenameAndPath) Returned Error: ", err)
}

}
Expand Down Expand Up @@ -778,9 +778,9 @@ func (b *Talkkonnect) cmdScanChannels() {
log.Println("info: Scanning Channels")

if TTSEnabled && TTSScan {
err := PlayWavLocal(TTSScanFilenameAndPath, TTSVolumeLevel)
err := playWavLocal(TTSScanFilenameAndPath, TTSVolumeLevel)
if err != nil {
log.Println("error: PlayWavLocal(TTSScanFilenameAndPath) Returned Error: ", err)
log.Println("error: playWavLocal(TTSScanFilenameAndPath) Returned Error: ", err)
}

}
Expand Down Expand Up @@ -812,9 +812,9 @@ func (b *Talkkonnect) cmdDumpXMLConfig() {
log.Println("info: Print XML Config " + ConfigXMLFile)

if TTSEnabled && TTSPrintXmlConfig {
err := PlayWavLocal(TTSPrintXmlConfigFilenameAndPath, TTSVolumeLevel)
err := playWavLocal(TTSPrintXmlConfigFilenameAndPath, TTSVolumeLevel)
if err != nil {
log.Println("error: PlayWavLocal(TTSPrintXmlConfigFilenameAndPath) Returned Error: ", err)
log.Println("error: playWavLocal(TTSPrintXmlConfigFilenameAndPath) Returned Error: ", err)
}

}
Expand Down
5 changes: 2 additions & 3 deletions httpapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ package talkkonnect

import (
"fmt"
_ "github.com/talkkonnect/gumble/opus"
"log"
"net/http"
)
Expand Down Expand Up @@ -233,8 +232,8 @@ func (b *Talkkonnect) httpAPI(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "API Print XML Congfig Denied\n")
}
case "PlayRepeaterTone":
b.cmdPlayRepeaterTone()
fmt.Fprintf(w, "API Play Repeater Tone Processed Succesfully\n")
b.cmdPlayRepeaterTone()
fmt.Fprintf(w, "API Play Repeater Tone Processed Succesfully\n")
default:
fmt.Fprintf(w, "API Command Not Defined\n")
}
Expand Down
Loading

0 comments on commit d5e3d97

Please sign in to comment.