Compare commits
10 Commits
996ceb25ab
...
main
Author | SHA1 | Date | |
---|---|---|---|
eb48408b4d | |||
02c511b1eb | |||
071e230aed | |||
08db9cb820 | |||
977018f104 | |||
63269ff6bc | |||
12c539663b | |||
5e24ba6051 | |||
fd99333bc1 | |||
42aad9a4f3 |
18
DeleteArr.go
18
DeleteArr.go
@ -64,6 +64,8 @@ func (m *MediaFiles) SendGotify(message string, arr string, cfg *Config) {
|
||||
if cfg.Gotify.Enabled {
|
||||
http.PostForm(cfg.Gotify.ServerURL+"/message?token="+cfg.Gotify.Token,
|
||||
url.Values{"message": {message}, "title": {"Deleting Media from " + arr}, "priority": {"10"}})
|
||||
|
||||
log.Printf("Message sent to Gotify: %s", message)
|
||||
}
|
||||
}
|
||||
|
||||
@ -129,7 +131,7 @@ func main() {
|
||||
if RadarrEventType != "" {
|
||||
m.EventType = os.Getenv("radarr_eventtype")
|
||||
m.SourcePath = os.Getenv("radarr_moviefile_sourcepath")
|
||||
log.Printf("The Source Path is: %v", m.SourcePath)
|
||||
log.Printf("---------------------------------------------------------\nThe 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"
|
||||
@ -139,8 +141,8 @@ func main() {
|
||||
if SonarrEventType != "" {
|
||||
m.EventType = os.Getenv("sonarr_eventtype")
|
||||
m.SourcePath = os.Getenv("sonarr_episodefile_sourcepath")
|
||||
log.Printf("The Source Path is: %v", m.SourcePath)
|
||||
m.SourceFolder = os.Getenv("radarr_moviefile_sourcefolder")
|
||||
log.Printf("---------------------------------------------------------\nThe Source Path is: %v", m.SourcePath)
|
||||
m.SourceFolder = os.Getenv("sonarr_episodefile_sourcefolder")
|
||||
log.Printf("The Source Folder is: %v", m.SourceFolder)
|
||||
m.Arr = "Sonarr"
|
||||
}
|
||||
@ -164,11 +166,17 @@ func main() {
|
||||
|
||||
for _, v := range files {
|
||||
log.Println("Found file: " + v.Name())
|
||||
if filepath.Base(v.Name()) == "sample.mkv" {
|
||||
os.Remove(m.SourceFolder + "/" + v.Name())
|
||||
}
|
||||
if _, err = os.Stat(m.SourceFolder + "/Sample"); !os.IsNotExist(err) {
|
||||
os.Remove(m.SourceFolder + "/Sample")
|
||||
}
|
||||
if filepath.Ext(v.Name()) == ".mkv" {
|
||||
mkvCount += 1
|
||||
} else {
|
||||
os.Remove(m.SourceFolder + "/" + v.Name())
|
||||
log.Printf("Deleting file non MKV file: %v", m.SourceFolder+"/"+v.Name())
|
||||
log.Printf("Deleting non MKV file: %v", m.SourceFolder+"/"+v.Name())
|
||||
}
|
||||
}
|
||||
|
||||
@ -176,7 +184,7 @@ func main() {
|
||||
log.Printf("Found %v MKV files in the folder, deleting only %v", mkvCount, m.SourcePath)
|
||||
os.Remove(m.SourcePath)
|
||||
} else {
|
||||
log.Printf("Found only one MKV files in the folder, deleting thoe folder %v", m.SourceFolder)
|
||||
log.Printf("Found only one MKV files in the folder, deleting the folder %v", m.SourceFolder)
|
||||
os.RemoveAll(m.SourceFolder)
|
||||
}
|
||||
|
||||
|
@ -9,3 +9,4 @@ general:
|
||||
- Series
|
||||
- 4K-Series
|
||||
- Kids
|
||||
- Animes
|
Reference in New Issue
Block a user