Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 12-31-2022, 07:16 AM   #16
ackomb
Zealot
ackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura about
 
Posts: 106
Karma: 4486
Join Date: Mar 2020
Location: Netherlands
Device: i-pad
Hey @chaley I have another question for you.

I follow multiple shows where one of the main characters will have the same of a similar name that is shortened to the same tag on AO3. For example "Lex" being used as a short for Alexandra, Alex, Alexander, Lexa etc. combine this that some shows are crossing over into others it makes for a mess with the tags, so I want to clean this up by building in another if statement that the show needs to contain both show A and Show B. So far I got as far as this:

Code:
program:
output = '';

	for item in $#pair:
		if $#show == "show A, Show B" then
			if item ==  "ABC/XYZ" then ni = "AAA / BBB"
			elif item ==  "DEF/UVW" then ni = "CCC / DDD"
		else ni = item
		fi;
		output = output & ',' & ni
	rof;
	output = list_sort(list_remove_duplicates(output, ','), 0, ',')
But the I get the following Error message:
EXCEPTION: Formatter: if statement: expected 'fi', found 'rof' near Unknown on line 13

So I understand there needs to be another 'fi' as to end the if statement, but I've tried adding it in number of places but it just does not change the fact I keep getting errors. I was hoping you could give me a hint in the right direction.
ackomb is offline   Reply With Quote
Old 12-31-2022, 07:45 AM   #17
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ackomb View Post
Hey @chaley I have another question for you.

I follow multiple shows where one of the main characters will have the same of a similar name that is shortened to the same tag on AO3. For example "Lex" being used as a short for Alexandra, Alex, Alexander, Lexa etc. combine this that some shows are crossing over into others it makes for a mess with the tags, so I want to clean this up by building in another if statement that the show needs to contain both show A and Show B. So far I got as far as this:

Code:
program:
output = '';

	for item in $#pair:
		if $#show == "show A, Show B" then
			if item ==  "ABC/XYZ" then ni = "AAA / BBB"
			elif item ==  "DEF/UVW" then ni = "CCC / DDD"
		else ni = item
		fi;
		output = output & ',' & ni
	rof;
	output = list_sort(list_remove_duplicates(output, ','), 0, ',')
But the I get the following Error message:
EXCEPTION: Formatter: if statement: expected 'fi', found 'rof' near Unknown on line 13

So I understand there needs to be another 'fi' as to end the if statement, but I've tried adding it in number of places but it just does not change the fact I keep getting errors. I was hoping you could give me a hint in the right direction.
Assuming your indenting is correct then the missing 'fi' is needed to close the if/elif that begins on line 6.
Code:
program:
output = '';

	for item in $#pair:
		if $#show == "show A, Show B" then
			if item ==  "ABC/XYZ" then ni = "AAA / BBB"
			elif item ==  "DEF/UVW" then ni = "CCC / DDD"
			fi
		else ni = item
		fi;
		output = output & ',' & ni
	rof;
	output = list_sort(list_remove_duplicates(output, ','), 0, ',')
chaley is offline   Reply With Quote
Advert
Old 12-31-2022, 08:53 AM   #18
ackomb
Zealot
ackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura about
 
Posts: 106
Karma: 4486
Join Date: Mar 2020
Location: Netherlands
Device: i-pad
Quote:
Originally Posted by chaley View Post
Assuming your indenting is correct then the missing 'fi' is needed to close the if/elif that begins on line 6.
Getting there it was actualy still missing a "else ni" statement for it to work.
Code:
program:
output = '';

	for item in $#pair:
		if $#show == "show A, Show B" then
			if item ==  "ABC/XYZ" then ni = "AAA / BBB"
			elif item ==  "DEF/UVW" then ni = "CCC / DDD"
			else ni = item
			fi
		else ni = item
		fi;
		output = output & ',' & ni
	rof;
	output = list_sort(list_remove_duplicates(output, ','), 0, ',')
But it only works now if it only contains show A and show B in that specific order. But as soon as there is a Show C, which is not interfering with the pairing it does not work anymore.

That means the first if statment should be something like:
Code:
if $#show contains item "show A" and "Show B" then
Of course this does not work but how would, so I tried:
Code:
if $#show != "Show A" && "Show B" then
This seems to work. Just thought I would post it for others researching something similar.

