Support local play when Kodi requires authentication

This commit is contained in:
Tomer Froumin 2018-09-10 22:09:39 +03:00 committed by Martijn Brekhof
parent 639162cc06
commit e2bb7d7c55
1 changed files with 3 additions and 1 deletions

View File

@ -108,7 +108,9 @@ public class FileDownloadHelper {
public String getMediaUrl(HostInfo hostInfo) {
String pathforUrl = fileName.replaceAll(" ", "%20").replaceAll("'","%27");
String videoUrl = String.format("http://%s:%d/vfs/%s", hostInfo.getAddress(),
String credentials = (hostInfo.getPassword() == null || hostInfo.getPassword().isEmpty()) ? "" :
String.format("%s:%s@", hostInfo.getUsername(), hostInfo.getPassword());
String videoUrl = String.format("http://%s%s:%d/vfs/%s", credentials, hostInfo.getAddress(),
hostInfo.getHttpPort(), pathforUrl);
return videoUrl;
}