u
This commit is contained in:
parent
3b51461da3
commit
0be4735ac2
102
RaceNotifier.go
102
RaceNotifier.go
@ -1,7 +1,10 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
"net"
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -33,68 +36,67 @@ func main() {
|
|||||||
defer file.Close()
|
defer file.Close()
|
||||||
|
|
||||||
log.Println("Starting Program")
|
log.Println("Starting Program")
|
||||||
os.Exit(0)
|
if os.Args[1] == "PreRace" || os.Args[1] == "Prerace" || os.Args[1] == "prerace" {
|
||||||
// if os.Args[1] == "PreRace" || os.Args[1] == "Prerace" || os.Args[1] == "prerace" {
|
|
||||||
|
|
||||||
// // This is a pre race, need to find all the details of the release
|
// This is a pre race, need to find all the details of the release
|
||||||
// log.Printf("[PreRace] Prerace launched with details %v, %v, %v", os.Args[1], os.Args[2], os.Args[3])
|
log.Printf("[PreRace] Prerace launched with details %v, %v, %v", os.Args[1], os.Args[2], os.Args[3])
|
||||||
// r := PreRace{Name: os.Args[2], Indexer: os.Args[3]}
|
r := PreRace{Name: os.Args[2], Indexer: os.Args[3]}
|
||||||
|
|
||||||
// tcpAddr, err := net.ResolveTCPAddr("tcp", "212.7.203.107:3000")
|
tcpAddr, err := net.ResolveTCPAddr("tcp", "212.7.203.107:3000")
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// log.Fatal("Could not parse IP address:", err)
|
log.Fatal("Could not parse IP address:", err)
|
||||||
// }
|
}
|
||||||
// conn, err := net.DialTCP("tcp", nil, tcpAddr)
|
conn, err := net.DialTCP("tcp", nil, tcpAddr)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// log.Fatal("Could not connect:", err)
|
log.Fatal("Could not connect:", err)
|
||||||
// }
|
}
|
||||||
|
|
||||||
// defer conn.Close()
|
defer conn.Close()
|
||||||
|
|
||||||
// _, err = conn.Write([]byte(r.Indexer + " " + r.Name))
|
_, err = conn.Write([]byte(r.Indexer + " " + r.Name))
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// log.Fatal("Could not send message: ", err)
|
log.Fatal("Could not send message: ", err)
|
||||||
// }
|
}
|
||||||
// log.Println("Message sent...")
|
log.Println("Message sent...")
|
||||||
|
|
||||||
// os.Exit(0)
|
os.Exit(0)
|
||||||
|
|
||||||
// } else if os.Args[1] == "test" {
|
} else if os.Args[1] == "test" {
|
||||||
// for n, args := range os.Args {
|
for n, args := range os.Args {
|
||||||
// log.Println("Arg", n, "->", args)
|
log.Println("Arg", n, "->", args)
|
||||||
// }
|
}
|
||||||
|
|
||||||
// } else {
|
} else {
|
||||||
// // This is the race thus the torrent has finished downloading.
|
// This is the race thus the torrent has finished downloading.
|
||||||
// r := Race{Name: os.Args[1], Category: os.Args[2], Content_Path: os.Args[3], Root_Path: os.Args[4], Save_Path: os.Args[5], Hash: os.Args[6], Size: os.Args[7], Files: os.Args[8]}
|
r := Race{Name: os.Args[1], Category: os.Args[2], Content_Path: os.Args[3], Root_Path: os.Args[4], Save_Path: os.Args[5], Hash: os.Args[6], Size: os.Args[7], Files: os.Args[8]}
|
||||||
// data, err := json.Marshal(r)
|
data, err := json.Marshal(r)
|
||||||
|
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// fmt.Println(err)
|
fmt.Println(err)
|
||||||
// }
|
}
|
||||||
|
|
||||||
// err = os.WriteFile("test.json", data, 0644)
|
err = os.WriteFile("test.json", data, 0644)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// log.Fatal(err)
|
log.Fatal(err)
|
||||||
// }
|
}
|
||||||
|
|
||||||
// tcpAddr, err := net.ResolveTCPAddr("tcp", "212.7.203.107:3000")
|
tcpAddr, err := net.ResolveTCPAddr("tcp", "212.7.203.107:3000")
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// log.Fatal("Could not parse IP address:", err)
|
log.Fatal("Could not parse IP address:", err)
|
||||||
// }
|
}
|
||||||
// conn, err := net.DialTCP("tcp", nil, tcpAddr)
|
conn, err := net.DialTCP("tcp", nil, tcpAddr)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// log.Fatal("Could not connect:", err)
|
log.Fatal("Could not connect:", err)
|
||||||
// }
|
}
|
||||||
|
|
||||||
// defer conn.Close()
|
defer conn.Close()
|
||||||
|
|
||||||
// _, err = conn.Write([]byte(data))
|
_, err = conn.Write([]byte(data))
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// log.Fatal("Could not send message: ", err)
|
log.Fatal("Could not send message: ", err)
|
||||||
// }
|
}
|
||||||
|
|
||||||
// os.Exit(0)
|
os.Exit(0)
|
||||||
|
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user