Poller #9
@ -23,7 +23,7 @@ func removeBOM(input []byte) []byte {
|
||||
func downloadFile(drmdFilename string, item Item, jobInfo *JobInfo) error {
|
||||
logger.LogInfo("Download File", fmt.Sprintf("Starting download for: %s", item.Filename))
|
||||
|
||||
tempDir := filepath.Join(config.TempBaseDir, sanitizeFilename(item.Filename))
|
||||
tempDir := filepath.Join(config.General.TempBaseDir, sanitizeFilename(item.Filename))
|
||||
err := os.MkdirAll(tempDir, 0755)
|
||||
if err != nil {
|
||||
logger.LogError("Download File", fmt.Sprintf("Error creating temporary directory: %v", err))
|
||||
@ -132,7 +132,7 @@ func downloadFile(drmdFilename string, item Item, jobInfo *JobInfo) error {
|
||||
for {
|
||||
if outputBuffer.Len() > 0 {
|
||||
message := outputBuffer.Bytes()
|
||||
if config.EnableConsole {
|
||||
if config.General.EnableConsole {
|
||||
broadcast(drmdFilename, message)
|
||||
}
|
||||
outputBuffer.Reset()
|
||||
@ -183,9 +183,9 @@ func getDownloadCommand(item Item, mpdPath string, tempDir string) string {
|
||||
filename := fmt.Sprintf("\"%s\"", sanitizedFilename)
|
||||
command += fmt.Sprintf(" --save-name %s", filename)
|
||||
|
||||
command += fmt.Sprintf(" --mux-after-done format=%s", config.Format)
|
||||
command += fmt.Sprintf(" --mux-after-done format=%s", config.General.Format)
|
||||
|
||||
saveDir := config.BaseDir
|
||||
saveDir := config.General.BaseDir
|
||||
if metadata.Type == "serie" {
|
||||
saveDir = filepath.Join(saveDir, "Series", metadata.Title, metadata.Season)
|
||||
} else {
|
||||
|
@ -386,8 +386,8 @@ var clients = make(map[string]map[*websocket.Conn]bool)
|
||||
var mu sync.Mutex
|
||||
|
||||
func handleWebSocket(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Println(config.EnableConsole)
|
||||
if !config.EnableConsole {
|
||||
fmt.Println(config.General.EnableConsole)
|
||||
if !config.General.EnableConsole {
|
||||
http.Error(w, "Console output is disabled", http.StatusForbidden)
|
||||
return
|
||||
}
|
||||
@ -428,7 +428,7 @@ func handleWebSocket(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func broadcast(filename string, message []byte) {
|
||||
if !config.EnableConsole {
|
||||
if !config.General.EnableConsole {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ func startWebServer() {
|
||||
http.HandleFunc("/clear-completed", handleClearCompleted)
|
||||
http.HandleFunc("/ws", handleWebSocket)
|
||||
|
||||
fmt.Println("Starting web server on http://0.0.0.0:8080")
|
||||
logger.LogInfo("Main", "Starting web server on http://0.0.0.0:8080")
|
||||
http.ListenAndServe(":8080", nil)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user