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

Function Init

src/config.go:50–238  ·  view source on GitHub ↗

Init : Systeminitialisierung

()

Source from the content-addressed store, hash-verified

48
49// Init : Systeminitialisierung
50func Init() (err error) {
51
52 var debug string
53
54 // System Einstellungen
55 System.AppName = strings.ToLower(System.Name)
56 System.ARCH = runtime.GOARCH
57 System.OS = runtime.GOOS
58 System.ServerProtocol.API = "http"
59 System.ServerProtocol.DVR = "http"
60 System.ServerProtocol.M3U = "http"
61 System.ServerProtocol.WEB = "http"
62 System.ServerProtocol.XML = "http"
63 System.PlexChannelLimit = 480
64 System.UnfilteredChannelLimit = 480
65 System.Compatibility = "0.1.0"
66
67 // FFmpeg Default Einstellungen
68 System.FFmpeg.DefaultOptions = "-hide_banner -loglevel error -analyzeduration 1000000 -probesize 1000000 -i [URL] -map 0:v -map 0:a:0 -c:v copy -c:a aac -b:a 192k -ac 2 -c:s copy -f mpegts -fflags +genpts -movflags +faststart -copyts pipe:1"
69 System.VLC.DefaultOptions = "-I dummy [URL] --sout #std{mux=ts,access=file,dst=-}"
70
71 // Default Logeinträge, wird später von denen aus der settings.json überschrieben. Muss gemacht werden, damit die ersten Einträge auch im Log (webUI aangezeigt werden)
72 Settings.LogEntriesRAM = 500
73
74 // Variablen für den Update Prozess
75 //System.Update.Git = "https://github.com/Threadfin/Threadfin/blob"
76 System.Update.Git = fmt.Sprintf("https://github.com/%s/%s", System.GitHub.User, System.GitHub.Repo)
77 System.Update.Github = fmt.Sprintf("https://api.github.com/repos/%s/%s", System.GitHub.User, System.GitHub.Repo)
78 System.Update.Name = "Threadfin"
79
80 // Ordnerpfade festlegen
81 var tempFolder = os.TempDir() + string(os.PathSeparator) + System.AppName + string(os.PathSeparator)
82 tempFolder = getPlatformPath(strings.Replace(tempFolder, "//", "/", -1))
83
84 if len(System.Folder.Config) == 0 {
85 System.Folder.Config = GetUserHomeDirectory() + string(os.PathSeparator) + "." + System.AppName + string(os.PathSeparator)
86 } else {
87 System.Folder.Config = strings.TrimRight(System.Folder.Config, string(os.PathSeparator)) + string(os.PathSeparator)
88 }
89
90 System.Folder.Config = getPlatformPath(System.Folder.Config)
91
92 System.Folder.Backup = System.Folder.Config + "backup" + string(os.PathSeparator)
93 System.Folder.Data = System.Folder.Config + "data" + string(os.PathSeparator)
94 System.Folder.Cache = System.Folder.Config + "cache" + string(os.PathSeparator)
95 System.Folder.ImagesCache = System.Folder.Cache + "images" + string(os.PathSeparator)
96 System.Folder.ImagesUpload = System.Folder.Data + "images" + string(os.PathSeparator)
97 System.Folder.Temp = tempFolder
98
99 // Dev Info
100 showDevInfo()
101
102 // System Ordner erstellen
103 err = createSystemFolders()
104 if err != nil {
105 ShowError(err, 1070)
106 return
107 }

Callers 2

mainFunction · 0.92
ThreadfinRestoreFunction · 0.70

Calls 15

GetUserHomeDirectoryFunction · 0.85
showDevInfoFunction · 0.85
createSystemFoldersFunction · 0.85
ShowErrorFunction · 0.85
resolveHostIPFunction · 0.85
showWarningFunction · 0.85
showDebugFunction · 0.85
showInfoFunction · 0.85
createSystemFilesFunction · 0.85
conditionalUpdateChangesFunction · 0.85
loadSettingsFunction · 0.85

Tested by

no test coverage detected