#1 2009-08-01 10:59

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

New Swap or Rearrange rule

I've been thinking of converting one of the common usage of RegEx into a dedicated rule: Swap Rule - which is to swap parts of the filename using some sorts of delimiters. Below is the first draft of configuration window, which should demonstrate how it would work:

renamerswaprule.gif

What do you guys think?

Please feel free to make suggestions, or, even better, design your own Swap rule, with explanation of how it is going to work and possibly a sketch of the proposed configuration window.

Offline

#2 2009-08-01 14:29

SafetyCar
Senior Member
Registered: 2008-04-28
Posts: 446
Website

Re: New Swap or Rearrange rule

Anyway, this can be done by using RegEx, which for me is more reliable, so I'm not very convinced, but...
What about... "delimiters as parts"? for example:

Delimiters: - ;(;)
so, with this, the filename would be divided into:

  1. text1

  2. -

  3. text2

  4. (

  5. text3

  6. )

  7. text4

New Order:1,5,2,3 (note that 4, 6 and 7 are missing)

Applied to this FileName:
Before:
Asdf - Qwerty (ft. Zxcv){by www_com}

After:
Asdf ft. Zxcv - Qwerty

Last edited by SafetyCar (2009-08-01 14:32)


If this software has helped you, consider getting your pro version. :)

Offline

#3 2009-08-01 16:22

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

Re: New Swap or Rearrange rule

Yes, of course this can be done using RegEx! wink

In fact, RegEx will be much more flexible! But the problem is that many people don't know how to use regular expressions, that's why I was thinking of creating a very convenient rule which could help them. As you have probably noticed, it is a very common question on the forum: How to use RegEx to swap/move parts of the filename?

There were several suggestions in the past regarding such a rule...

It needs more opinions, 3rd party views...

Offline

#4 2009-08-02 11:40

prologician
Member
Registered: 2009-01-30
Posts: 84

Re: New Swap or Rearrange rule

It seems like this has potential. smile I don't quite follow the "Hint" in the posted picture, and the last sentence seems a bit strange, but I'll write that off as "early beta version" for now. wink

I'm not entirely seeing how you would use the "keep delimiters" option, though.... does it have the delimiters as their own group order, or are they attached to another part of the name? hmm

