NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.

Forum Discussion

buscjon5's avatar
buscjon5
Aspirant
Sep 28, 2011

ReadyNas Duo ReadyDLNA Rescan Media files

Hi.

I have a ReadyNas Duo (which I use to store media files) which is connected to my TV by ethernet cable.

I regularly copy lots avi files to the ReadyNas, watch them on the telly and then delete them from the ReadyNAS. The problem is that the ReadyDLNA service doesn't always keep up with what's on the drive and what's been removed so to correct this I select Services > Streaming Services > ReadyDLNA > Rescan Media Files. This works, but I find I'm doing this every few days. Is there a way I can automate this rescanning from my windows PC?

Any help or suggestions gratefully received.

2 Replies

Replies have been turned off for this discussion
  • I have the same problem it's quite annoying! I'd also be interested if there are any suggestions on fixing it
  • I've just found a solution that works for me. I use Mac OSX and just run a php script from my terminal. But I can show you how you can do the same on windows with clicking on a icon.

    Remember to change the values in the start of my script to your own username/password and ip/hostname to your readynas.

    This is tested on firmware RAIDiator 4.1.8 [1.00a043]. But I think it will work on others too.

    PHP: http://php.net - Windows download
    Howto create a batch file you can click on (and then let the script do the rest): http://www.wikihow.com/Write-a-Batch-File

    If you extract php to C:\php and the php.exe will be C:\php\php.exe your script can look like this, if you copy the script to the C:\php folder:


    @echo off
    C:\php\php.exe -q C:\php\dlna_rescan.php


    My code is here:
    http://mikalv.net/dev/readynas/dlna_rescan.phps

    <?php


    $username = "admin"; // Admin login username
    $password = "password"; // Password for admin login
    $host = "10.7.77.177"; // IP or Hostname to your Readynas
    $https = true; // true = https, false = http.

    function DLNA_Rescan($host,$username,$password,$ssl = true) {
    $http_data = "OPERATION=set&command=UPnPAVRescan&PAGE=Services";
    if ($ssl) {
    $fp = fsockopen("ssl://".$host,443,$errno,$errstr,30);
    } else {
    $fp = fsockopen($host,80,$errno,$errstr,30);
    }

    if (!$fp) {
    $_return = ' error: '.$errno.' '.$errstr;
    echo "[-] Something went wrong. Maybe this output will help you: \n";
    die($_return."\n");

    } else {
    $http = "POST /get_handler HTTP/1.1\r\n".
    "Host: ".$_SERVER['HTTP_HOST']."\r\n".
    "User-Agent: " . $_SERVER['HTTP_USER_AGENT'] . "\r\n".
    "Content-Type: application/x-www-form-urlencoded\r\n".
    "Content-length: " . strlen($http_data) . "\r\n".
    "Authorization: Basic ".base64_encode($username.':'.$password)."\r\n".
    "Connection: close\r\n\r\n".
    $http_data . "\r\n\r\n";

    fwrite($fp, $http);
    $_return = '';
    while (!feof($fp)) {
    $_return .= fgets($fp, 4096);
    }
    fclose($fp);
    if (strstr($_return,'<status>success</status>')) {
    echo "[+] DLNA Service will start rescanning now\n";
    } else {
    echo "[-] Something went wrong. Maybe this output will help you: \n";
    var_dump($_return);
    echo "\n";
    }
    }
    }

    DLNA_Rescan($host,$username,$password,$https);

    ?>

NETGEAR Academy

Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology! 

Join Us!

ProSupport for Business

Comprehensive support plans for maximum network uptime and business peace of mind.

 

Learn More