View Single Post
Old 07-17-2023, 12:01 PM   #2717
BookJunkieLI
Evangelist
BookJunkieLI ought to be getting tired of karma fortunes by now.BookJunkieLI ought to be getting tired of karma fortunes by now.BookJunkieLI ought to be getting tired of karma fortunes by now.BookJunkieLI ought to be getting tired of karma fortunes by now.BookJunkieLI ought to be getting tired of karma fortunes by now.BookJunkieLI ought to be getting tired of karma fortunes by now.BookJunkieLI ought to be getting tired of karma fortunes by now.BookJunkieLI ought to be getting tired of karma fortunes by now.BookJunkieLI ought to be getting tired of karma fortunes by now.BookJunkieLI ought to be getting tired of karma fortunes by now.BookJunkieLI ought to be getting tired of karma fortunes by now.
 
BookJunkieLI's Avatar
 
Posts: 435
Karma: 572984
Join Date: Jan 2010
Location: Long Island
Device: Kobo Libra 2, Kindle 4, Nook Gl4, Nook STR, REB 1100, Ebookwise 1500,
Quote:
Originally Posted by ownedbycats View Post
currentchap/totalchap will only work for FanFicFare-downloaded stories. For regular books the file-structure varies too much to be reliably detectable with a regex.

Code:
program:

	input = $#kobobookmark;
# Don't change this to 'count' as that's a function
	ccount = $$#chaptercount;

	if 
## Checks that a Fanfiction has a Kobo bookmark and is not anthology|oneshot
## If you don't use a booktype-column, change this to check something else like a fandom column.
		$#booktype=='Fanfiction'
		&& 
		substr(input, 0, 10) == 'OEBPS/file'
		&& !$#fanficstatus in 'Anthology,Oneshot'
	then
## Extracts the 'current chapter' from the bookmarks, subtracts 1, and then formats them as 'currentchap/totalchap'
		strcat(format_number(re(input, '.*\/file(\d+).*', '\1') - 1, '{0:,d}'), '/',ccount)

## This will display the regular chapter-count for everything else.
	else
		ccount
	fi
Cool. For input = $#kobobookmark; would I use #kobostatus since that's where I'm currently putting the location information?
Although I may change the column name since Status, to me, indicates Unread, Reading, Finished.

And for $#booktype=='Fanfiction' I have a column called #library that is 'Text, but with a set of permitted values' wherein the values are Fanfic, Fiction, Non-Fiction. Would that work?
BookJunkieLI is offline