One tidbit to note, though: a semicolon is a valid character in a filename. How do we say that a semicolon is a delimiter (this is a rare situation, but it's worth considering)? It seems that, to avoid this kind of headache, the character that separates delimiters should be something not allowed within filenames (I'm personally thinking of the forward slash '/', because it neatly separates things already, and it's not that confusable with the backslash '\' which you could have in a full file path).

Offline

#5 2009-08-02 13:41

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

Re: New Swap or Rearrange rule

Good idea. I like this helper.

Some brainstormings:

- there should be an preview of on of the old names to show how the used delimiter works
(showing what parts i would get).



- can we add new text into the new-order-box? Like "2 - 3 (from 1).4"
So i mean drop the comas in the new-order-box and use numbers only.



- and what if someone wants to add numbers?  Escape them \1 ?
(the other way around would be  more consistent, more cryptic for novices, but consistent with regex. 
So the new-order-box should use \2 - \1.\3  as syntax and so allowing to add numbers as it)



- if we would use an dot as delimiter, will there be an option to skip ext? Or do we have to use an other rule before?
F.ex.:  MuT.Windows.Admin.2003.pdf



- FYI, an problem are always the spaces left and right of the delimiter.
I would suggest to auto trim the extracted parts (left and right, but not inside)

F.ex.:
Artist Name - Song title - Album - (Year 2009).mp2

Delimiter "-"

We would get:
"Artist Name"
"Song title"
"Album"
"(Year 2009).mp2"
and can arrange them as we want, with spaces again or without then.

OK, i can think to use " - " as delimiter, but i think you want to make it easy for those users.... OK just brainstorming.


But what is with this example:
Bob Q. Smith.pdf to
Smith Bob Q.pdf

Here we need space as delimiter?  And have to drop an extra dot to not get "Smith Bob Q..pdf"

.

Last edited by Stefan (2009-08-02 13:57)


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

#6 2009-08-02 13:43

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

Re: New Swap or Rearrange rule

The "keep delimiters" is a bit ambiguous, because the delimiters then-selves would not belong to groups. Groups/parts in SafetyCar's example were incorrectly indexed. For the simplicity sake (taking into account novice users), I thought it would be better to have only parts separated by delimiters be indexable.

It will start get confusing when we use more than 1 type of a delimiter. That's what the note at the bottom of the rule is trying to explain. This is just a first draft, so any of it can change.

Here are examples:

Input: text1, text2
Delimiters: ,
New order: 2, 1
Output: text2, text1

Input: text1, text2 - text3
Delimiters: ,;-
New order: 2, 1, 3
Output: text2, text1, text3

The problem can be eliminated assigning a group to every delimiter.

So far, there are 3 suggestions:
* use "/" as a separator for multiple delimiters;
* assign groups to delimiters;
* don't bother and make them all learn RegEx! tongue

+ more ideas posted by Stefan a minute ago!

Offline

#7 2009-08-02 14:56

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

Re: New Swap or Rearrange rule

I like ALL the suggestions made by stefan and prologician.

Further, let us think of the rule as having two separate parts: The first part chops the original name and creates "tokens", which are re-assembled in the second part.

This is a just like how we use the RegEx backreferences.

So, instead of just a swapped token, why not let the user create his own name template, using the following:
1. Tokens (just like backreferences)
2. Additional literal characters (including comma, semicolon, brackets, etc.)
3. Meta tags
4. Additional tokens (e.g. $001 adds a three-digit padded running number, starting with 001; but if I put $15, ReNamer adds a two-digit number staring with 15).

I would strongly suggest a LIVE preview of the NEW names within the rule window (may be placed at the bottom of the dialog).

BTW in case of spaces as delimiters, repeated spaces should be ignored (this may be a checkbox).

The name of the rule can be "freeform" or something (it is much more than swap)

Last edited by narayan (2009-08-02 19:01)

Offline

#8 2009-08-03 08:20

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

Re: New Swap or Rearrange rule

The rule might be helpful.
Stefan, pointed out some very fine things: skipping extention, trimming spaces (I would add trimming dots as well), escaping token numbers \1-\2...
Changing delimiters delimiter from ; to / or : is a good idea too.

I would quit the idea of "keep delimiters" and let user insert them (and any other text) in new order:
"Artist - Title (Year).mp3"   ->   "Year - Title (Artist) 192kbps.mp3"

delimiters:  " - / (/)"           or    " - : (:)"
new order: "\3 - \2 (\1) 192kbps" with skip extention        or   "\3 - \2 (\1) 192kbps\4"   without skip extention

I'm just not sure if it would be simple enough...
The preview for one filename, eg. the first one in the files table would be very useful (something like in mp3tag):
Filename: "Artist - Title (Year).mp3"
\1  Artist
\2  Title
\3  Year
\4  .mp3
New filename:   "Year - Title (Artist) 192kbps.mp3"


Maybe we could go a bit further and allow to insert metatags to the new order string as well, eg.
New order:  ":ID3_TrackNo:. \3 - \2 (\1) 192kbps\4"

But the main question is to make it simple and as much straightforward as we can for those who are not familiar with regex's and programming...

Last edited by krtek (2009-08-03 08:21)


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

#9 2009-08-03 15:09

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

Re: New Swap or Rearrange rule

i think it's something like this we had in mind?

ReNamerSwapRule02.png



-
- with delimiters i forgot an slash (and an '-' , thanks narayan) = > " /(/)/./-"
-
- i didn't want to drop "Using Positions" big_smile   i had just no idea for this part.

Last edited by Stefan (2009-08-03 15:55)


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

#10 2009-08-03 15:13

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

Re: New Swap or Rearrange rule

I think krtek's proposal is almost identical to mine, except some details.

The "keep delimiters" option is not compatible with my proposal also. (The user would have to add the separators and additional tokens)

I think there is no need to separate the delimiters at all. Just list them all!

If the rule is going to show the tokens created out of the original name, can you show them in different colors, to distinguish them?

Otherwise it would be sufficient to show just the new name for one or more of the actual files (as sample).

Offline

Board footer

Powered by FluxBB