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

Function disablePPV

src/webserver.go:1436–1467  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

1434}
1435
1436func disablePPV(w http.ResponseWriter, r *http.Request) {
1437 xepg, err := loadJSONFileToMap(System.File.XEPG)
1438 if err != nil {
1439 var response APIResponseStruct
1440
1441 response.Status = false
1442 response.Error = err.Error()
1443 w.Write([]byte(mapToJSON(response)))
1444 }
1445
1446 for _, c := range xepg {
1447
1448 var xepgChannel = c.(map[string]interface{})
1449
1450 if xepgChannel["x-mapping"] == "PPV" && xepgChannel["x-active"] == true {
1451 xepgChannel["x-active"] = false
1452 }
1453 }
1454
1455 err = saveMapToJSONFile(System.File.XEPG, xepg)
1456 if err != nil {
1457 var response APIResponseStruct
1458
1459 response.Status = false
1460 response.Error = err.Error()
1461 w.Write([]byte(mapToJSON(response)))
1462 }
1463 buildXEPG()
1464
1465 w.Header().Set("Content-Type", "application/json")
1466 w.WriteHeader(200)
1467}
1468
1469func httpStatusError(w http.ResponseWriter, r *http.Request, httpStatusCode int) {
1470 http.Error(w, fmt.Sprintf("%s [%d]", http.StatusText(httpStatusCode), httpStatusCode), httpStatusCode)

Callers

nothing calls this directly

Calls 4

loadJSONFileToMapFunction · 0.85
saveMapToJSONFileFunction · 0.85
buildXEPGFunction · 0.85
mapToJSONFunction · 0.70

Tested by

no test coverage detected