t
This commit is contained in:
parent
9e68d4eedb
commit
cba9b4968e
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
log.txt
|
24
DeleteArr.go
24
DeleteArr.go
@ -3,26 +3,28 @@ package main
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type MediaFiles struct {
|
||||
EventType string
|
||||
SourcePath string
|
||||
SourceFolder string
|
||||
FileName string
|
||||
InFolder bool
|
||||
Arr string
|
||||
}
|
||||
|
||||
func (m *MediaFiles) IsInFolder() {
|
||||
folderList := []string{"Movies", "4K-Movies"}
|
||||
dir, f := path.Split(m.SourcePath)
|
||||
m.FileName = f
|
||||
folderList := []string{"Movies", "4K-Movies", "Series", "4K-Series", "Kids", "Animes"}
|
||||
|
||||
ContainsFolder := slices.Contains(folderList, dir)
|
||||
SplitFolder := strings.Split(m.SourceFolder, "/")
|
||||
LastFolder := SplitFolder[len(SplitFolder)-1]
|
||||
|
||||
log.Printf("Found last folder to be: %v", LastFolder)
|
||||
|
||||
ContainsFolder := slices.Contains(folderList, LastFolder)
|
||||
|
||||
if !ContainsFolder {
|
||||
m.InFolder = true
|
||||
@ -35,9 +37,9 @@ func (m *MediaFiles) IsInFolder() {
|
||||
|
||||
func main() {
|
||||
|
||||
// os.Setenv("radarr_moviefile_sourcepath", "/mnt/Multimedia/Download/PostProcess/Movies/Butchers.Crossing.2023.MULTi.1080p.WEB.x264-FW/Butchers.Crossing.2023.MULTi.1080p.WEB.x264-FW.mkv")
|
||||
// os.Setenv("radarr_moviefile_sourcefolder", "/mnt/Multimedia/Download/PostProcess/Movies/Butchers.Crossing.2023.MULTi.1080p.WEB.x264-FW")
|
||||
// os.Setenv("radarr_eventtype", "Download")
|
||||
os.Setenv("radarr_moviefile_sourcepath", "/mnt/Multimedia/Download/PostProcess/Movies/Butchers.Crossing.2023.MULTi.1080p.WEB.x264-FW.mkv")
|
||||
os.Setenv("radarr_moviefile_sourcefolder", "/mnt/Multimedia/Download/PostProcess/Movies")
|
||||
os.Setenv("radarr_eventtype", "Download")
|
||||
|
||||
ex, err := os.Executable()
|
||||
if err != nil {
|
||||
@ -59,11 +61,12 @@ func main() {
|
||||
m := &MediaFiles{}
|
||||
|
||||
if RadarrEventType != "" {
|
||||
m.EventType = os.Getenv("rad")
|
||||
m.EventType = os.Getenv("radarr_eventtype")
|
||||
m.SourcePath = os.Getenv("radarr_moviefile_sourcepath")
|
||||
log.Printf("The Source Path is: %v", m.SourcePath)
|
||||
m.SourceFolder = os.Getenv("radarr_moviefile_sourcefolder")
|
||||
log.Printf("The Source Folder is: %v", m.SourceFolder)
|
||||
m.Arr = "Radarr"
|
||||
|
||||
}
|
||||
|
||||
@ -73,6 +76,7 @@ func main() {
|
||||
log.Printf("The Source Path is: %v", m.SourcePath)
|
||||
m.SourceFolder = os.Getenv("radarr_moviefile_sourcefolder")
|
||||
log.Printf("The Source Folder is: %v", m.SourceFolder)
|
||||
m.Arr = "Sonarr"
|
||||
}
|
||||
|
||||
m.IsInFolder()
|
||||
|
Loading…
x
Reference in New Issue
Block a user