XMLTV Datei erstellen
()
| 1143 | |
| 1144 | // XMLTV Datei erstellen |
| 1145 | func createXMLTVFile() (err error) { |
| 1146 | |
| 1147 | // Image Cache |
| 1148 | // 4edd81ab7c368208cc6448b615051b37.jpg |
| 1149 | var imgc = Data.Cache.Images |
| 1150 | |
| 1151 | Data.Cache.ImagesFiles = []string{} |
| 1152 | Data.Cache.ImagesURLS = []string{} |
| 1153 | Data.Cache.ImagesCache = []string{} |
| 1154 | |
| 1155 | files, err := os.ReadDir(System.Folder.ImagesCache) |
| 1156 | if err == nil { |
| 1157 | |
| 1158 | for _, file := range files { |
| 1159 | |
| 1160 | if indexOfString(file.Name(), Data.Cache.ImagesCache) == -1 { |
| 1161 | Data.Cache.ImagesCache = append(Data.Cache.ImagesCache, file.Name()) |
| 1162 | } |
| 1163 | |
| 1164 | } |
| 1165 | |
| 1166 | } |
| 1167 | |
| 1168 | if len(Data.XMLTV.Files) == 0 && len(Data.Streams.Active) == 0 { |
| 1169 | Data.XEPG.Channels = make(map[string]interface{}) |
| 1170 | return |
| 1171 | } |
| 1172 | |
| 1173 | showInfo("XEPG:" + fmt.Sprintf("Create XMLTV file (%s)", System.File.XML)) |
| 1174 | |
| 1175 | var xepgXML XMLTV |
| 1176 | |
| 1177 | xepgXML.Generator = System.Name |
| 1178 | |
| 1179 | if System.Branch == "main" { |
| 1180 | xepgXML.Source = fmt.Sprintf("%s - %s", System.Name, System.Version) |
| 1181 | } else { |
| 1182 | xepgXML.Source = fmt.Sprintf("%s - %s.%s", System.Name, System.Version, System.Build) |
| 1183 | } |
| 1184 | |
| 1185 | var tmpProgram = &XMLTV{} |
| 1186 | |
| 1187 | for _, dxc := range Data.XEPG.Channels { |
| 1188 | var xepgChannel XEPGChannelStruct |
| 1189 | err := json.Unmarshal([]byte(mapToJSON(dxc)), &xepgChannel) |
| 1190 | if err == nil { |
| 1191 | if xepgChannel.TvgName == "" { |
| 1192 | xepgChannel.TvgName = xepgChannel.Name |
| 1193 | } |
| 1194 | if xepgChannel.XName == "" { |
| 1195 | xepgChannel.XName = xepgChannel.TvgName |
| 1196 | } |
| 1197 | |
| 1198 | if xepgChannel.XActive && !xepgChannel.XHideChannel { |
| 1199 | if (Settings.XepgReplaceChannelTitle && xepgChannel.XMapping == "PPV") || xepgChannel.XName != "" { |
| 1200 | // Kanäle |
| 1201 | var channel Channel |
| 1202 | channel.ID = xepgChannel.XChannelID |
no test coverage detected