#61 2009-08-23 04:59

narayan
Senior Member
Registered: 2009-02-08
Posts: 470

Re: New Swap or Rearrange rule

I demonstrated in the other post how using the <n  tags makes things much simpler.
http://www.den4b.com/forum/viewtopic.php?pid=3614#p3614

That solution does not require to replace the "\" at all.

Rather than having the :File_Filepath: token's algorithm do the replacement, why not make it assign the pieces to the <n tokens directly? Then we will have direct access to the path segments. At the same time, we can also use the entire path (without the file name) with the <0 token.

Even if the algorithm replaces the "\" with something else, the user has to use THAT new character as delimiter and split the path further, and then pick the desired segment.

Secondly, the base name needs splitting based on a different criteria than the path extracted by the :File_filepath: meta tag. Achieving both in one stroke becomes very complex. Also, the :File_filepath: meta tag should not replace "\" with any character that can naturally occur in the base name. It has to use an "illegal" character, so that it does not interfere with the other operations. And that means you have to again convert those illegal characters back to "\" at the end of the operation.

All this makes the whole operation incredibly complex, even for a seasoned user.

Using the <n tokens is much easier and intuitive for all users; especially the newbies.

Offline

#62 2009-08-23 11:50

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,376

Re: New Swap or Rearrange rule

New features in Rearrange rule:
* $-1..$-N and $0 parts
* Exact order of delimiters

I believe these are really important for both flexibility and stability (vulnerability noted by krtek) of the rule.

At this point I think this rule should be finalized and tested extensively.

P.S. I will not be adding "<n", at least not for the next release.

Offline

#63 2009-08-23 14:24

krtek
Senior Member
From: Łódź (Poland)
Registered: 2008-02-21
Posts: 262

Re: New Swap or Rearrange rule

New features in Rearrange rule:
* $-1..$-N and $0 parts
* Exact order of delimiters

Great! Thank you very much.

I wonder why the right-to-left order is now available only for positions.
It might be also useful to have that option enabled with delimiters as it was in the first version.

The $-1..$-N allows to refer to parts from right to left, but they do not allow to order delimiters from right to left (probably it makes sense only with exact order of delimiters).
I'm thinking about:
Author - Title - Year.pdf
Delimiter: " - "    right-to-left, exact order
New order: "$1 $2"
to get: "Year Author - Title.pdf"

Nothing very important, just to keep the logic of the rule.

BTW, first tests shows that it works fine.


Regular Expressions are not as hard to understand as you may think. Check ReNamer's manual or nice Regular Expressions tutorial for more info and start to use full power of applications that use them (like ReNamer, Mp3Tag and so on).

Offline

#64 2009-08-23 16:00

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,376

Re: New Swap or Rearrange rule

I've restored the original behavior. Now "right-to-left" option is affective in both modes: delimiters and positions.

Had some trouble positioning the checkboxes, alignment issues. Moved them around for like 30 minutes and ended up with the one that looked better than others but still not perfect because checkboxes are too far away from the first field to which they relate the most...

Offline

#65 2009-08-23 16:29

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,161

Re: New Swap or Rearrange rule

Can i have some examples of how "Exact order of delimiters" is supposed to work?
When would one use this?
Example result with / without EOOD please.

Last edited by Stefan (2009-08-23 16:30)


Read the  *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)

Offline

#66 2009-08-23 16:47

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,376

Re: New Swap or Rearrange rule

This option is meant to work like the option that Narayan have suggested:
"Use only the first instance of delimiter"

The necessity for such option is well highlighted by krtek's post:
http://www.den4b.com/forum/viewtopic.php?pid=3555#p3555

When this option is NOT SELECTED, the rule will search for the closest delimiter out of ALL delimiters, then split, then again search for the closest delimiter out of ALL delimiters, then split, and so on.

When this option is SELECTED, the rule will search for the FIRST delimiter, then split, then search for the SECOND delimiter, then split, and so on.

There is only one thing that keeps bothering me regarding this option: What to do if option is SELECTED and some intermediate delimiter is NOT found? (a) Continue with the next delimiter or (b) finish splitting because the order of delimiters is broken?

To highlight the problem, imagine input "abc , def - ghi" and split by ",|+|-"
(a): $1=abc $2=def $3=ghi  ("+" was skipped because not found)
(b): $1=abc $2=def - ghi  (search terminated because "+" was not found)

Offline

#67 2009-08-23 17:23

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,161

Re: New Swap or Rearrange rule

if eood IS selected the order of delimiter as inserted in "split using" is taken into account.
The string is splitted at the first delimiter found in the delimiter array first,
is the second delimiter of that array is not found at an position in the string behind the first delimiter was found, nothing is splitted any further.

