Add all handlers from first doc.
This commit is contained in:
parent
7b49753570
commit
e99d452f8d
@ -58,6 +58,22 @@ type ConfigVodsResponse struct {
|
|||||||
Provider string `json:"provider"` // Human-readable name of the content provider. Applicable to MPEG-TS.
|
Provider string `json:"provider"` // Human-readable name of the content provider. Applicable to MPEG-TS.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type SingleVodsResponse struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Prefix string `json:"prefix"`
|
||||||
|
Url string `json:"url"`
|
||||||
|
Folder string `json:"folder"`
|
||||||
|
Bytes int64 `json:"bytes"`
|
||||||
|
MediaInfo MediaSingleVodsResponse `json:"media_info"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type MediaSingleVodsResponse struct {
|
||||||
|
Tracks map[string]string `json:"tracks"`
|
||||||
|
Duration int `json:"duration"`
|
||||||
|
Provider string `json:"provider"`
|
||||||
|
Title string `json:"title"`
|
||||||
|
}
|
||||||
|
|
||||||
// Inactive5Minutes checks if a folder has files that was not created or modified for last 5 minutes.
|
// Inactive5Minutes checks if a folder has files that was not created or modified for last 5 minutes.
|
||||||
func Inactive5Minutes(entries []os.DirEntry) (bool, error) {
|
func Inactive5Minutes(entries []os.DirEntry) (bool, error) {
|
||||||
threshold := time.Now().Add(-5 * time.Minute)
|
threshold := time.Now().Add(-5 * time.Minute)
|
||||||
@ -364,18 +380,21 @@ func SingleVodsHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type SingleVodsResponse struct {
|
// DelSingleVodsHandler deletes a VOD file by its name.
|
||||||
Name string `json:"name"`
|
//
|
||||||
Prefix string `json:"prefix"`
|
// This method deletes a VOD file by its name.
|
||||||
Url string `json:"url"`
|
func DelSingleVodsHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
Folder string `json:"folder"`
|
// Read camera id, res, filename.
|
||||||
Bytes int64 `json:"bytes"`
|
id := r.PathValue("id")
|
||||||
MediaInfo MediaSingleVodsResponse `json:"media_info"`
|
res := r.PathValue("res")
|
||||||
}
|
file := r.PathValue("file")
|
||||||
|
|
||||||
type MediaSingleVodsResponse struct {
|
if err := os.Remove(fmt.Sprintf("%s/%s/%s/%s", config.DirData, id, res, file)); err != nil {
|
||||||
Tracks map[string]string `json:"tracks"`
|
http.Error(w, err.Error(), http.StatusNotFound)
|
||||||
Duration int `json:"duration"`
|
logger.Log.Error("file does not exist", zap.Error(err))
|
||||||
Provider string `json:"provider"`
|
return
|
||||||
Title string `json:"title"`
|
}
|
||||||
|
|
||||||
|
w.WriteHeader(http.StatusNoContent)
|
||||||
|
w.Write([]byte("Deleted"))
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user