alexballas/go2tv

invalid port,ask for help

funme opened this issue · 6 comments

funme commented

./go2tv -version
Go2TV Version: 1.4.0, Build: 20210516093811

./go2tv -l

Device 1

Model: Linux/3.14.29, UPnP/1.0, Portable SDK for UPnP devices/1.6.19
URL: http://172.16.9.84:49152/description.xml

./go2tv -v 1.mp4
Encountered error(s): parse "http://172.16.9.84:49152_urn:schemas-upnp-org:service:AVTransport_event": invalid port ":AVTransport_event" after host

target is an android TCL tv.

<?xml version="1.0"?>
<root xmlns="urn:schemas-upnp-org:device-1-0">
    <specVersion>
        <major>1</major>
        <minor>0</minor>
    </specVersion>
    <device>
        <deviceType>urn:schemas-upnp-org:device:MediaRenderer:1</deviceType>
        <presentationURL>/</presentationURL>
        <friendlyName>TV(172.16.9.84)</friendlyName>
        <manufacturer>客厅极光TV(dlna)</manufacturer>
        <manufacturerURL>1</manufacturerURL>
        <modelDescription>1</modelDescription>
        <modelName>1</modelName>
        <modelURL>1</modelURL>
        <dlna:X_DLNADOC xmlns:dlna="urn:schemas-dlna-org:device-1-0">DMR-1.50</dlna:X_DLNADOC>
        <UDN>uuid:be3c114f-485d-62ef-20f3-05908ee6e099</UDN>
        <serviceList>
            <service>
                <serviceType>urn:schemas-upnp-org:service:AVTransport:1</serviceType>
                <serviceId>urn:upnp-org:serviceId:AVTransport</serviceId>
                <SCPDURL>/dlna/Render/AVTransport_scpd.xml</SCPDURL>
                <controlURL>_urn:schemas-upnp-org:service:AVTransport_control</controlURL>
                <eventSubURL>_urn:schemas-upnp-org:service:AVTransport_event</eventSubURL>
            </service>
            <service>
                <serviceType>urn:schemas-upnp-org:service:ConnectionManager:1</serviceType>
                <serviceId>urn:upnp-org:serviceId:ConnectionManager</serviceId>
                <SCPDURL>/dlna/Render/ConnectionManager_scpd.xml</SCPDURL>
                <controlURL>_urn:schemas-upnp-org:service:ConnectionManager_control</controlURL>
                <eventSubURL>_urn:schemas-upnp-org:service:ConnectionManager_event</eventSubURL>
            </service>
            <service>
                <serviceType>urn:schemas-upnp-org:service:RenderingControl:1</serviceType>
                <serviceId>urn:upnp-org:serviceId:RenderingControl</serviceId>
                <SCPDURL>/dlna/Render/RenderingControl_scpd.xml</SCPDURL>
                <controlURL>_urn:schemas-upnp-org:service:RenderingControl_control</controlURL>
                <eventSubURL>_urn:schemas-upnp-org:service:RenderingControl_event</eventSubURL>
            </service>
        </serviceList>
    </device>
    <URLBase>http://172.16.9.84:49152</URLBase>
</root>

edit file go2tv/internal/soapcalls/xmlparsers.go and rebuild (v1)

avtransportControlURL := parsedURL.Scheme + "://" + parsedURL.Host + "/" + root.Device.ServiceList.Services[i].ControlURL
avtransportEventSubURL := parsedURL.Scheme + "://" + parsedURL.Host + "/" + root.Device.ServiceList.Services[i].EventSubURL
./build/go2tv -v /tmp/1.mp4
Encountered error(s): Post "http://172.16.9.84:49152/_urn:schemas-upnp-org:service:AVTransport_control": EOF

edit file go2tv/internal/soapcalls/xmlparsers.go and rebuild (v2)

avtransportControlURL := parsedURL.Scheme + "://" + parsedURL.Host + "/" + strings.TrimLeft(root.Device.ServiceList.Services[i].ControlURL, "_")
avtransportEventSubURL := parsedURL.Scheme + "://" + parsedURL.Host + "/" + strings.TrimLeft(root.Device.ServiceList.Services[i].EventSubURL, "_")
./build/go2tv -v /tmp/1.mp4

Title: 1.mp4
Waiting for status...
Press p to Pause/Play.

but no video on tv

I read a little document about dlna, found v2 is wrong, i will test v1 later again.

Hello,
Thanks for raising this. FYI go2tv has not been tested on all TV models. I had some issues for example with some Hisense TVs too.
Let me do some digging.

The "controlURL" does not look like a valid URL. This is how it looks on my Sasmsung TV

<service>
	<serviceType>urn:schemas-upnp-org:service:RenderingControl:1</serviceType>
	<serviceId>urn:upnp-org:serviceId:RenderingControl</serviceId>
	<controlURL>/upnp/control/RenderingControl1</controlURL>
	<eventSubURL>/upnp/event/RenderingControl1</eventSubURL>
	<SCPDURL>/RenderingControl_1.xml</SCPDURL>
</service>
<service>
	<serviceType>urn:schemas-upnp-org:service:ConnectionManager:1</serviceType>
	<serviceId>urn:upnp-org:serviceId:ConnectionManager</serviceId>
	<controlURL>/upnp/control/ConnectionManager1</controlURL>
	<eventSubURL>/upnp/event/ConnectionManager1</eventSubURL>
	<SCPDURL>/ConnectionManager_1.xml</SCPDURL>
</service>
<service>
	<serviceType>urn:schemas-upnp-org:service:AVTransport:1</serviceType>
	<serviceId>urn:upnp-org:serviceId:AVTransport</serviceId>
	<controlURL>/upnp/control/AVTransport1</controlURL>
	<eventSubURL>/upnp/event/AVTransport1</eventSubURL>
	<SCPDURL>/AVTransport_1.xml</SCPDURL>
</service>

Edit 1:
According to
http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.1.pdf (page 46)

<controlURL>
REQUIRED. URL for control (see section 3, “Control”). MUST be relative to the URL
at which the device description is located in accordance with section 5 of RFC 3986.
Specified by UPnP vendor. Single URL. 
funme commented

Thanks for reply.After a few times test with v1,sometimes it just works,and get stuck in waiting for status ... sometimes.

Yes, v1 should be the correct one. I'll raise a PR to fix the parsing.
As for the "waiting for status ..." it's really up to the device to send the Subscription notifications. I noticed that sometimes devices fail to do so. Please try the following

  • Power cycle your TV (actually remove the power cable for a couple of seconds)
  • Open your TV and wait a bit to properly boot and initialize all the functionalities and then try again.

I noticed similar issus with my Samsung TV when I tried sending a video the second I opened it. It's not a critical issue. Can you please confirm if PLAY/PAUSE actions still work in this case?

funme commented

pause / play works well.

fixed in v1.5.0