themaCreator
http://creator.themasoftware.com/forum/

How to add prefix and suffix in genre, actor.
http://creator.themasoftware.com/forum/viewtopic.php?f=4&t=7302
Page 1 of 1

Author:  Crackpot [ August 4th, 2022, 5:49 pm ]
Post subject:  How to add prefix and suffix in genre, actor.

can we convert genre, actor name like this?

Code:
<a href=https://site.com/search.php=Action>Action</a>, <a href=https://site.com/search.php=Drama>Drama</a>

Author:  Freddy [ August 4th, 2022, 6:17 pm ]
Post subject:  Re: How to add prefix and suffix in genre, actor

You could do that with replacement:

Search for:
Code:
(Action|Drama|Horror|Comedy|Thriller|Fantasy|Mystery|Adventure|Crime|Western|Romance|Sci-Fi)


Replace with:
Code:
<a href=https://site.com/search.php=$1>$1</a>


Enable regex search.

I probably missed some genres, but you could just add them separated with "|" at the end.

Author:  Crackpot [ August 4th, 2022, 6:20 pm ]
Post subject:  Re: How to add prefix and suffix in genre, actor

is there any regex we can use for the following word to html one?

[GENRE]Action, Drama[/GENRE]

Author:  Freddy [ August 4th, 2022, 6:21 pm ]
Post subject:  Re: How to add prefix and suffix in genre, actor.

I would need "Before" and "After" example.

Author:  Crackpot [ August 4th, 2022, 6:28 pm ]
Post subject:  Re: How to add prefix and suffix in genre, actor.

Input:
[GENRE]Action, Drama[/GENRE]

Output:
<a href=https://site.com/search.php=Action>Action</a>, <a href=https://site.com/search.php=Drama>Drama</a>

Author:  Freddy [ August 4th, 2022, 6:37 pm ]
Post subject:  Re: How to add prefix and suffix in genre, actor.

It's a bit more complicated. Will try to write a bit later.

Author:  Crackpot [ August 5th, 2022, 8:16 am ]
Post subject:  Re: How to add prefix and suffix in genre, actor.

if we can replace the comma:

input
[GENRE]Action, Drama[/GENRE]

output
[GENRE]Action[/GENRE][GENRE]Drama[/GENRE]

and then replace [GENRE]=PREFIX and [/GENRE]=suffix

Author:  Freddy [ August 5th, 2022, 1:44 pm ]
Post subject:  Re: How to add prefix and suffix in genre, actor.

Both cases are really the same. The second way which you mentioned would need even more replacements.

Here is for first case, you would need to add few replacements to deal with each case depending on how many genres there are. Usually it's up to 4 I think.

So here are 4 replacements for each case (they all must be added in this order - replacement for most genres first [or use arrow keys to move to the top] - otherwise it won't work correctly).


Search for:
Code:
(?i)\[GENRE\](.+?), (.+?), (.+?), (.+?)\[/GENRE\]


Replace with:
Code:
<a href=https://site.com/search.php=$1>$1</a>, <a href=https://site.com/search.php=$2>$2</a>, <a href=https://site.com/search.php=$3>$3</a>, <a href=https://site.com/search.php=$4>$4</a>


Enable regex search.

Search for:
Code:
(?i)\[GENRE\](.+?), (.+?), (.+?)\[/GENRE\]


Replace with:
Code:
<a href=https://site.com/search.php=$1>$1</a>, <a href=https://site.com/search.php=$2>$2</a>, <a href=https://site.com/search.php=$3>$3</a>


Enable regex search.

Search for:
Code:
(?i)\[GENRE\](.+?), (.+?)\[/GENRE\]


Replace with:
Code:
<a href=https://site.com/search.php=$1>$1</a>, <a href=https://site.com/search.php=$2>$2</a>


Enable regex search.


Search for:
Code:
(?i)\[GENRE\](.+?)\[/GENRE\]


Replace with:
Code:
<a href=https://site.com/search.php=$1>$1</a>


Enable regex search.

Author:  Crackpot [ August 5th, 2022, 2:23 pm ]
Post subject:  Re: How to add prefix and suffix in genre, actor.

viewtopic.php?p=24394#p24394
this one is better, if possible to do it using only one single regex for any number for word.

the solution you gave, that's work too. i added 1 to 10 word replacement :D

thank you!

Author:  Freddy [ August 7th, 2022, 12:21 pm ]
Post subject:  Re: How to add prefix and suffix in genre, actor.

You can actually do that with genres separator option.

Add this in "Main" template where needed:
Code:
[GENRE]{#imdbGenres#}[/GENRE]


Then in "TEMPLATES" -> "Video" -> "Settings" -> "IMDB / TMDB" -> "Genres separator" set to:
Code:
[/GENRE], [GENRE]


And add this replacement:

Search for:
Code:
(?i)\[GENRE\](.+?)\[/GENRE\]


Replace with:
Code:
<a href=https://site.com/search.php=$1>$1</a>


Enable regex search.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/