Delimiter: " _ | - "
New Order: $3 $2 $1
From: Test - Number _ One.txt
To:     One Test - Number.txt

Explanation:
First delimiter _ is found in From string.
Then second delimiter - is not found after _ in From string, so - is not used as delimiter and so there is no second split.

- - -

if eood is NOT selected any delimiter of the array pool is taken, no matter of the exact order.

Delimiter: " _ | - "
New Order: $3 $2 $1
From: Test - Number _ One.txt
To:     One Number Test.txt

Explanation:
Second delimiter - is found first, then first delimiter is found next. No matter. String is splitted on both delimiters.
Delimiter  " _ | - "   OR  " - | _ "  brings the same result


Thanks for explanation Denis.

--------------------

> What to do if option is SELECTED and some intermediate delimiter is NOT found?
I think (a) skipped would be nice but brings unexpected results
whereas using (b) break with marking the files as unsolved gives the ability to rerun on this files.
roll

EDIT:
As usual, both options has there advantages, depending on the task.
    [X] Exact order of delimiters [X]Force (Break if next delimiter is not found)

Last edited by Stefan (2009-08-23 17:41)


Read the  *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)

Offline

#68 2009-08-23 17:31

krtek
Senior Member
From: Łódź (Poland)
Registered: 2008-02-21
Posts: 262

Re: New Swap or Rearrange rule

den4b wrote:

There is only one thing that keeps bothering me regarding this option: What to do if option is SELECTED and some intermediate delimiter is NOT found? (a) Continue with the next delimiter or (b) finish splitting because the order of delimiters is broken?

I strongly suggest (c) - no change on output, as the regex that didn't match. Leaving the filename as it was.
It is meant to be EXACT order of delimiters.
Maybe, it could be changable to (a) with the FORCE tick box as Stefan suggested.

The best would be to allow the exact order of the or-choice of delimiters, but I guess that's too much.
It would be like: ",|+ OR -" to get $1=abc, $2=def and $3=ghi out from abc, def - ghi and abc, def + ghi.

It would require a new sign for the OR (and the best is already in use - "|"), so maybe it's better to leave it as it is. Just not to change the filename if pattern wasn't found.

Last edited by krtek (2009-08-23 18:27)


Regular Expressions are not as hard to understand as you may think. Check ReNamer's manual or nice Regular Expressions tutorial for more info and start to use full power of applications that use them (like ReNamer, Mp3Tag and so on).

Offline

#69 2009-08-30 00:34

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,161

Re: New Swap or Rearrange rule

After playing around a bit with the examples at http://www.den4b.com/wiki/ReNamer:Rules:Rearrange
i see now the use of an option like "[ ] Delimiters to token" would be useful sometimes.

From:
08. Madonna - Like A Prayer.wma
To:
Madonna - Like A Prayer.wma

Delimiter: "Madonna" (without the quotes)
[X] Delimiters to token
$1=08.
$2=Madonna
$3= - Like A Prayer.wma
New Order: $2$3

-------------------------------

Reuse delimiters

From:
family_-_01.jpg
To:
family_-_vacation_-_2009_-_01.jpg

Delimiter: "_-_" (without the quotes)
[X] Delimiters to token
$1=family
$2=_-_
$3=01.jpg
New Order: $1$2vacation$22009$2$3

-------------------------------


From:
Report 1.8.2009 [sent at 01.08.2009].doc
Report 25.08.2009 [sent at 25.08.2009].doc
To:
Report 1.8.2009 [sent at 25.08.2009].doc
Report 25.08.2009 [sent at 25.08.2009].doc


Delimiter: " [sent at |]" (without the quotes)
[X] Delimiters to token
$1=Report 1.8.2009
$2= [sent at
$3=01.08.2009
$4=]
New Order: $1$225.08.2009$4
.


Read the  *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)

Offline

#70 2009-08-30 08:54

krtek
Senior Member
From: Łódź (Poland)
Registered: 2008-02-21
Posts: 262

Re: New Swap or Rearrange rule

I can't see when it really would be useful. For me it's neither of your examples.
It would have to use at least two delimiters (with "exact order" OFF), and it would make some more conditions to make such an option useful. Or it would have to use masked delimiters, but we don't have that, and we won't have that, and probably thanks God.

To the point. In all your examples you know what is the delimiter. So you can just type it. It will be easier and the New Order string will become more readible, like this:

Madonna$3
$1_-_vacation_-_2009_-_$3
$1[sent at 25.08.2009]


Regular Expressions are not as hard to understand as you may think. Check ReNamer's manual or nice Regular Expressions tutorial for more info and start to use full power of applications that use them (like ReNamer, Mp3Tag and so on).

Offline

Board footer

Powered by FluxBB