Process timestamps properly
This commit is contained in:
@@ -6,11 +6,12 @@ import (
|
||||
"os/exec"
|
||||
|
||||
"github.com/debridmediamanager.com/zurg/internal/config"
|
||||
"github.com/debridmediamanager.com/zurg/pkg/logutil"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type ScriptExecutor struct {
|
||||
Script string
|
||||
Args []string
|
||||
}
|
||||
|
||||
func (se *ScriptExecutor) Execute() (string, error) {
|
||||
@@ -29,11 +30,10 @@ func (se *ScriptExecutor) Execute() (string, error) {
|
||||
return out.String(), nil
|
||||
}
|
||||
|
||||
func OnLibraryUpdateHook(config config.ConfigInterface) {
|
||||
log := logutil.NewLogger().Named("hooks")
|
||||
|
||||
func OnLibraryUpdateHook(paths []string, config config.ConfigInterface, log *zap.SugaredLogger) {
|
||||
executor := &ScriptExecutor{
|
||||
Script: config.GetOnLibraryUpdate(),
|
||||
Args: paths,
|
||||
}
|
||||
output, err := executor.Execute()
|
||||
if err != nil {
|
||||
|
||||
@@ -329,7 +329,8 @@ func (t *TorrentManager) startRefreshJob() {
|
||||
t.repairAll()
|
||||
t.log.Info("Finished checking for torrents to repair")
|
||||
}
|
||||
go OnLibraryUpdateHook(t.cfg)
|
||||
// TODO: pass the changed directories to the hook
|
||||
go OnLibraryUpdateHook([]string{}, t.cfg, t.log)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -404,7 +405,7 @@ func hashStringToFh(s string) (fh uint64) {
|
||||
|
||||
func (t *TorrentManager) getName(name, originalName string) string {
|
||||
// drop the extension from the name
|
||||
if t.cfg.EnableRetainFolderNameExtension() && strings.Contains(name, originalName) {
|
||||
if t.cfg.EnableRetainFolderNameExtension() {
|
||||
return name
|
||||
} else {
|
||||
ret := strings.TrimSuffix(originalName, ".mp4")
|
||||
|
||||
Reference in New Issue
Block a user