Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DLNA #1364

Merged
merged 22 commits into from
May 20, 2021
Merged

DLNA #1364

merged 22 commits into from
May 20, 2021

Conversation

WithoutPants
Copy link
Collaborator

Resolves #850

Adds a DLNA tab to the Settings page:

image

This allows the user to enable or disable DLNA by default, and to override these with time-based overrides:

image

So if DLNA is disabled by default, then the user can enable it for a specific time, or until server restart. Likewise, it can be disabled for a specific time if it is enabled by default. This temporary behaviour can be cancelled with the cancel button.

By default, the server will reject connections to it and record the IP addresses. These addresses can be allowed temporarily similarly to above, with individual cancel buttons. IP addresses can be whitelisted manually using the text field.

A default whitelist can also be configured.

The DLNA server serves up folders for all scenes, performers, studios, tags, movies and ratings. Here is a screenshot in VLC:

image

Where many scenes are present, it presents pages instead:

image

It gives a prefix for ten entries, since these were expensive to calculate.

I was able to test successfully in VLC and on my LG TV. I was unable to get it working for Kodi - and this seems the same for XBVR, rclone and DMS.

@WithoutPants WithoutPants added the feature Pull requests that add a new feature label May 4, 2021
@WithoutPants WithoutPants added this to the Version 0.8.0 milestone May 4, 2021
@bnkai
Copy link
Collaborator

bnkai commented May 6, 2021

Some feedback from the discord channel

After several failed attempts to configure my firewall correctly I finally was able to get the DNLA running on my Panasonic TV. 

4 things I noticed: 

1. HEVC files fail to play cause my TV doesn't have the codec and the files aren't transcoded
2. Accessing Performers leads to a server error on my TV
3. The correct number of studios is shown, but only the first 20 studios in alphabetical are displayed and then those repeat over and over again
4. No logs other than the Debug => SQL: Select's

From my testing using VLC in linux, android everything seems fine.
A minor annoyance is that by default the dlna server listens to all interfaces. That can be a bit annoying as even though no client is accepted the presence of the server can be leaked.
From what i can see setting the IfName in the config of the server (instead of using "" which is and can stay as the default) should limit the dlna server to a single chosen interface. ( A list of interfaces can be retrieved by net.Interfaces() ).

EDIT:
Adding/Removing a default IP and then saving seems to work ok but then if you try to leave the page it triggers the Unsaved changes. Are you sure you want to leave? popup

@WithoutPants
Copy link
Collaborator Author

Happy to report that Kodi support is now fixed.

  1. HEVC files fail to play cause my TV doesn't have the codec and the files aren't transcoded

I'm going to defer transcode support for a later PR. It's an extra layer of complexity I don't want to include right now.

  1. Accessing Performers leads to a server error on my TV

I've not been able to reproduce this locally.

  1. The correct number of studios is shown, but only the first 20 studios in alphabetical are displayed and then those repeat over and over again

Nor this.

  1. No logs other than the Debug => SQL: Select's

I've added some trace-level logging of the request and response for now.

A minor annoyance is that by default the dlna server listens to all interfaces. That can be a bit annoying as even though no client is accepted the presence of the server can be leaked.
From what i can see setting the IfName in the config of the server (instead of using "" which is and can stay as the default) should limit the dlna server to a single chosen interface. ( A list of interfaces can be retrieved by net.Interfaces() ).

I've added an interfaces list configuration option. I didn't want to add an extra graphql interface for listing network interfaces, so it's just a plain text list right now.

Adding/Removing a default IP and then saving seems to work ok but then if you try to leave the page it triggers the Unsaved changes. Are you sure you want to leave? popup

This should now be fixed.

pkg/dlna/cds.go Outdated Show resolved Hide resolved
Comment on lines +71 to +78
var tmp []net.Interface
for _, if_ := range ifs {
if if_.Flags&net.FlagUp == 0 || if_.MTU <= 0 {
continue
}
tmp = append(tmp, if_)
}
ifs = tmp
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is a tmp interface slice needed to clean the ifs ?
Cant we remove the above code and just adjust line 61?

if if_ != nil {
  if if_.Flags&net.FlagUp == 0 || if_.MTU <= 0 {
 	continue
  }	
ifs = append(ifs, *if_)
}

			

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 61 only applies where ifNames is not empty.

@bnkai
Copy link
Collaborator

bnkai commented May 19, 2021

Everything seems to work ok. Selecting an interface works fine and the unsaved popup issue is fixed also.

@WithoutPants WithoutPants merged commit 76019af into stashapp:develop May 20, 2021
@Tscherno
Copy link

Which port is needed in Docker?

@peolic

This comment has been minimized.

@bnkai
Copy link
Collaborator

bnkai commented May 24, 2021

The docker needs the host network to run dlna i would have a look in the discord channel for details https://discord.com/channels/559159668438728723/642079454054711306/846241919985516570

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Pull requests that add a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] DLNA
4 participants