From 3be66cf1ca9019d17a352b0146ebdfe7bf1f79cf Mon Sep 17 00:00:00 2001 From: Justin Maggard Date: Sat, 7 Mar 2009 01:46:04 +0000 Subject: [PATCH] * Add ReadyNAS-specific flag file support. --- minidlna.conf | 2 +- scanner.c | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/minidlna.conf b/minidlna.conf index 279933e..eb2d0bf 100644 --- a/minidlna.conf +++ b/minidlna.conf @@ -1,5 +1,5 @@ # port for HTTP (descriptions and SOAP) traffic -port=5555 +port=8200 # set this to the directory you want scanned. # * if have multiple directories, you can have multiple media_dir= lines diff --git a/scanner.c b/scanner.c index 3df493f..82ec02a 100644 --- a/scanner.c +++ b/scanner.c @@ -720,7 +720,14 @@ ScanDirectory(const char * dir, const char * parent, enum media_types type) } if( !parent ) + { startID = get_next_available_id("OBJECTS", BROWSEDIR_ID); + #ifdef READYNAS + FILE * flag = fopen("/ramfs/.upnp-av_scan", "w"); + if( flag ) + fclose(flag); + #endif + } for (i=0; i < n; i++) { sprintf(full_path, "%s/%s", dir, namelist[i]->d_name); @@ -753,6 +760,11 @@ ScanDirectory(const char * dir, const char * parent, enum media_types type) } else { + #ifdef READYNAS + if( access("/ramfs/.rescan_done", F_OK) == 0 ) + system("/bin/sh /ramfs/.rescan_done"); + unlink("/ramfs/.upnp-av_scan"); + #endif DPRINTF(E_WARN, L_SCANNER, "Scanning %s finished (%llu files)!\n", dir, fileno); } }