It is currently April 16th, 2024, 9:43 am



Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: How to add prefix and suffix in genre, actor.
PostPosted: August 4th, 2022, 5:49 pm 

Joined: March 30th, 2015, 12:31 pm
Posts: 670
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>


Top
 Profile  
Reply with quote  
 Post subject: Re: How to add prefix and suffix in genre, actor
PostPosted: August 4th, 2022, 6:17 pm 
Site Admin
User avatar

Joined: March 10th, 2011, 11:14 pm
Posts: 12639
Location: Earth
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.

_________________
themaPoster | themaCreator | themaManager | themaLeecher | themaRegister


Top
 Profile  
Reply with quote  
 Post subject: Re: How to add prefix and suffix in genre, actor
PostPosted: August 4th, 2022, 6:20 pm 

Joined: March 30th, 2015, 12:31 pm
Posts: 670
is there any regex we can use for the following word to html one?

[GENRE]Action, Drama[/GENRE]


Top
 Profile  
Reply with quote  
 Post subject: Re: How to add prefix and suffix in genre, actor.
PostPosted: August 4th, 2022, 6:21 pm 
Site Admin
User avatar

Joined: March 10th, 2011, 11:14 pm
Posts: 12639
Location: Earth
I would need "Before" and "After" example.

_________________
themaPoster | themaCreator | themaManager | themaLeecher | themaRegister


Top
 Profile  
Reply with quote  
 Post subject: Re: How to add prefix and suffix in genre, actor.
PostPosted: August 4th, 2022, 6:28 pm 

Joined: March 30th, 2015, 12:31 pm
Posts: 670
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>


Top
 Profile  
Reply with quote  
 Post subject: Re: How to add prefix and suffix in genre, actor.
PostPosted: August 4th, 2022, 6:37 pm 
Site Admin
User avatar

Joined: March 10th, 2011, 11:14 pm
Posts: 12639
Location: Earth
It's a bit more complicated. Will try to write a bit later.

_________________
themaPoster | themaCreator | themaManager | themaLeecher | themaRegister


Top
 Profile  
Reply with quote  
 Post subject: Re: How to add prefix and suffix in genre, actor.
PostPosted: August 5th, 2022, 8:16 am 

Joined: March 30th, 2015, 12:31 pm
Posts: 670
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


Top
 Profile  
Reply with quote  
 Post subject: Re: How to add prefix and suffix in genre, actor.
PostPosted: August 5th, 2022, 1:44 pm 
Site Admin
User avatar

Joined: March 10th, 2011, 11:14 pm
Posts: 12639
Location: Earth
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.

_________________
themaPoster | themaCreator | themaManager | themaLeecher | themaRegister


Top
 Profile  
Reply with quote  
 Post subject: Re: How to add prefix and suffix in genre, actor.
PostPosted: August 5th, 2022, 2:23 pm 

Joined: March 30th, 2015, 12:31 pm
Posts: 670
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!


Top
 Profile  
Reply with quote  
 Post subject: Re: How to add prefix and suffix in genre, actor.
PostPosted: August 7th, 2022, 12:21 pm 
Site Admin
User avatar

Joined: March 10th, 2011, 11:14 pm
Posts: 12639
Location: Earth
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.

_________________
themaPoster | themaCreator | themaManager | themaLeecher | themaRegister


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Theme designed by stylerbb.net © 2008
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All times are UTC