Permalink
Browse files

Merge pull request #205 from tarasfrompir/master

Update ssdp_devices_scan.inc.php
  • Loading branch information...
T-REX-XP committed Jul 10, 2018
2 parents 8cc947a + 84f2414 commit 369c7cc5a1fab737009ad93557b5bb538546a580
Showing with 3 additions and 11 deletions.
  1. +3 −11 modules/ssdp_finder/ssdp_devices_scan.inc.php
@@ -50,13 +50,11 @@ function Scan(){
// print_r($device);
$uuid = $device["UDN"];
$existed = SQLSelectOne("SELECT * FROM $table_name WHERE UUID='".$uuid."'");
//$presenturl = $device["presentationURL"];
$presenturl = $device["presentationURL"];
//todo: fix impl
$control_url = str_ireplace("Location:", "", $deviceInfo['location']);
if (!$device["presentationURL"]){
$presenturl='http://'.getIp($control_url,false);
} else {
$presenturl=$xml->device->presentationURL;
}
//end todo
if (!array_search_result($result, 'UUID', $uuid) && !is_null($uuid) && !($existed)) {
@@ -101,14 +99,8 @@ function getIp($baseUrl,$withPort) {
if( !empty($baseUrl) ){
$parsed_url = parse_url($baseUrl);
if($withPort ==true){
if ($parsed_url['host'] == '127.0.0.1'){
$parsed_url['host'] = getLocalIp();
}
$baseUrl = $parsed_url['scheme'].'://'.$parsed_url['host'].':'.$parsed_url['port'];
}else{
if ($parsed_url['host'] == '127.0.0.1'){
$parsed_url['host'] = getLocalIp();
}
$baseUrl = $parsed_url['scheme'].'://'.$parsed_url['host'].':'.$parsed_url['port'];
}else{
$baseUrl = $parsed_url['host'];
}
}

0 comments on commit 369c7cc

Please sign in to comment.