Append labels (as words) and tags to file names (selected)

Discuss and share scripts and script files...
highend
Posts: 8147
Joined: 06 Feb 2011 00:33

Re: Append labels (as words) and tags to file names (selected)

Post by highend » 07 Dec 2018 11:51

Em, you've read label + tags. Use them!

Your version would make this:

Code: Select all

[Fancam] 100522 Sunny SNSD - Intro+Run Devil Run.mp4
out of this:

Code: Select all

[Fancam] 100522 Sunny SNSD - Intro+Run Devil Run [ENG SUB] [Blue; distorted heavily].mp4
Deleting [ENG SUB]...

And you don't need to get the extension, renameitem() takes care of this automatically
One of my scripts helped you out? Please donate via Paypal or highend (at) web (dot) de

AugerJ
Posts: 34
Joined: 19 Jul 2016 06:27

Re: Append labels (as words) and tags to file names (selected)

Post by AugerJ » 07 Dec 2018 12:54

After the script has read the label and the tags,
it needs to rewrite the next part of the file name:
" [From Label; From Tags]"
and then delete that part, right?

Or a script could use the file name alone,
locate that part and delete it,
which seems simpler.

Either way, at some point the script should

Code: Select all

Delete [<label name>;<tag>]
or something like that.
I'm not familiar with the "script" language so I can only guess how it should look
after the script finds the part in question:

Code: Select all

    end (compare(<xyver>, "18.00.0021", "v") == -1), "You need at least v18.00.0021 of XYplorer, aborted!";

    $labels = regexmatches(readfile("<xydata>\tag.dat", , 2000), "^((.+?)\|([A-F0-9]{6})?\|([A-F0-9]{6})){7,}$");
    $labels = trim(regexreplace($labels, "\|([A-F0-9]{6})?\|[A-F0-9]{6};?", "|"), "|");

    foreach($file, <get "SelectedItemsPathNames" <crlf>>, <crlf>, "e") {
        // Ignore folders
        if (exists($file) == 2) { continue; }

        // Find [<label name>;<tag>]

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

Re: Append labels (as words) and tags to file names (selected)

Post by highend » 07 Dec 2018 13:01

Don't know what you're doing there...

Code: Select all

    end (compare(<xyver>, "18.00.0021", "v") == -1), "You need at least v18.00.0021 of XYplorer, aborted!";

    foreach($file, <get "SelectedItemsPathNames" <crlf>>, <crlf>, "e") {
        if (exists($file) == 2) { continue; }

        $label = tagitems("label", , $file, 2);
        $tags  = tagitems("tags", , $file);

        if (!$label && !$tags) { continue; }
        $newName = replace(gpc($file, "base"), " [$label; $tags]");
        renameitem($newName, $file);
    }
One of my scripts helped you out? Please donate via Paypal or highend (at) web (dot) de

AugerJ
Posts: 34
Joined: 19 Jul 2016 06:27

Re: Append labels (as words) and tags to file names (selected)

Post by AugerJ » 07 Dec 2018 13:13

Thanks.

Post Reply