Changes to be committed:

modified:   cmd/pmomusic/main.go
	modified:   go.mod
	modified:   go.sum
	modified:   internal/ssdp/responder.go
	modified:   internal/ssdp/ssdp.go
	new file:   internal/ssdp/uuid.go
	renamed:    internal/upnp/http.go -> internal/upnp/description_xml.go
	modified:   internal/upnp/device.go
	renamed:    web/index.html -> internal/upnp/html/index.html
	modified:   internal/upnp/server.go
	modified:   internal/upnp/service.go
	new file:   internal/upnp/xml/Info.xml
	new file:   internal/upnp/xml/Playlist.xml
	new file:   internal/upnp/xml/Product.xml
This commit is contained in:
2025-06-08 21:39:58 +02:00
parent 2e80eb85d2
commit 2a8bba25a1
14 changed files with 645 additions and 21 deletions

View File

@@ -1,7 +1,7 @@
package main
import (
"log"
log "github.com/sirupsen/logrus"
"gargoton.petite-maison-orange.fr/eric/pmomusic/internal/netutils"
"gargoton.petite-maison-orange.fr/eric/pmomusic/internal/ssdp"
@@ -15,14 +15,27 @@ func main() {
log.Fatalf("Could not guess local IP: %v", err)
}
location := "http://" + localIP + ":1400/description.xml"
usn := "uuid:pmomusic-renderer-001"
usn := ssdp.GetUUID()
desc := upnp.NewDevice(localIP, 1400, usn, "pmomusic Fake Renderer", "pmomusic")
desc.RegisterService("urn:schemas-upnp-org:service:AVTransport:1")
desc.RegisterService("urn:schemas-upnp-org:service:RenderingControl:1")
desc.RegisterService("urn:schemas-upnp-org:service:ConnectionManager:1")
desc.RegisterService("urn:av-openhome-org:service:Product:1")
desc.RegisterService("urn:av-openhome-org:service:Playlist:1")
desc.RegisterService("urn:av-openhome-org:service:Info:1")
location := "http://" + localIP + ":1400/description.xml"
log.Printf("Server UUID: %s", usn)
log.Info(desc.GenerateXML())
// Démarre la diffusion SSDP
go ssdp.AnnounceRenderer(usn, location)
go ssdp.StartSSDPResponder(usn, location)
go ssdp.AnnounceRenderer(desc)
go ssdp.StartSSDPResponder(desc)
// Lance le serveur HTTP
log.Println("Starting HTTP server at:", location)
upnp.StartHTTPServer(usn, localIP, 1400)
upnp.StartHTTPServer(desc)
}