![]() |
#1 |
Enthusiast
![]() ![]() ![]() ![]() ![]() Posts: 47
Karma: 450
Join Date: Mar 2011
Device: PRS-600, PRS-650, Tolino Vision 3 HD, Kobo Libra H20
|
Kobo Directory Templates
Heya,
I've been using this template for a while and generally it works fine... Code:
program: series = test( field('series'), field('series'), ''); topic = test( field('#topic'), field('#topic'), ''); category = first_non_empty(series, topic); strippedcategory = re(category, '^(A|The|An|Der|Die|Das)\s+', ''); initialofcategory = substr( strippedcategory, 0, 1 ); idx = field('series_index'); indexno = contains(idx, '\.', format_number(idx, '04.1f'), format_number(idx, '02d')); index = test(series, strcat( indexno , ' - '), ''); cleanedCategory = re(category, ' & ', ' and '); cleanedCategory = re(category, '&', ' and '); foldernameforcategory = strcat(initialofcategory, '/', cleanedCategory, '/', index); defaultfoldername = 'other/'; cleanedTitle = field('title'); finalfolder = test(category, foldernameforcategory, defaultfoldername); strcat('books/', finalfolder, cleanedTitle ); Now I wanted to be clever and though, if I used the "topic" column to add a sub-topic as well, it could sort it under the sub-directory, for example: "Programming" -> goes under P/Programming "Programming/C" -> goes under P/Programming/C "Programming/Java" -> goes under P/Programming/Java In calibre when this is displayed, it also looks correct, but unfortunately, when loading them onto the Kobo, it actually works out to... "Programming" -> goes under P/Programming "Programming/C" -> goes under P/Programming_C "Programming/Java" -> goes under P/Programming_Java So, any idea what's causing this and is there an easy way to clean up the topic string to get the correct result? |
![]() |
![]() |
![]() |
#2 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,047
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
slash is a special character to file systems, so the Value in the fields gets changed to _ when used in a file template. <this is for normal, cross OS compatibility process in Calibre>
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,970
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
|
![]() |
![]() |
![]() |
#4 |
Enthusiast
![]() ![]() ![]() ![]() ![]() Posts: 47
Karma: 450
Join Date: Mar 2011
Device: PRS-600, PRS-650, Tolino Vision 3 HD, Kobo Libra H20
|
Thanks, worked perfectly.
|
![]() |
![]() |
![]() |
#5 |
Enthusiast
![]() ![]() ![]() ![]() ![]() Posts: 47
Karma: 450
Join Date: Mar 2011
Device: PRS-600, PRS-650, Tolino Vision 3 HD, Kobo Libra H20
|
Ok, one problem I found with that: Calibre does not recognize the books on the reader that way, so they appear there in the right folder, but Calibre does not show them as "On Device" when syncing... Hm...
|
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
Quote:
Code:
program: raw_list('authors', ', ') |
|
![]() |
![]() |
![]() |
#7 |
Enthusiast
![]() ![]() ![]() ![]() ![]() Posts: 47
Karma: 450
Join Date: Mar 2011
Device: PRS-600, PRS-650, Tolino Vision 3 HD, Kobo Libra H20
|
To be honest, I really doubt that this is the reason. Before I added the re-placement, all books were correctly identified as being on my Kobo, only after doing so, suddenly they were synced to the correct directory (good) - but not recognized as "on the device" anymore (bad). So the only change I made is adding the "re..." thing. Also the fact that this happens only for the books that have that "/" in the custom field, but none of the others, points really in the direction of that being the problem, doesn't it?
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
News export to Kobo with templates | biffhero | Library Management | 2 | 08-21-2020 08:22 AM |
Kobo and directory structure | DrunkenDonkey | Kobo Reader | 9 | 08-24-2016 01:01 PM |
Mini how to do after delete .kobo directory? | sbwtxj | Kobo Developer's Corner | 1 | 08-25-2014 11:31 PM |
Kobo iOS file directory | Kirbky | Kobo Reader | 2 | 02-13-2014 09:59 AM |
directory on kobo to kopy books | zoran | Kobo Reader | 5 | 07-19-2010 02:31 AM |