View Single Post
Old 07-17-2023, 11:47 AM   #2716
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 11,165
Karma: 77304081
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
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
ownedbycats is offline