github.com/rclone/rclone@v1.66.1-0.20240517100346-7b89735ae726/cmd/serve/dlna/cms.go (about)

     1  //go:build go1.21
     2  
     3  package dlna
     4  
     5  import (
     6  	"net/http"
     7  
     8  	"github.com/anacrolix/dms/upnp"
     9  )
    10  
    11  const defaultProtocolInfo = "http-get:*:video/mpeg:*,http-get:*:video/mp4:*,http-get:*:video/vnd.dlna.mpeg-tts:*,http-get:*:video/avi:*,http-get:*:video/x-matroska:*,http-get:*:video/x-ms-wmv:*,http-get:*:video/wtv:*,http-get:*:audio/mpeg:*,http-get:*:audio/mp3:*,http-get:*:audio/mp4:*,http-get:*:audio/x-ms-wma*,http-get:*:audio/wav:*,http-get:*:audio/L16:*,http-get:*image/jpeg:*,http-get:*image/png:*,http-get:*image/gif:*,http-get:*image/tiff:*"
    12  
    13  type connectionManagerService struct {
    14  	*server
    15  	upnp.Eventing
    16  }
    17  
    18  func (cms *connectionManagerService) Handle(action string, argsXML []byte, r *http.Request) (map[string]string, error) {
    19  	switch action {
    20  	case "GetProtocolInfo":
    21  		return map[string]string{
    22  			"Source": defaultProtocolInfo,
    23  			"Sink":   "",
    24  		}, nil
    25  	default:
    26  		return nil, upnp.InvalidActionError
    27  	}
    28  }