Page 1 of 1
Could I achieve this with xyplorer script
Posted: 06 Sep 2021 23:11
by karimmaster101
Hello, I have large group of movies folders. Each one have a txt file called meta.txt which contains data like this
Code: Select all
Actors: example1
Director: example2
ProductionYear: 1979
Resolution: 1080p
Quality: bluray
Genre: drama
Is there a way that I could search these files and extract these data -by line- and assign them to a custom column?!
It goes like this:
- select folder
- get meta.txt
- extract line 1 excluding any characters before ": "
- assign the returned data to a custom column named Actors
Then repeat the same process for another costume column.
I'm no expert here, so your guidance and advice will be much appreciated
Re: Could I achieve this with xyplorer script
Posted: 06 Sep 2021 23:23
by highend
Do it the other way round, define custom columns (Actors, Director, etc.) and write a script for each of them that gets the meta.txt file from each folder and only display the belonging lines content after the :
In other words: 95% of all scripts are the same, the only difference is the part which line to chose
Re: Could I achieve this with xyplorer script
Posted: 06 Sep 2021 23:33
by karimmaster101
This is smart and efficient way to do it. If I wouldn't bother you; could you help with the script itself
The general layout and commands I should use in every step. I will search and try to figure my way around
what commands should I use to get the meta.txt from every folder I select?
Re: Could I achieve this with xyplorer script
Posted: 06 Sep 2021 23:38
by highend
Look up the variables section in the help file to know which one to use in a custom column
and then you need these commands:
Code: Select all
exists()
readfile()
gettoken()
return
add two
if statements to make sure it only reads the content of meta.txt if the file really exists
and to proceed only if it contains the line to search for.
The only other hint to make it easier to get the correct line is:
$line = regexmatches($content, "^Director:.+?(?=\r?\n|$)");
The rest isn't rocket science and I have posted dozens of scripts that use these commands (as well in custom column scripts)
Re: Could I achieve this with xyplorer script
Posted: 07 Sep 2021 11:59
by karimmaster101
Wow, It seems like a rocket science for me. but I won't give up
Disclaimer: I'm totally newbie so what seems obvious and clear I don't see it at all
I skipped the "exists" command to make things easier for now.
Now I see that I want to get "meta.txt" inside of every folder -let's assume that it will be there-
I use this but for sure there is a syntax mistake
Code: Select all
$a = readfile (<cc_path>meta.txt);
return $a;
I skipped the regex pulling part for now. Just to make it simple, I created one line meta.txt to grab that line only
yet I've managed to fail
Till I finish this script, I think it will be the longest thread here

Re: Could I achieve this with xyplorer script
Posted: 07 Sep 2021 13:08
by highend
Why didn't you return <cc_path> in the first place? You would have seen that this is the wrong variable^^
And even if it would have been the correct one, does it have a trailing backslash? Nope^^
So how should something like <cc_path>meta.txt be a correct path? oO
Re: Could I achieve this with xyplorer script
Posted: 07 Sep 2021 15:08
by karimmaster101
Man, I'm not Bill Gates! This is my first time trying to type a code myself. I appreciate your time and effort, Just don't try to make me feel bad like this.
HEY guys. I'm an IDIOT who couldn't write a simple script. Is that satisfy you?
If you're trying to help, Thanks. If you're not, that is fine. Simple
Edit: Now it works as expected
Code: Select all
$pathmeta = "<cc_item>\meta.txt";
$a = readfile ($pathmeta);
return $a;
The next step will be extracting the data from multi line meta text file. Wish me luck
Re: Could I achieve this with xyplorer script
Posted: 07 Sep 2021 19:28
by admin
Good luck!