Last edited by ackomb; 12-31-2022 at 08:54 AM. Reason: small error in the code
ackomb is offline   Reply With Quote
Old 12-31-2022, 09:22 AM   #19
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ackomb View Post
[...]

But it only works now if it only contains show A and show B in that specific order. But as soon as there is a Show C, which is not interfering with the pairing it does not work anymore.

That means the first if statment should be something like:
Code:
if $#show contains item "show A" and "Show B" then
Of course this does not work but how would, so I tried:
Code:
if $#show != "Show A" && "Show B" then
This seems to work. Just thought I would post it for others researching something similar.
The "seems to work" statement doesn't do what I think you want. It first asks if $#show isn't equal to the single item "Show A", which in the case of the list 'Show A, Show B' is True. It then 'ands' that True with the value 'Show B', which is always True. As such the expression will return True even if $#show contains 'foobar'.

Are you looking for code that tells you if both "Show A" and "Show B" are in the list, perhaps along with other values such as "Show C"? If so and if you can guarantee that there are no duplicates in the list then this works.
Code:
program:
	show = list_count_matching($#show, '^(Show A|Show B)$', ',') == 2
	output = '';

	for item in $#pair:
		if show then
			if item ==  "ABC/XYZ" then ni = "AAA / BBB"
			elif item ==  "DEF/UVW" then ni = "CCC / DDD"
			else ni = item
			fi
		else ni = item
		fi;
		output = output & ',' & ni
	rof;
	output = list_sort(list_remove_duplicates(output, ','), 0, ',')
This version is more robust in the face of duplicates but is a bit slower.
Code:
program:
	show = list_count(list_intersection($#show, 'Show A, Show B', ','), ',') == 2
[code as above]
chaley is offline   Reply With Quote
Old 12-31-2022, 09:46 AM   #20
ackomb
Zealot
ackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura about
 
Posts: 106
Karma: 4486
Join Date: Mar 2020
Location: Netherlands
Device: i-pad
Quote:
Originally Posted by chaley View Post
The "seems to work" statement doesn't do what I think you want. It first asks if $#show isn't equal to the single item "Show A", which in the case of the list 'Show A, Show B' is True. It then 'ands' that True with the value 'Show B', which is always True. As such the expression will return True even if $#show contains 'foobar'.

Are you looking for code that tells you if both "Show A" and "Show B" are in the list, perhaps along with other values such as "Show C"? If so and if you can guarantee that there are no duplicates in the list then this works.
Yeah, thank you. I just found out that it did not work the way I wanted, came back to this thread and there you are with the answer already :-).

I am very grateful for people like you.

I will try this, thanks again.
ackomb is offline   Reply With Quote
Advert
Old 12-31-2022, 09:57 AM   #21
ackomb
Zealot
ackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura about
 
Posts: 106
Karma: 4486
Join Date: Mar 2020
Location: Netherlands
Device: i-pad
Quote:
Originally Posted by chaley View Post
Are you looking for code that tells you if both "Show A" and "Show B" are in the list, perhaps along with other values such as "Show C"? If so and if you can guarantee that there are no duplicates in the list then this works.
Code:
program:
	show = list_count_matching($#show, '^(Show A|Show B)$', ',') == 2
	output = '';

	for item in $#pair:
		if show then
			if item ==  "ABC/XYZ" then ni = "AAA / BBB"
			elif item ==  "DEF/UVW" then ni = "CCC / DDD"
			else ni = item
			fi
		else ni = item
		fi;
		output = output & ',' & ni
	rof;
	output = list_sort(list_remove_duplicates(output, ','), 0, ',')
This version is more robust in the face of duplicates but is a bit slower.
Code:
program:
	show = list_count(list_intersection($#show, 'Show A, Show B', ','), ',') == 2
[code as above]

Trying either of these 2 options actually gives me the following error:
EXCEPTION: Formatter: Expected end of program, found 'output' near Unknown on line 3
ackomb is offline   Reply With Quote
Old 12-31-2022, 10:00 AM   #22
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ackomb View Post
Trying either of these 2 options actually gives me the following error:
EXCEPTION: Formatter: Expected end of program, found 'output' near Unknown on line 3
My fault. There must be a semicolon at the end of the second line "show = ... ;".

This happened because I can't test the completed templates because I don't have the right variables with the right values.
chaley is offline   Reply With Quote
Old 12-31-2022, 10:11 AM   #23
ackomb
Zealot
ackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura about
 
Posts: 106
Karma: 4486
Join Date: Mar 2020
Location: Netherlands
Device: i-pad
Quote:
Originally Posted by chaley View Post
My fault. There must be a semicolon at the end of the second line "show = ... ;".

This happened because I can't test the completed templates because I don't have the right variables with the right values.
No worries happy with the help. I should have actually seen that, even if I'm still a amateur at all of this code business.
ackomb is offline   Reply With Quote
Old 01-01-2023, 11:35 AM   #24
ackomb
Zealot
ackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura about
 
Posts: 106
Karma: 4486
Join Date: Mar 2020
Location: Netherlands
Device: i-pad
Quote:
Originally Posted by chaley View Post
...
Is there a way to continue to the next item on the tag list when the first statement is true without actually adding a separate action to the action chain?

I have a number of books that have a large number of crossovers and pairings that I want to change in one action rather then setting up multiple actions for each pairing only slowing things down.

I know 'NEXT' won't work but it is to who what I'd like to do.

Code:
program:
	show1 = list_count_matching($#show, '^(Show A|Show B)$', ',') == 2;
	show2 = list_count_matching($#show, '^(Show A|Show B)$', ',') == 2;
	
	output = '';

	for item in $#pair:
		if show1 then
			if item ==  "ABC/XYZ" then ni = "AAA / BBB"
			else ni = item
			fi
		else ni = item
		fi;
NEXT
		if show2 then
			if item ==  "KLM/NOP" then ni = "EEE/ FFF"
			else ni = item
			fi
		else ni = item
		fi;

		output = output & ',' & ni
	rof;
	output = list_sort(list_remove_duplicates(output, ','), 0, ',')
ackomb is offline   Reply With Quote
Old 01-01-2023, 12:24 PM   #25
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ackomb View Post
Is there a way to continue to the next item on the tag list when the first statement is true without actually adding a separate action to the action chain?

I have a number of books that have a large number of crossovers and pairings that I want to change in one action rather then setting up multiple actions for each pairing only slowing things down.

I know 'NEXT' won't work but it is to who what I'd like to do.
[...]
You are looking for the "continue" statement.

I am not sure exactly what you are trying to do but I think this might lead you to what you want. I can't guarantee that it will run in your context.

Code:
program:
# As you wrote it, show1 and show2 always have the same value. I think
# you mean this.
	show1 = '^Show A$' inlist $#show;
	show2 = '^Show B$' inlist $#show;

	output = '';

	for item in $#pair:
		if show1 then
			if item ==  "ABC/XYZ" then
				output = output & ',' & "AAA / BBB"
			else
				output = output & ',' & item
			fi;
# I am not sure exactly where you want the loop to go to the next interation.
# This seems like a reasonable guess
			continue
		fi;

		if show2 then
			if item ==  "KLM/NOP" then
				output = output & ',' & "EEE/ FFF"
			else
				output = output & ',' & item
			fi;
			continue
		fi;

# Put more of the test blocks here, e.g., show3, show4, etc


# If we get here then none of the test blocks were true. Add the item.
		output = output & ',' & item
	rof;
	output = list_sort(list_remove_duplicates(output, ','), 0, ',')
chaley is offline   Reply With Quote
Old 01-01-2023, 02:07 PM   #26
ackomb
Zealot
ackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura about
 
Posts: 106
Karma: 4486
Join Date: Mar 2020
Location: Netherlands
Device: i-pad
Quote:
Originally Posted by chaley View Post
You are looking for the "continue" statement.

I am not sure exactly what you are trying to do but I think this might lead you to what you want. I can't guarantee that it will run in your context.
Unfortunately it's not working the way I expected / hoped.
So in this case both titles have the same tag "Alex / Liv" in one instance in combination with shows ABC & GHI and in the other ABC & JKL resulting in 2 different pairings (one with female Alexandra and the other mail Alexander

However show3 is supposed to change "Jo / Maggy" into "Josefine / Maggie" and "JoJo" into "Josefine / Joe" for the first title only.

However the way it works now is that it only hits the 1st tag under both titles and then skips the remaining.

Code:
program:
	show1 = '^ABC$' inlist $#show && '^GHI$' inlist $#show;
	show2 = '^DEF$' inlist $#show && '^GHI$' inlist $#show;
	show3 = '^ABC$' inlist $#show && '^JKL$' inlist $#show;
	output = '';

	for item in $#ao3tags_pair:
		if show1 then
			if item ==  "Alex / Liv" then
				output = output & ',' & "Alexandra / Olivia"
			else
				output = output & ',' & item
			fi;
			continue
		fi;

		if show2 then
			if item ==  "Alex / Liv" then
				output = output & ',' & "Alexander / Olivia"
			else
				output = output & ',' & item
			fi;
			continue
		fi;

		if show3 then
			if item ==  "Jo / Maggy" then
				output = output & ',' & "Josefine / Maggie"
			elif item ==  "JoJo" then
				output = output & ',' & "Josefine / Joe"
			else
				output = output & ',' & item
			fi;
			continue
		fi;
		output = output & ',' & item
	rof;
	output = list_sort(list_remove_duplicates(output, ','), 0, ',')
I've attached a screenshot that hopefully shows what I'm trying to accomplish.

Ps. I've had to add/remove some semicolons here and there to make it work in the first place, just so you know. And also I could not get the previous code with the
Code:
show1 = list_count_matching($#show, '^(Show A|Show B)$', ',') == 2;
to work either but I think that's because I'm looking for an "AND - &&" and not an "OR |" but the above && seems to be working.
Attached Thumbnails
Click image for larger version

Name:	Schermafbeelding 2023-01-01 195650.jpg
Views:	76
Size:	97.8 KB
ID:	198784  
ackomb is offline   Reply With Quote
Old 01-01-2023, 02:37 PM   #27
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
I am really confused about what input becomes what output. Are you saying that more than one of show1, show2, and show3 might be true for some book? If that is the case the 'continue' statements shouldn't be where they are, and perhaps shouldn't be in the template at all.

What I really need is a list of examples showing the value of #show, the value of #ao3tags_pair, and the expected output.

EDIT: for example, it appears that for "Title 1" both show2 and show3 are true, and further that in the show3 case both "Jo / Maggy" and "JoJo" exist for the book. If this is true then the show3 block can't have the elif, but instead must probably be two blocks.

Last edited by chaley; 01-01-2023 at 02:49 PM.
chaley is offline   Reply With Quote
Old 01-01-2023, 03:14 PM   #28
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Does this produce the right answer? I added the show and ao3tags_pair variables so I could run the template.

Code:
program:
	show = $#show
#	show = 'ABC, JKL, GHI';

	show1 = '^ABC$' inlist show && '^GHI$' inlist show;
	show2 = '^DEF$' inlist show && '^GHI$' inlist show;
	show3 = '^ABC$' inlist show && '^JKL$' inlist show;
	output = '';

	ao3tags_pair = $#ao3tags_pair
#	ao3tags_pair = 'Alex / Liv, Jo / Maggy, JoJo';

	for item in ao3tags_pair:
		ni = '';
		if show1 then
			if item ==  "Alex / Liv" then
				ni = "Alexandra / Olivia"
			fi
		fi;

		if show2 then
			if item ==  "Alex / Liv" then
				ni = "Alexander / Olivia"
			fi
		fi;

		if show3 then
			if item ==  "Jo / Maggy" then
				ni = "Josefine / Maggie"
			elif item ==  "JoJo" then
				ni = "Josefine / Joe"
			fi
		fi;

		if ni then
			output = output & ',' & ni 
		else
			output = output & ',' & item
		fi
	rof;
	output = list_sort(list_remove_duplicates(output, ','), 0, ',')
chaley is offline   Reply With Quote
Old 01-01-2023, 03:40 PM   #29
ackomb
Zealot
ackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura about
 
Posts: 106
Karma: 4486
Join Date: Mar 2020
Location: Netherlands
Device: i-pad
Quote:
Originally Posted by chaley View Post
I am really confused
Okay I understand it might be best to give some clarity or at least I hope this gets more clear.
Show "Supergirl" - Character "Alex Danvers"
Show "Law and Order" - Character "Alex Cabot"
Show "Law and Order" - Character "Olivia Benson"
Show "Criminal Minds" - Character "Emily Prentiss"
Show "Pretty Little Liars" - Character "Emily Fields"

Let's say the tag is "Alex / Emily"

If the shows are a crossover between "Criminal Minds" and "Law and Order" the tag "Alex / Emily" becomes "Emily Prentiss / Alex Cabot"
If the shows are a crossover between "Pretty Little Liars" and "Law and Order" the tag "Alex / Emily" becomes "Emily Fields / Alex Cabot"

However if either is follow by another tag for example "Olivia / Alex" it won't change into "Alex Danvers / Olivia Benson" based on the show "Supergirl" and "Law and Order"

So for Title 1 both show1 and show3 are true and for Title 2 both show2 and show3 are true


Code:
program:
	show1 = '^Criminal Minds$' inlist $#show && '^Law and Order$' inlist $#show;
	show2 = '^Pretty Little Liars$' inlist $#show && '^Law and Order$' inlist $#show;
	show3 = '^Supergirl$' inlist $#show && '^Law and Order$' inlist $#show;
	output = '';

	for item in $#ao3tags_pair:
		if show1 then
			if item ==  "Alex / Emily" then
				output = output & ',' & "Emily Prentiss / Alex Cabot"
			else
				output = output & ',' & item
			fi;
			continue
		fi;

		if show2 then
			if item ==  "Alex / Emily" then
				output = output & ',' & "Emily Fields / Alex Cabot"
			else
				output = output & ',' & item
			fi;
			continue
		fi;

		if show3 then
			if item ==  "Olivia / Alex" then
				output = output & ',' & "Alex Danvers / Olivia Benson"
			else
				output = output & ',' & item
			fi;
			continue
		fi;
		output = output & ',' & item
	rof;
	output = list_sort(list_remove_duplicates(output, ','), 0, ',')
Maybe I'm taking it to far to want it all in 1 action template, it's okay if it's not possible. I would just have been faster in 1 rather then numerous actions.
Attached Thumbnails
Click image for larger version

Name:	Schermafbeelding 2023-01-01 213119.jpg
Views:	65
Size:	21.7 KB
ID:	198785  
ackomb is offline   Reply With Quote
Old 01-01-2023, 03:59 PM   #30
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
This seems to work. You will need to uncomment line 5 and line 14. After that you should delete line 13 and lines 1-4, which are there so I can test the template.
Code:
program:
#	show = 'Criminal Minds, Law and Order';
#	show = 'Pretty Little Liars, Law and Order, Supergirl';
	show = 'Criminal Minds, Law and Order, Supergirl';
#	show = $#show;

	show1 = '^Criminal Minds$' inlist show && '^Law and Order$' inlist show;
	show2 = '^Pretty Little Liars$' inlist show && '^Law and Order$' inlist show;
	show3 = '^Supergirl$' inlist show && '^Law and Order$' inlist show;

	output = '';

	ao3tags_pair = 'Alex / Emily, Olivia / Alex';
#	ao3tags_pair = $#ao3tags_pair;

	for item in ao3tags_pair:
		ni = '';

		if show1 then
			if item ==  "Alex / Emily" then
				ni = "Emily Prentiss / Alex Cabot"
			fi
		fi;

		if show2 then
			if item ==  "Alex / Emily" then
				ni = "Emily Fields / Alex Cabot"
			fi
		fi;

		if show3 then
			if item ==  "Olivia / Alex" then
				ni = "Alex Danvers / Olivia Benson"
			fi
		fi;


		if ni then
			output = output & ',' & ni 
		else
			output = output & ',' & item
		fi
	rof;
	output = list_sort(list_remove_duplicates(output, ','), 0, ',')
Attached Thumbnails
Click image for larger version

Name:	Clipboard01.png
Views:	87
Size:	64.4 KB
ID:	198787  
chaley is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Jumping to items in book list without activating keyboard shortcuts ownedbycats Library Management 7 01-26-2021 03:22 PM
Commas Following List Items TheArtfulDodger Library Management 3 07-15-2018 06:33 PM
All my documents from "My Items" list on Kindle Touch disappeared kinkle Kindle Developer's Corner 33 03-02-2016 02:42 PM
Recipe for Safari "Reading List" unread items anoved Recipes 6 03-19-2013 01:21 PM
Cant remove items from "Im Reading" list fictionaddiction Kobo Reader 1 06-21-2011 12:11 PM


All times are GMT -4. The time now is 08:36 AM.


MobileRead.com is a privately owned, operated and funded community.