From c8ab93f2f711f56036c7c24ac0cd1d96fce41f71 Mon Sep 17 00:00:00 2001 From: rouggy Date: Fri, 30 Aug 2024 12:34:28 +0700 Subject: [PATCH] update race --- .vscode/launch.json | 4 +-- RaceNotifier.go | 80 +++++++++++++++++++----------------------- racer.log | 84 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 122 insertions(+), 46 deletions(-) create mode 100644 racer.log diff --git a/.vscode/launch.json b/.vscode/launch.json index 37cbd11..3dec7df 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -9,8 +9,8 @@ "type": "go", "request": "launch", "mode": "auto", - "program": "${fileDirname}", - "args": ["prerace", "xThor", "Test"] + "program": "RaceNotifier.go", + "args": ["prerace", "Snowpiercer.S04E07.FRENCH.1080p.WEB.H264-FW", "Film/Vidéo", "YGG Torrent", "episode", "Snowpiercer", "4", "7", "0", "1080p", "WEB", "https://www.ygg.re/rss/download?id=1213818&passkey=dojP6mocODxH1jlyKrHgDfm1BFBaJsEg"] } ] } \ No newline at end of file diff --git a/RaceNotifier.go b/RaceNotifier.go index b36fd97..0590395 100644 --- a/RaceNotifier.go +++ b/RaceNotifier.go @@ -8,37 +8,22 @@ import ( ) type Race struct { - Id int `json:"id"` - Hash string `json:"hash"` - Name string `json:"name"` - Category string `json:"category"` - Indexer string `json:"indexer"` - Type string `json:"type"` - Title string `json:"title"` - Size string `json:"size"` - Files string `json:"files"` -} - -type PreRace struct { - Id int `json:"id"` - Hash string `json:"hash"` - Name string `json:"name"` - Category string `json:"category"` - Indexer string `json:"indexer"` - Type string `json:"type"` - Title string `json:"title"` - Season string `json:"season"` - Episode string `json:"episode"` - Year string `json:"year"` - Resolution string `json:"resolution"` - Source string `json:"source"` - HDR string `json:"hdr"` - TorrentURL string `json:"torrenturl"` + TorrentName string `json:"torrentname"` + Category string `json:"category"` + Indexer string `json:"indexer"` + Type string `json:"type"` + Title string `json:"title"` + Season string `json:"season"` + Episode string `json:"episode"` + Year string `json:"year"` + Resolution string `json:"resolution"` + Source string `json:"source"` + TorrentURL string `json:"torrenturl"` } func main() { - file, err := os.OpenFile("/opt/RaceNotifier/racer.log", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0777) + file, err := os.OpenFile("racer.log", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0777) if err != nil { log.Fatal(err) } @@ -50,21 +35,28 @@ func main() { 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 - log.Printf("[PreRace] Prerace launched with details %v, %v, %v", os.Args[1], os.Args[2], os.Args[3]) - r, _ := json.Marshal(PreRace{Hash: os.Args[2], - Name: os.Args[3], - Category: os.Args[4], - Indexer: os.Args[5], - Type: os.Args[6], - Title: os.Args[7], - Season: os.Args[8], - Episode: os.Args[9], - Year: os.Args[10], - Resolution: os.Args[11], - Source: os.Args[12], - HDR: os.Args[13], - TorrentURL: os.Args[14], - }) + // log.Printf("[PreRace] Prerace launched with details %v, %v, %v", os.Args[1], os.Args[2], os.Args[3]) + + r := &Race{ + TorrentName: os.Args[2], + Category: os.Args[3], + Indexer: os.Args[4], + Type: os.Args[5], + Title: os.Args[6], + Season: os.Args[7], + Episode: os.Args[8], + Year: os.Args[9], + Resolution: os.Args[10], + Source: os.Args[11], + TorrentURL: os.Args[12], + } + + j, err := json.Marshal(r) + log.Println(string(j)) + + if err != nil { + log.Println(err) + } tcpAddr, err := net.ResolveTCPAddr("tcp", "127.0.0.1:3000") if err != nil { @@ -77,11 +69,11 @@ func main() { defer conn.Close() - _, err = conn.Write([]byte(r)) + _, err = conn.Write([]byte(j)) if err != nil { log.Fatal("Could not send message: ", err) } - log.Println("Message sent...") + log.Println("Message sent...", r) os.Exit(0) diff --git a/racer.log b/racer.log new file mode 100644 index 0000000..6cd2802 --- /dev/null +++ b/racer.log @@ -0,0 +1,84 @@ +2024/08/28 13:31:11 Starting Program +2024/08/28 13:31:11 [PreRace] Prerace launched with details prerace, Snowpiercer.S04E07.FRENCH.1080p.WEB.H264-FW, Film/Vidéo +2024/08/28 13:31:35 Starting Program +2024/08/28 13:31:35 [PreRace] Prerace launched with details prerace, Snowpiercer.S04E07.FRENCH.1080p.WEB.H264-FW, Film/Vidéo +2024/08/28 13:32:45 Starting Program +2024/08/28 13:32:45 Arg 0 -> C:\Perso\Seafile\Programmation\Golang\RacerNotifier\__debug_bin3990755176.exe +2024/08/28 13:32:45 Arg 1 -> test +2024/08/28 13:32:45 Arg 2 -> Snowpiercer.S04E07.FRENCH.1080p.WEB.H264-FW +2024/08/28 13:32:45 Arg 3 -> Film/Vidéo +2024/08/28 13:32:45 Arg 4 -> YGG Torrent +2024/08/28 13:32:45 Arg 5 -> episode +2024/08/28 13:32:45 Arg 6 -> Snowpiercer +2024/08/28 13:32:45 Arg 7 -> 4 +2024/08/28 13:32:45 Arg 8 -> 7 +2024/08/28 13:32:45 Arg 9 -> 0 +2024/08/28 13:32:45 Arg 10 -> 1080p +2024/08/28 13:32:45 Arg 11 -> WEB +2024/08/28 13:32:45 Arg 12 -> https://www.ygg.re/rss/download?id=1213818&passkey=dojP6mocODxH1jlyKrHgDfm1BFBaJsEg +2024/08/28 13:33:44 Starting Program +2024/08/28 13:33:44 Arg 0 -> C:\Perso\Seafile\Programmation\Golang\RacerNotifier\__debug_bin1749691.exe +2024/08/28 13:33:44 Arg 1 -> test +2024/08/28 13:33:44 Arg 2 -> Snowpiercer.S04E07.FRENCH.1080p.WEB.H264-FW +2024/08/28 13:33:44 Arg 3 -> Film/Vidéo +2024/08/28 13:33:44 Arg 4 -> YGG Torrent +2024/08/28 13:33:44 Arg 5 -> episode +2024/08/28 13:33:44 Arg 6 -> Snowpiercer +2024/08/28 13:33:44 Arg 7 -> 4 +2024/08/28 13:33:44 Arg 8 -> 7 +2024/08/28 13:33:44 Arg 9 -> 0 +2024/08/28 13:33:44 Arg 10 -> 1080p +2024/08/28 13:33:44 Arg 11 -> WEB +2024/08/28 13:33:44 Arg 12 -> https://www.ygg.re/rss/download?id=1213818&passkey=dojP6mocODxH1jlyKrHgDfm1BFBaJsEg +2024/08/28 13:35:53 Starting Program +2024/08/28 13:35:53 [PreRace] Prerace launched with details prerace, Snowpiercer.S04E07.FRENCH.1080p.WEB.H264-FW, Film/Vidéo +2024/08/28 13:36:58 Starting Program +2024/08/28 13:36:58 [PreRace] Prerace launched with details prerace, Snowpiercer.S04E07.FRENCH.1080p.WEB.H264-FW, Film/Vidéo +2024/08/28 13:37:26 Starting Program +2024/08/28 13:37:26 [PreRace] Prerace launched with details prerace, Snowpiercer.S04E07.FRENCH.1080p.WEB.H264-FW, Film/Vidéo +2024/08/28 13:37:49 Starting Program +2024/08/28 13:38:11 Starting Program +2024/08/28 13:39:01 Starting Program +2024/08/28 13:39:13 Starting Program +2024/08/28 13:42:19 Starting Program +2024/08/28 13:43:27 Starting Program +2024/08/28 13:43:47 Could not connect:dial tcp 127.0.0.1:3000: connectex: No connection could be made because the target machine actively refused it. +2024/08/28 13:43:55 Starting Program +2024/08/28 13:45:44 Starting Program +2024/08/28 13:46:09 Starting Program +2024/08/28 13:48:14 Starting Program +2024/08/28 13:48:14 {"name":"Snowpiercer.S04E07.FRENCH.1080p.WEB.H264-FW","category":"Film/Vidéo","indexer":"YGG Torrent","type":"episode","title":"Snowpiercer","season":"4","episode":"7","year":"0","resolution":"1080p","source":"WEB","torrenturl":"https://www.ygg.re/rss/download?id=1213818\u0026passkey=dojP6mocODxH1jlyKrHgDfm1BFBaJsEg"} +2024/08/28 13:48:48 Could not connect:dial tcp 127.0.0.1:3000: connectex: No connection could be made because the target machine actively refused it. +2024/08/28 13:48:54 Starting Program +2024/08/28 13:48:54 {"name":"Snowpiercer.S04E07.FRENCH.1080p.WEB.H264-FW","category":"Film/Vidéo","indexer":"YGG Torrent","type":"episode","title":"Snowpiercer","season":"4","episode":"7","year":"0","resolution":"1080p","source":"WEB","torrenturl":"https://www.ygg.re/rss/download?id=1213818\u0026passkey=dojP6mocODxH1jlyKrHgDfm1BFBaJsEg"} +2024/08/28 13:48:54 Could not connect:dial tcp 127.0.0.1:3000: connectex: No connection could be made because the target machine actively refused it. +2024/08/28 13:49:32 Starting Program +2024/08/28 13:49:32 {"name":"Snowpiercer.S04E07.FRENCH.1080p.WEB.H264-FW","category":"Film/Vidéo","indexer":"YGG Torrent","type":"episode","title":"Snowpiercer","season":"4","episode":"7","year":"0","resolution":"1080p","source":"WEB","torrenturl":"https://www.ygg.re/rss/download?id=1213818\u0026passkey=dojP6mocODxH1jlyKrHgDfm1BFBaJsEg"} +2024/08/28 13:49:32 Message sent... &{Snowpiercer.S04E07.FRENCH.1080p.WEB.H264-FW Film/Vidéo YGG Torrent episode Snowpiercer 4 7 0 1080p WEB https://www.ygg.re/rss/download?id=1213818&passkey=dojP6mocODxH1jlyKrHgDfm1BFBaJsEg} +2024/08/28 13:50:48 Starting Program +2024/08/28 13:50:48 {"name":"Snowpiercer.S04E07.FRENCH.1080p.WEB.H264-FW","category":"Film/Vidéo","indexer":"YGG Torrent","type":"episode","title":"Snowpiercer","season":"4","episode":"7","year":"0","resolution":"1080p","source":"WEB","torrenturl":"https://www.ygg.re/rss/download?id=1213818\u0026passkey=dojP6mocODxH1jlyKrHgDfm1BFBaJsEg"} +2024/08/28 13:50:48 Message sent... &{Snowpiercer.S04E07.FRENCH.1080p.WEB.H264-FW Film/Vidéo YGG Torrent episode Snowpiercer 4 7 0 1080p WEB https://www.ygg.re/rss/download?id=1213818&passkey=dojP6mocODxH1jlyKrHgDfm1BFBaJsEg} +2024/08/28 13:51:47 Starting Program +2024/08/28 13:51:47 {"name":"Snowpiercer.S04E07.FRENCH.1080p.WEB.H264-FW","category":"Film/Vidéo","indexer":"YGG Torrent","type":"episode","title":"Snowpiercer","season":"4","episode":"7","year":"0","resolution":"1080p","source":"WEB","torrenturl":"https://www.ygg.re/rss/download?id=1213818\u0026passkey=dojP6mocODxH1jlyKrHgDfm1BFBaJsEg"} +2024/08/28 13:51:47 Message sent... &{Snowpiercer.S04E07.FRENCH.1080p.WEB.H264-FW Film/Vidéo YGG Torrent episode Snowpiercer 4 7 0 1080p WEB https://www.ygg.re/rss/download?id=1213818&passkey=dojP6mocODxH1jlyKrHgDfm1BFBaJsEg} +2024/08/28 13:52:40 Starting Program +2024/08/28 13:52:40 {"name":"Snowpiercer.S04E07.FRENCH.1080p.WEB.H264-FW","category":"Film/Vidéo","indexer":"YGG Torrent","type":"episode","title":"Snowpiercer","season":"4","episode":"7","year":"0","resolution":"1080p","source":"WEB","torrenturl":"https://www.ygg.re/rss/download?id=1213818\u0026passkey=dojP6mocODxH1jlyKrHgDfm1BFBaJsEg"} +2024/08/28 13:52:40 Message sent... &{Snowpiercer.S04E07.FRENCH.1080p.WEB.H264-FW Film/Vidéo YGG Torrent episode Snowpiercer 4 7 0 1080p WEB https://www.ygg.re/rss/download?id=1213818&passkey=dojP6mocODxH1jlyKrHgDfm1BFBaJsEg} +2024/08/28 13:57:22 Starting Program +2024/08/28 13:57:22 {"name":"Snowpiercer.S04E07.FRENCH.1080p.WEB.H264-FW","category":"Film/Vidéo","indexer":"YGG Torrent","type":"episode","title":"Snowpiercer","season":"4","episode":"7","year":"0","resolution":"1080p","source":"WEB","torrenturl":"https://www.ygg.re/rss/download?id=1213818\u0026passkey=dojP6mocODxH1jlyKrHgDfm1BFBaJsEg"} +2024/08/28 13:57:22 Message sent... &{Snowpiercer.S04E07.FRENCH.1080p.WEB.H264-FW Film/Vidéo YGG Torrent episode Snowpiercer 4 7 0 1080p WEB https://www.ygg.re/rss/download?id=1213818&passkey=dojP6mocODxH1jlyKrHgDfm1BFBaJsEg} +2024/08/28 13:57:48 Starting Program +2024/08/28 13:57:48 {"name":"Snowpiercer.S04E07.FRENCH.1080p.WEB.H264-FW","category":"Film/Vidéo","indexer":"YGG Torrent","type":"episode","title":"Snowpiercer","season":"4","episode":"7","year":"0","resolution":"1080p","source":"WEB","torrenturl":"https://www.ygg.re/rss/download?id=1213818\u0026passkey=dojP6mocODxH1jlyKrHgDfm1BFBaJsEg"} +2024/08/28 13:57:48 Message sent... &{Snowpiercer.S04E07.FRENCH.1080p.WEB.H264-FW Film/Vidéo YGG Torrent episode Snowpiercer 4 7 0 1080p WEB https://www.ygg.re/rss/download?id=1213818&passkey=dojP6mocODxH1jlyKrHgDfm1BFBaJsEg} +2024/08/28 13:58:02 Starting Program +2024/08/28 13:58:02 {"name":"Snowpiercer.S04E07.FRENCH.1080p.WEB.H264-FW","category":"Film/Vidéo","indexer":"YGG Torrent","type":"episode","title":"Snowpiercer","season":"4","episode":"7","year":"0","resolution":"1080p","source":"WEB","torrenturl":"https://www.ygg.re/rss/download?id=1213818\u0026passkey=dojP6mocODxH1jlyKrHgDfm1BFBaJsEg"} +2024/08/28 13:58:02 Message sent... &{Snowpiercer.S04E07.FRENCH.1080p.WEB.H264-FW Film/Vidéo YGG Torrent episode Snowpiercer 4 7 0 1080p WEB https://www.ygg.re/rss/download?id=1213818&passkey=dojP6mocODxH1jlyKrHgDfm1BFBaJsEg} +2024/08/28 13:59:04 Starting Program +2024/08/28 13:59:04 {"name":"Snowpiercer.S04E07.FRENCH.1080p.WEB.H264-FW","category":"Film/Vidéo","indexer":"YGG Torrent","type":"episode","title":"Snowpiercer","season":"4","episode":"7","year":"0","resolution":"1080p","source":"WEB","torrenturl":"https://www.ygg.re/rss/download?id=1213818\u0026passkey=dojP6mocODxH1jlyKrHgDfm1BFBaJsEg"} +2024/08/28 13:59:04 Message sent... &{Snowpiercer.S04E07.FRENCH.1080p.WEB.H264-FW Film/Vidéo YGG Torrent episode Snowpiercer 4 7 0 1080p WEB https://www.ygg.re/rss/download?id=1213818&passkey=dojP6mocODxH1jlyKrHgDfm1BFBaJsEg} +2024/08/28 13:59:28 Starting Program +2024/08/28 13:59:28 {"torrentname":"Snowpiercer.S04E07.FRENCH.1080p.WEB.H264-FW","category":"Film/Vidéo","indexer":"YGG Torrent","type":"episode","title":"Snowpiercer","season":"4","episode":"7","year":"0","resolution":"1080p","source":"WEB","torrenturl":"https://www.ygg.re/rss/download?id=1213818\u0026passkey=dojP6mocODxH1jlyKrHgDfm1BFBaJsEg"} +2024/08/28 13:59:28 Message sent... &{Snowpiercer.S04E07.FRENCH.1080p.WEB.H264-FW Film/Vidéo YGG Torrent episode Snowpiercer 4 7 0 1080p WEB https://www.ygg.re/rss/download?id=1213818&passkey=dojP6mocODxH1jlyKrHgDfm1BFBaJsEg} +2024/08/28 13:59:41 Starting Program +2024/08/28 13:59:41 {"torrentname":"Snowpiercer.S04E07.FRENCH.1080p.WEB.H264-FW","category":"Film/Vidéo","indexer":"YGG Torrent","type":"episode","title":"Snowpiercer","season":"4","episode":"7","year":"0","resolution":"1080p","source":"WEB","torrenturl":"https://www.ygg.re/rss/download?id=1213818\u0026passkey=dojP6mocODxH1jlyKrHgDfm1BFBaJsEg"} +2024/08/28 13:59:41 Message sent... &{Snowpiercer.S04E07.FRENCH.1080p.WEB.H264-FW Film/Vidéo YGG Torrent episode Snowpiercer 4 7 0 1080p WEB https://www.ygg.re/rss/download?id=1213818&passkey=dojP6mocODxH1jlyKrHgDfm1BFBaJsEg}