MCPcopy Create free account
hub / github.com/Unpackerr/unpackerr / checkRadarrQueue

Method checkRadarrQueue

pkg/unpackerr/radarr.go:79–116  ·  view source on GitHub ↗

checkRadarrQueue saves completed Radarr-queued downloads to u.Map.

(now time.Time)

Source from the content-addressed store, hash-verified

77
78// checkRadarrQueue saves completed Radarr-queued downloads to u.Map.
79func (u *Unpackerr) checkRadarrQueue(now time.Time) {
80 for _, server := range u.Radarr {
81 if server.Queue == nil {
82 continue
83 }
84
85 for _, record := range server.Queue.Records {
86 switch x, ok := u.Map[record.Title]; {
87 case ok && x.Status == EXTRACTED && u.isComplete(record.Status, record.Protocol, server.Protocols):
88 u.Debugf("%s (%s): Item Waiting for Import (%s): %v", starr.Radarr, server.URL, record.Protocol, record.Title)
89 case !ok && u.isComplete(record.Status, record.Protocol, server.Protocols):
90 u.Map[record.Title] = &Extract{ // Save the download to our map.
91 App: starr.Radarr,
92 URL: server.URL,
93 Updated: now,
94 Status: WAITING,
95 DeleteOrig: server.DeleteOrig,
96 DeleteDelay: server.DeleteDelay.Duration,
97 Syncthing: server.Syncthing,
98 Path: u.getDownloadPath(record.OutputPath, starr.Radarr, record.Title, server.Paths),
99 IDs: map[string]any{
100 "downloadId": record.DownloadID,
101 "title": record.Title,
102 "movieId": record.MovieID,
103 "reason": buildStatusReason(record.Status, record.StatusMessages),
104 },
105 }
106 u.Map[record.Title].XProg = &ExtractProgress{Extract: u.Map[record.Title]}
107
108 fallthrough
109 default:
110 u.Debugf("%s: (%s): %s (%s:%d%%): %v",
111 starr.Radarr, server.URL, record.Status, record.Protocol,
112 percent(record.Sizeleft, record.Size), record.Title)
113 }
114 }
115 }
116}
117
118// checks if the application currently has an item in its queue.
119func (u *Unpackerr) haveRadarrQitem(name string) bool {

Callers 1

retrieveAppQueuesMethod · 0.95

Calls 5

isCompleteMethod · 0.95
getDownloadPathMethod · 0.95
buildStatusReasonFunction · 0.85
percentFunction · 0.85
DebugfMethod · 0.65

Tested by

no test coverage detected