Similarity Forum

General Category => General => Topic started by: icqtoni on August 21, 2019, 14:43:26

Title: Search Filename as String of results.analysis.files [0]
Post by: icqtoni on August 21, 2019, 14:43:26
Hi, I'm new here.
I know something about javascript ... but here i just can not get any further. I would like to export the quality analysis of my collection. Here I fail at this point:

var files = results.analysis.files;
for (var idx = 0; idx < files.length; ++idx) {

   //var filename = "D:\\path\\file.mp3";
   var filename = files[idx]; // Filename as String ???

   var tmp = filename.lastIndexOf("\\");

If I manually set a string this will work.
Now it fails at lastIndexOf.

I hope I can still be helped.

Thanks in advance
icqtoni
Title: Re: Search Filename as String of results.analysis.files [0]
Post by: Admin on September 11, 2019, 20:00:15
Sorry for the delay.
your filename is not a string, it's special object, just get path property and it is a string.

Code: [Select]
var files = results.analysis.files;
for (var idx = 0; idx < files.length; ++idx) {

   //var filename = "D:\\path\\file.mp3";
   var filename = files[idx].path; // Filename as String ???
   var or_get_filename = files[idx].filename; // Filename as String ???

   var tmp = filename.lastIndexOf("\\");

   log(filename + ': ' + tmp);
}
Title: Re: Search Filename as String of results.analysis.files [0]
Post by: icqtoni on September 18, 2019, 17:53:53
Hello Admin,

i had meanwhile recognized my mistake myself, nevertheless many thanks for your reference.
Great program that allows a real comparison of the files.

Best regards
icqtoni