Could I achieve this with xyplorer script

Discuss and share scripts and script files...
Post Reply
karimmaster101
Posts: 158
Joined: 20 May 2011 14:34

Could I achieve this with xyplorer script

Post 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

highend
Posts: 13308
Joined: 06 Feb 2011 00:33

Re: Could I achieve this with xyplorer script

Post 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
One of my scripts helped you out? Please donate via Paypal

karimmaster101
Posts: 158
Joined: 20 May 2011 14:34

Re: Could I achieve this with xyplorer script

Post 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?

highend
Posts: 13308
Joined: 06 Feb 2011 00:33

Re: Could I achieve this with xyplorer script

Post 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)
One of my scripts helped you out? Please donate via Paypal

karimmaster101
Posts: 158
Joined: 20 May 2011 14:34

Re: Could I achieve this with xyplorer script

Post by karimmaster101 »

Wow, It seems like a rocket science for me. but I won't give up :biggrin:
Disclaimer: I'm totally newbie so what seems obvious and clear I don't see it at all :biggrin:

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 :roll:
Till I finish this script, I think it will be the longest thread here :D

highend
Posts: 13308
Joined: 06 Feb 2011 00:33

Re: Could I achieve this with xyplorer script

Post 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
One of my scripts helped you out? Please donate via Paypal

karimmaster101
Posts: 158
Joined: 20 May 2011 14:34

Re: Could I achieve this with xyplorer script

Post 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

admin
Site Admin
Posts: 60528
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Could I achieve this with xyplorer script

Post by admin »

Good luck! :kidding:

Post Reply