Tooling für das Veröffentlichen von Pentaradio-Folgen
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
pentaradio-tools/upload.go

32 lines
847 B

/*******************************************************************************
* Copyright 2022 Stefan Majewsky <majewsky@gmx.net>
* SPDX-License-Identifier: GPL-3.0-only
* Refer to the file "LICENSE" for details.
*******************************************************************************/
package main
import (
"os"
"os/exec"
"strings"
)
func Upload(scan ScanResult) {
sftpCommands := []string{
"cd pentaradio/shownotes",
"put " + scan.ShowNotesFile(),
"cd ../chaptermarks",
"put " + scan.ChapterMarksFile(),
"cd ..",
}
for _, fileName := range scan.AudioFileNames {
sftpCommands = append(sftpCommands, "put "+fileName)
}
cmd := exec.Command("sftp", "-b", "-", "ftp.c3d2.de")
cmd.Stdin = strings.NewReader(strings.Join(sftpCommands, "\n") + "\n")
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
must(cmd.Run())
}