MCPcopy Index your code
hub / github.com/Threadfin/Threadfin / processStartupWorkflow

Function processStartupWorkflow

src/webserver.go:47–141  ·  view source on GitHub ↗
(operationType string, fileType string)

Source from the content-addressed store, hash-verified

45}
46
47func processStartupWorkflow(operationType string, fileType string) error {
48 if startupWorkflowInProgress {
49 showInfo("SYSTEM: Startup workflow already in progress, skipping")
50 return nil
51 }
52
53 if startupWorkflowCompleted {
54 showInfo("SYSTEM: Startup workflow already completed, running minimal processing")
55
56 err := buildDatabaseDVR()
57 if err != nil {
58 ShowError(err, 0)
59 return err
60 }
61
62 updateUrlsJson()
63 createM3UFile()
64
65 showInfo("SYSTEM: Minimal processing completed")
66 return nil
67 }
68
69 startupWorkflowInProgress = true
70 defer func() {
71 startupWorkflowInProgress = false
72 startupWorkflowCompleted = true
73 }()
74
75 showInfo(fmt.Sprintf("SYSTEM: Starting centralized workflow for operation: %s", operationType))
76
77 switch operationType {
78 case "startup":
79 showInfo("SYSTEM: Running full startup workflow")
80
81 err := buildDatabaseDVR()
82 if err != nil {
83 ShowError(err, 0)
84 return err
85 }
86
87 vodStreamCount := 0
88 for _, stream := range Data.Streams.Active {
89 if s, ok := stream.(map[string]string); ok {
90 if isVOD, exists := s["_is_vod"]; exists && isVOD == "true" {
91 vodStreamCount++
92 }
93 }
94 }
95
96 if vodStreamCount > 0 {
97 showInfo(fmt.Sprintf("SYSTEM: Generating .strm files for %d VOD streams during startup", vodStreamCount))
98 err = generateStrmFiles()
99 if err != nil {
100 ShowError(err, 0)
101 } else {
102 showInfo("SYSTEM: .strm file generation completed successfully")
103 }
104 } else {

Callers 2

StartSystemFunction · 0.85
WSFunction · 0.85

Calls 8

showInfoFunction · 0.85
buildDatabaseDVRFunction · 0.85
ShowErrorFunction · 0.85
updateUrlsJsonFunction · 0.85
createM3UFileFunction · 0.85
generateStrmFilesFunction · 0.85
showDebugFunction · 0.85
buildXEPGFunction · 0.85

Tested by

no test coverage detected