Jump to content
XPEnology Community

DSM5.0 Indexing Issue


baboulz

Recommended Posts

Hi, I'm having issues with indexing since upgrading to dsm5.0. The script i use to update my files in videostation no longer works.

Here's the script.

 

### Logging: Adjust the path below to the base-directory where you place the script (if you don't need logging, comment out)

use lib qw(/volume2/Public/Scripts);

use Logging::Log;

 

@include_files = ("ASF","AVI","DIVX","IMG","ISO","M1V","M2P","M2T","M2TS","M2V",

"M4V","MKV","MOV","MP4","MPEG4","MPE","MPG","MPG4","MTS","QT","RM","TP","TRP","TS","VOB","WMV","XVID"

);

 

# message of synoindex indicating that file is not indexed

# for English this is: "Failed to get MediaInfo."

# You can get the message in your locale with the following command (execute as is): synoindex -g "myfile.test" -t video

my $SYNO_ERROR_MSG = "Failed to get MediaInfo.";

 

 

## Initialise logging (comment out if you don't need it - but then also comment out the relevant sections in the code below

my $log = Logging::Log->new();

my $log = Logging::Log->new(Handle => \*F);

my $log = Logging::Log->new(File => "/var/log/media-update.log", Mode => 'append');

 

# pass in number the directory to scan, this will be a recursive scan

my $scan_dir = shift;

 

if (!$scan_dir) {

$log->entry("No scanning directory passed, using /volume1/video");

$scan_dir="/volume2/Public/Films";

}

 

### Search for files which have changed during the last two days (adjust if necessary to shorter/longer intervals)

my @files = `find $scan_dir -type f -mtime -2`;

my $files_indexed = 0;

 

foreach (@files) {

my $file = $_;

chomp($file);

my $ext = ($file =~ m/([^.]+)$/)[0];

 

### Check if the file-name extension is a valid media file

if (grep {lc $_ eq lc $ext} @include_files) {

my $result = `synoindex -g \"$file\" -t video`;

chomp($result);

 

if ($result =~ m/^$SYNO_ERROR_MSG/i) {

$log->entry("Adding file to index: $file");

my @synorc = `synoindex -a \"$file\"`;

++$files_indexed;

}

}

}

 

if ($files_indexed) {

$log->entry("Synology Media Indexer added $files_indexed new media file(s)");

} else {

$log->entry("Synology Media Indexer did not find any new media");

}

 

# Close the log-file - remove/comment out if you disable logging

$log->close;

This script is not written by me. © 2010 by Gerd W. Naschenweng (Gerd@Naschenweng.info / http://www.naschenweng.info)

 

I have no error after running the script the problem is new media wont appear at all in videostation.

 

Thanks in advance for your help

Link to comment
Share on other sites

Ok so.... No one is having indexing issues with dsm5.0 even without the script indexing in videostation is not working. I need to reindex all files again for the new ones to appear. I can't believe i'm the only one having this problem...

Link to comment
Share on other sites

Ok. I tried manually adding the file with the synoindex command and it works like a charm. Now is there somebody good with perl that can verify the script and tell me why it's not working... It was working in dsm 4.3. What change between 4.3 and 5.0 that made the script not working?

Link to comment
Share on other sites

problem is here :

if (grep {lc $_ eq lc $ext} @include_files) {

my $result = `synoindex -g \"$file\" -t video`;

chomp($result);

 

when changing this command by this one:

if (grep {lc $_ eq lc $ext} @include_files) {

my $result = `synoindex -a \"$file\"`;

chomp($result);

 

It's indexing but not downloading metadata. What is the difference between the "-a" and "-g" option in the synoindex command ?

Link to comment
Share on other sites

×
×
  • Create New...