Add xteve.xml GZIP
This commit is contained in:
@@ -146,3 +146,20 @@ func extractGZIP(gzipBody []byte, fileSource string) (body []byte, err error) {
|
||||
body = resB.Bytes()
|
||||
return
|
||||
}
|
||||
|
||||
func compressGZIP(data *[]byte, file string) (err error) {
|
||||
|
||||
if len(file) != 0 {
|
||||
|
||||
f, err := os.Create(file)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
w := gzip.NewWriter(f)
|
||||
w.Write(*data)
|
||||
w.Close()
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@@ -98,6 +98,8 @@ func Init() (err error) {
|
||||
System.File.XML = getPlatformFile(fmt.Sprintf("%s%s.xml", System.Folder.Data, System.AppName))
|
||||
System.File.M3U = getPlatformFile(fmt.Sprintf("%s%s.m3u", System.Folder.Data, System.AppName))
|
||||
|
||||
System.Compressed.GZxml = getPlatformFile(fmt.Sprintf("%s%s.xml.gz", System.Folder.Data, System.AppName))
|
||||
|
||||
err = activatedSystemAuthentication()
|
||||
if err != nil {
|
||||
return
|
||||
|
||||
@@ -42,6 +42,10 @@ type SystemStruct struct {
|
||||
XML string
|
||||
}
|
||||
|
||||
Compressed struct {
|
||||
GZxml string
|
||||
}
|
||||
|
||||
Flag struct {
|
||||
Branch string
|
||||
Debug int
|
||||
|
||||
@@ -216,7 +216,6 @@ func xTeVe(w http.ResponseWriter, r *http.Request) {
|
||||
// XMLTV Datei
|
||||
if strings.Contains(path, "xmltv/") {
|
||||
|
||||
w.Header().Set("Content-Type", "application/xml")
|
||||
requestType = "xml"
|
||||
|
||||
file = System.Folder.Data + getFilenameFromPath(path)
|
||||
@@ -227,6 +226,8 @@ func xTeVe(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", http.DetectContentType([]byte(content)))
|
||||
|
||||
}
|
||||
|
||||
// M3U Datei
|
||||
|
||||
@@ -641,9 +641,10 @@ func createXMLTVFile() (err error) {
|
||||
var xmlOutput = []byte(xml.Header + string(content))
|
||||
writeByteToFile(System.File.XML, xmlOutput)
|
||||
|
||||
xepgXML = XMLTV{}
|
||||
showInfo("XEPG:" + fmt.Sprintf("Compress XMLTV file (%s)", System.Compressed.GZxml))
|
||||
err = compressGZIP(&xmlOutput, System.Compressed.GZxml)
|
||||
|
||||
//saveMapToJSONFile(System.File.Images, Data.Cache.ImageCache)
|
||||
xepgXML = XMLTV{}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user