Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
6c3de4b2ef
|
|||
|
a99349e75d
|
|||
|
4f6f54b631
|
40
Makefile
40
Makefile
@@ -3,14 +3,6 @@
|
|||||||
BINARY_NAME := iptvc
|
BINARY_NAME := iptvc
|
||||||
GOARCH ?= amd64
|
GOARCH ?= amd64
|
||||||
|
|
||||||
LINUX_PATH := "bin/linux_$(GOARCH)"
|
|
||||||
WINDOWS_PATH := "bin/windows_$(GOARCH)"
|
|
||||||
DARWIN_PATH := "bin/darwin_$(GOARCH)"
|
|
||||||
|
|
||||||
LINUX_FILE := "$(LINUX_PATH)/$(BINARY_NAME)"
|
|
||||||
WINDOWS_FILE := "$(WINDOWS_PATH)/$(BINARY_NAME).exe"
|
|
||||||
DARWIN_FILE := "$(DARWIN_PATH)/$(BINARY_NAME)"
|
|
||||||
|
|
||||||
## clean: Remove all compiled binaries
|
## clean: Remove all compiled binaries
|
||||||
clean:
|
clean:
|
||||||
@go clean
|
@go clean
|
||||||
@@ -18,27 +10,33 @@ clean:
|
|||||||
|
|
||||||
## linux: Build new binaries for linux
|
## linux: Build new binaries for linux
|
||||||
linux:
|
linux:
|
||||||
@rm -rf $(LINUX_PATH)
|
@rm -rf bin/linux_$(GOARCH)
|
||||||
@GOARCH=$(GOARCH) GOOS=linux go build -o $(LINUX_FILE) . && echo "Compiled: $(LINUX_FILE)"
|
@GOARCH=$(GOARCH) GOOS=linux go build -o bin/linux_$(GOARCH)/$(BINARY_NAME) .
|
||||||
|
@zip -j bin/linux_$(GOARCH).zip bin/linux_$(GOARCH)/$(BINARY_NAME)
|
||||||
|
@echo "Compiled: bin/linux_$(GOARCH)/$(BINARY_NAME) ($(GOARCH))"
|
||||||
|
|
||||||
## win: Build new binaries for windows
|
## win: Build new binaries for windows
|
||||||
win:
|
win:
|
||||||
@rm -rf $(WINDOWS_PATH)
|
@rm -rf bin/windows_$(GOARCH)
|
||||||
@GOARCH=$(GOARCH) GOOS=windows go build -o $(WINDOWS_FILE) . && echo "Compiled: $(WINDOWS_FILE)"
|
@GOARCH=$(GOARCH) GOOS=windows go build -o bin/windows_$(GOARCH)/$(BINARY_NAME).exe .
|
||||||
|
@zip -j bin/windows_$(GOARCH).zip bin/windows_$(GOARCH)/$(BINARY_NAME).exe
|
||||||
|
@echo "Compiled: bin/windows_$(GOARCH)/$(BINARY_NAME).exe ($(GOARCH))"
|
||||||
|
|
||||||
## darwin: Build new binaries for darwin
|
## darwin: Build new binaries for darwin
|
||||||
darwin:
|
darwin:
|
||||||
@rm -rf $(DARWIN_PATH)
|
@rm -rf bin/darwin_$(GOARCH)
|
||||||
@GOARCH=$(GOARCH) GOOS=darwin go build -o $(DARWIN_FILE) . && echo "Compiled: $(DARWIN_FILE)"
|
@GOARCH=$(GOARCH) GOOS=darwin go build -o bin/darwin_$(GOARCH)/$(BINARY_NAME) .
|
||||||
|
@zip -j bin/darwin_$(GOARCH).zip bin/darwin_$(GOARCH)/$(BINARY_NAME)
|
||||||
## all: Build new binaries for linux, windows and darwin
|
@echo "Compiled: bin/darwin_$(GOARCH)/$(BINARY_NAME) ($(GOARCH))"
|
||||||
all: clean linux win darwin
|
|
||||||
|
|
||||||
## release: Build all binaries and zip them
|
## release: Build all binaries and zip them
|
||||||
release: linux win darwin
|
release: clean
|
||||||
@zip -j $(LINUX_PATH).zip $(LINUX_FILE)
|
@make linux GOARCH=amd64
|
||||||
@zip -j $(DARWIN_PATH).zip $(DARWIN_FILE)
|
@make linux GOARCH=arm64
|
||||||
@zip -j $(WINDOWS_PATH).zip $(WINDOWS_FILE)
|
@make win GOARCH=amd64
|
||||||
|
@make win GOARCH=arm64
|
||||||
|
@make darwin GOARCH=amd64
|
||||||
|
@make darwin GOARCH=arm64
|
||||||
|
|
||||||
## help: Show this message and exit
|
## help: Show this message and exit
|
||||||
help: Makefile
|
help: Makefile
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import (
|
|||||||
"github.com/redis/go-redis/v9"
|
"github.com/redis/go-redis/v9"
|
||||||
)
|
)
|
||||||
|
|
||||||
const VERSION = "1.1.2"
|
const VERSION = "1.1.3"
|
||||||
|
|
||||||
// Arguments описывает аргументы командной строки
|
// Arguments описывает аргументы командной строки
|
||||||
type Arguments struct {
|
type Arguments struct {
|
||||||
|
|||||||
15
cmd/check.go
15
cmd/check.go
@@ -9,6 +9,7 @@ package cmd
|
|||||||
import (
|
import (
|
||||||
"axenov/iptv-checker/app"
|
"axenov/iptv-checker/app"
|
||||||
"axenov/iptv-checker/app/checker"
|
"axenov/iptv-checker/app/checker"
|
||||||
|
"axenov/iptv-checker/app/playlist"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
@@ -27,7 +28,6 @@ var checkCmd = &cobra.Command{
|
|||||||
files, _ := cmd.Flags().GetStringSlice("file")
|
files, _ := cmd.Flags().GetStringSlice("file")
|
||||||
urls, _ := cmd.Flags().GetStringSlice("url")
|
urls, _ := cmd.Flags().GetStringSlice("url")
|
||||||
codes, _ := cmd.Flags().GetStringSlice("code")
|
codes, _ := cmd.Flags().GetStringSlice("code")
|
||||||
lists := checker.PrepareListsToCheck(files, urls, codes)
|
|
||||||
|
|
||||||
waitSeconds := app.Args.RepeatEverySec
|
waitSeconds := app.Args.RepeatEverySec
|
||||||
if waitSeconds <= 0 {
|
if waitSeconds <= 0 {
|
||||||
@@ -44,6 +44,16 @@ var checkCmd = &cobra.Command{
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var lists []playlist.Playlist
|
||||||
|
if len(files) == 0 && len(urls) == 0 && len(codes) == 0 {
|
||||||
|
lists = checker.PrepareListsToCheck(files, urls, codes)
|
||||||
|
} else {
|
||||||
|
if currentIteration == 1 {
|
||||||
|
lists = checker.PrepareListsToCheck(files, urls, codes)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(lists) > 0 {
|
||||||
startTime := time.Now()
|
startTime := time.Now()
|
||||||
onlineCount, offlineCount := checker.CheckPlaylists(lists)
|
onlineCount, offlineCount := checker.CheckPlaylists(lists)
|
||||||
|
|
||||||
@@ -59,6 +69,9 @@ var checkCmd = &cobra.Command{
|
|||||||
marshal, _ := json.Marshal(lists)
|
marshal, _ := json.Marshal(lists)
|
||||||
fmt.Println(string(marshal))
|
fmt.Println(string(marshal))
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
log.Println("There are no playlists to check")
|
||||||
|
}
|
||||||
|
|
||||||
if app.Args.RepeatCount != 0 {
|
if app.Args.RepeatCount != 0 {
|
||||||
if uint(currentIteration) == app.Args.RepeatCount {
|
if uint(currentIteration) == app.Args.RepeatCount {
|
||||||
|
|||||||
Reference in New Issue
Block a user