Skip to content

Commit c426588

Browse files
author
Maximilian Brune
committed
codespell -w .
1 parent 9f50a69 commit c426588

15 files changed

Lines changed: 2933 additions & 1883 deletions

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[![Go Report Card](https://goreportcard.com/badge/github.com/CodingVoid/gomble)](https://goreportcard.com/report/github.com/CodingVoid/gomble)
12
# gomble
23
mumble library written in go. Intended for writing client side music bots.
34

go.mod

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module github.com/CodingVoid/gomble
33
go 1.14
44

55
require (
6-
github.com/golang/protobuf v1.3.5
6+
github.com/golang/protobuf v1.4.1
77
golang.org/x/crypto v0.0.0-20200420201142-3c4aac89819a
8+
google.golang.org/protobuf v1.25.0
89
)

gomble/audiohandler.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ func Stop() { // {{{
3737
audiohandler.playing = false
3838
} // }}}
3939

40-
// This audioroutine get's called whenever a new audio stream should be played
40+
// This audioroutine gets called whenever a new audio stream should be played
4141
func audioroutine(track audiosources.Audiosource) { // {{{
4242
enc, err := audioformats.NewOpusEncoder(audioformats.OPUS_SAMPLE_RATE, audioformats.OPUS_CHANNELS, audioformats.OPUS_APPLICATION) // initializes a new encoder
4343
if err != nil {
44-
logger.Errorf("Could not create Opus Encoder. End Track\n") //TODO break and raise done/exception event with error paramter or whatsoever
44+
logger.Errorf("Could not create Opus Encoder. End Track\n") //TODO break and raise done/exception event with error parameter or whatsoever
4545
eventpuffer <- TrackEndedEvent{
4646
Track: track,
4747
Reason: TRACK_OTHER,

gomble/audiopackagewriter.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,21 +86,21 @@ func sendAudioPacket(opusPayload []byte, opusPayloadlen uint16, last bool) {
8686
logger.Fatalf("Error writing to tls connection\n")
8787
}
8888
if n < len(all) {
89-
logger.Fatalf("Weniger geschrieben als gedacht\n")
89+
logger.Fatalf("Did not write as much as expected\n")
9090
}
9191
} else {
9292
// encrypt ocb2-aes
9393
var allencrypted []byte = make([]byte, len(all)-2) //ocb2 overhead is always 4 byte, but for UDP we don't need 2 bytes package type and 4 bytes package length (4-2-4 = -2)
9494
audiocryptoconfig.cryptState.Encrypt(allencrypted[:], all[6:])
9595
logger.Debugf("Send via UDP\n")
96-
// send ocb2-aes encrytped udp package
96+
// send ocb2-aes encrypted udp package
9797
n, err := audioConn.Write(allencrypted[:])
9898

9999
if err != nil {
100100
logger.Fatalf("Error writing to UDP connection")
101101
}
102102
if n < len(allencrypted) {
103-
logger.Fatalf("Weniger geschrieben als gedacht")
103+
logger.Fatalf("Did not write as much as expected")
104104
}
105105
}
106106

gomble/audiosources/oggopusfile/oggopusfile.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ func getOpusFileError(prefix string, errorCode int32) error { // {{{
122122
case 0:
123123
str += "SUCCESS"
124124
case C.OP_FALSE:
125-
str += "OP_FALSE: A request did not succed"
125+
str += "OP_FALSE: A request did not succeed"
126126
case C.OP_EOF:
127127
str += "OP_EOF: Currently not used externally"
128128
case C.OP_HOLE:

gomble/audiosources/youtube/persistentYoutubeStream.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ type persistentYoutubeStream struct {
1717
contentLength int
1818
// The current http response that is in use
1919
httpResp *http.Response
20-
// byte array to save all the incoming data (usefull for seeking)
20+
// byte array to save all the incoming data (useful for seeking)
2121
//save []byte
2222
}
2323

@@ -40,7 +40,7 @@ func (s *persistentYoutubeStream) Read(p []byte) (int, error) { // {{{
4040
if err != nil {
4141
// Check if error was end of file
4242
if err != io.EOF {
43-
logger.Debugf("Hier IST DAS MUHAHAHAH, body length: %d, readed: %d, to read: %d, already readed: %d, %v\n", s.httpResp.ContentLength, n, len(p), s.cposition, err)
43+
logger.Warnf("Got Error while reading from http Response of youtube stream. Trying to connect again..., body length: %d, readed: %d, to read: %d, already readed: %d, %v\n", s.httpResp.ContentLength, n, len(p), s.cposition, err)
4444
// try to "reconnect" (just request the remaining audiodata again)
4545
err = s.RequestNext()
4646
// here we will return 0 data even though there is still data left (so keep in mind that this function does not always return len(p) audiodata)
@@ -49,9 +49,8 @@ func (s *persistentYoutubeStream) Read(p []byte) (int, error) { // {{{
4949
}
5050
s.cposition += n
5151
s.aposition += n
52-
//s.save = append(s.save, p[:n]...) // save everything that has been readed so far (//TODO implement seeking)
5352
// Check if that is the end of the http response
54-
if s.httpResp.ContentLength == int64(s.cposition) {
53+
if err == io.EOF {
5554
// Check if the complete stream is at the end
5655
if s.aposition == s.contentLength {
5756
return n, io.EOF
@@ -70,7 +69,7 @@ func (s *persistentYoutubeStream) RequestNext() error { // {{{
7069
return fmt.Errorf("RequestNext(%s:%d): %w", file, line, err)
7170
}
7271
val := burl.Query() // get values of url
73-
val.Set("range", fmt.Sprintf("%d-%d", s.aposition, s.contentLength)) // set range paramter for value
72+
val.Set("range", fmt.Sprintf("%d-%d", s.aposition, s.contentLength)) // set range parameter for value
7473
burl.RawQuery = val.Encode() // set values to url
7574
resp, err := http.Get(burl.String())
7675
if err != nil {

gomble/audiosources/youtube/youtube.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func NewYoutubeVideo(path string) (*YoutubeVideo, error) { // {{{
3535
var jsonstr string
3636
// The following loop is for trying up to 3 times to download the youtube page and find a specific json string in it. You might not believe but it doesn't always work on the first try...
3737
var i int
38-
for i=0; i < 3 && len(jsonstr) == 0; i++ {
38+
for i = 0; i < 3 && len(jsonstr) == 0; i++ {
3939
resp, err := http.Get(path)
4040
//resp, err := http.Get("https://www.youtube.com/watch?v=YO1GBsuzTWU")
4141
if err != nil {
@@ -546,7 +546,7 @@ func applyOperations(operations []CipherOperation, text string) (string, error)
546546
//logger.Debugf("SLICE Operation")
547547
case SPLICE, SLICE:
548548
logger.Debugf("SPLICE or SLICE Operation\n")
549-
text = text[op.parameter:] // remove the bytes before op.paramter
549+
text = text[op.parameter:] // remove the bytes before op.parameter
550550
default:
551551
_, file, line, _ := runtime.Caller(0)
552552
return "", fmt.Errorf("applyOperations(%s:%d): Invalid cipher operation", file, line)

gomble/audiosources/youtube/youtubevideo.old.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ package youtube
99
//
1010
// "gomble/logger"
1111
//)
12-
//// after much time spent in trial and error I found out that youtube-dl does seem to ignore any kind of paramter if output is set to stdout (-o -), altough I can't find any of this in the documentation. Furthermore most problems I got had their origin in using youtube-dl for downloading the video/audio. It's safer to use youtube-dl only as plain donwloading and outputing to stdout of anything it can find under this url:
12+
//// after much time spent in trial and error I found out that youtube-dl does seem to ignore any kind of parameter if output is set to stdout (-o -), although I can't find any of this in the documentation. Furthermore most problems I got had their origin in using youtube-dl for downloading the video/audio. It's safer to use youtube-dl only as plain downloading and outputting to stdout of anything it can find under this url:
1313
//// youtube-dl -o - --rm-cache-dir --quiet {url}
1414
//
1515
//// -i - takes the input of stdin
@@ -102,7 +102,7 @@ package youtube
102102
// // we didn't got enough data, is ffmpeg and youtube-dl done?
103103
// select {
104104
// case _ = <- y.done:
105-
// // Check if any problems occured with youtube-dl
105+
// // Check if any problems occurred with youtube-dl
106106
// if !y.ycmd.ProcessState.Success() {
107107
// return nil, errors.New("Could not complete youtube-dl command with url: " + y.url + " stderr: " + y.ycmdError.String())
108108
// }

gomble/event.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const (
2727
TRACK_INTERRUPTED = iota
2828
// Track ended playing because Track was over
2929
TRACK_ENDED
30-
// Some other failure occured. The Logs should be checked for further Information
30+
// Some other failure occurred. The Logs should be checked for further Information
3131
TRACK_OTHER
3232
)
3333

gomble/eventhandler.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ var tlsconfig tls.Config
2828
// audioConn is our udp connection to the server. It is used by audiopackagereader.go to read packages from mumble-server and by audiopackagewriter to write packages to the mumble-server
2929
var audioConn *net.UDPConn
3030

31-
// Adress and port of mumble-server in syntax address:port
31+
// Address and port of mumble-server in syntax address:port
3232
var addr string
3333

3434
// Initializes some settings for gomble and returns an Eventhandler which can be used to add event-listeners
@@ -70,9 +70,9 @@ func Begin() {
7070
logger.Fatalf("Sending Version failed: " + err.Error() + "\n")
7171
}
7272

73-
logger.Debugf("Send Authentification")
73+
logger.Debugf("Send Authentication")
7474
if err := writeProto(&authPacket); err != nil {
75-
logger.Fatalf("Sending Authentification failed: " + err.Error() + "\n")
75+
logger.Fatalf("Sending Authentication failed: " + err.Error() + "\n")
7676
}
7777

7878
// mumble connection established

0 commit comments

Comments
 (0)