Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 12-01-2015, 12:49 PM   #1
Trel
Connoisseur
Trel began at the beginning.
 
Posts: 64
Karma: 10
Join Date: Jan 2010
Device: Onyx Boox Poke 3
Inconsistent Folder Names, Can't Figure it out

I'm trying to figure out why Calibre is inconsistantly naming folders in my library.

For example, I have a series of 21 books. I bulk edited the Author and Author Sort name to ensure they were ALL identical.

I exported everything to files, and then nuked my library folder (to ensure that there was nothing residual).

I then re-imported all the books.

What I got was

Two folders in my library
"Frank; Brian Herbert; Kevin J. Ande"
and
"Frank; Brian Herbert; Kevin J. Ander"

The first has the first three books, and the other has the other eighteen.

All metadata within Calibre shows it the same still. I can't figure out why it's doing this. I considered overall filename length, but it can't be that, because there are some longer titles in the second folder.

Anyone have any idea?
Trel is offline   Reply With Quote
Old 12-01-2015, 01:01 PM   #2
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Why, oh why, are you using a semicolon to separate authors, when calibre uses "&".
Why, oh why, are you using a semicolon to ALSO separate two author first names when they have the same last name?


And calibre is certainly trimming the filenames, since I assume the author (singular) "Frank; Brian Herbert; Kevin J. Ander" is actually "Frank; Brian Herbert; Kevin J. Anderson".
(But it should be "Frank Herbert & Brian Herbert & Kevin J. Anderson".)

Now, I would expect, if the metadata as definitely the same, that calibe would rename the author folder. It is possible that when shortening the path, it keeps old folders (I doubt it), but in any even, if you temporarily rename the author, it will recalculate the values and put them all together.

EDIT: well, chaley seems to be implying that calibre does, indeed, create the entire path independently, and split it arbitrarily.
Can't say I'm too terribly surprised though.

Last edited by eschwartz; 12-02-2015 at 12:18 PM.
eschwartz is offline   Reply With Quote
Advert
Old 12-01-2015, 01:19 PM   #3
Trel
Connoisseur
Trel began at the beginning.
 
Posts: 64
Karma: 10
Join Date: Jan 2010
Device: Onyx Boox Poke 3
Quote:
Originally Posted by eschwartz View Post
Why, oh why, are you using a semicolon to separate authors, when calibre uses "&".
Why, oh why, are you using a semicolon to ALSO separate two author first names when they have the same last name?
I didn't originally name these. I can change them to "&" and make the way they're worded more sane, but doesn't explain what's happening here.

(But for the record, on the actual cover, it's listed as "Frank Herbert, Brian Herbert, And Kevin J. Anderson")

1. Bulk rename all 21 books, setting both Author and Author Sort (there should be no other author field, correct?)

2. Export all the books. (Result here is a single folder for the author)

3. Completely remove the Calibre library (the entire folder). There should be no residual metadata anywhere.

4. Import the books from what I did in #2.

5. That's how I ended up where I am with the two folders. (Originally it was just a single book in a different folder, now it's three)


Quote:
And calibre is certainly trimming the filenames, since I assume the author (singular) "Frank; Brian Herbert; Kevin J. Ander" is actually "Frank; Brian Herbert; Kevin J. Anderson".
(But it should be "Frank Herbert & Brian Herbert & Kevin J. Anderson".)
Agreed, however, it's not doing it consistently. For example, there's a title that's ~5 characters longer than any of the other titles. It's listed under the folder with the longer name.


Quote:
Now, I would expect, if the metadata as definitely the same, that calibe would rename the author folder. It is possible that when shortening the path, it keeps old folders (I doubt it), but in any even, if you temporarily rename the author, it will recalculate the values and put them all together.
That's why I exported, nuked the library, and reimported. I still get the two folders, so I don't know what's going on here.

EDIT: I renamed them using "&" and it looks like it just uses the first author for the folder name now, though, it is using a single folder. I can live with that.

Last edited by Trel; 12-01-2015 at 01:48 PM.
Trel is offline   Reply With Quote
Old 12-01-2015, 04:05 PM   #4
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,732
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by Trel View Post
EDIT: I renamed them using "&" and it looks like it just uses the first author for the folder name now, though, it is using a single folder. I can live with that.
Correct - the other authors are in the database, but they don't need their own folder. If you added a book where "Kevin J. Anderson" was the sole author you would have a folder by that name with that one book in it.

BR
BetterRed is offline   Reply With Quote
Old 12-02-2015, 09:47 AM   #5
Trel
Connoisseur
Trel began at the beginning.
 
Posts: 64
Karma: 10
Join Date: Jan 2010
Device: Onyx Boox Poke 3
I'm still curious how (and why) it was splitting the books between the two folders I mentioned.

It gets weirder still.

Without the author fix, it wasn't consistently splitting the books between the folders the same way each time.
Trel is offline   Reply With Quote
Advert
Old 12-02-2015, 11:21 AM   #6
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,064
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by Trel View Post
I'm still curious how (and why) it was splitting the books between the two folders I mentioned.

It gets weirder still.

Without the author fix, it wasn't consistently splitting the books between the folders the same way each time.
"Frank; Brian Herbert; Kevin J. Ande" is one Author as far as Calibre is concerned
& tells Calibre to parse these
There is a tweak that sets the additional names to parse DO NOT try and force your ; in there
Code:
# Splitting multiple author names

authors_split_regex = '(?i),?\\s+(and|with)\\s+'
theducks is offline   Reply With Quote
Old 12-02-2015, 11:54 AM   #7
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 Trel View Post
I'm still curious how (and why) it was splitting the books between the two folders I mentioned.

It gets weirder still.

Without the author fix, it wasn't consistently splitting the books between the folders the same way each time.
The length of the path to a book is limited, especially in windows. If the "standard" path is too long, calibre will shorten it by removing characters from each path segment (author, title, book). Because the number of characters to remove depends on the length of the path, the resulting segments will vary from one to another.
chaley is offline   Reply With Quote
Old 12-03-2015, 09:57 AM   #8
Trel
Connoisseur
Trel began at the beginning.
 
Posts: 64
Karma: 10
Join Date: Jan 2010
Device: Onyx Boox Poke 3
Quote:
Originally Posted by chaley View Post
The length of the path to a book is limited, especially in windows. If the "standard" path is too long, calibre will shorten it by removing characters from each path segment (author, title, book). Because the number of characters to remove depends on the length of the path, the resulting segments will vary from one to another.

That's the logic I was expecting, but what I got ended up with final paths like this

c:\longer author name\book (-----) 1\book (-----) 1.epub
c:\longer author name\book (---) 2\book (---) 2.epub
c:\longer author name\book (-----------) 3\book (-----------) 3.epub
and
c:\author name\book (---) 4\book (---) 4.epub
c:\author name\book (---------) 5\book (---------) 5.epub


Essentially the book with the longest title (and as such with the longest path) was put into the folder with the author's name truncated to MORE characters.

That's why I posted to ask to begin with. If it was simply that the longer titles were in the folder with the author's name truncated smaller, that would have made sense, so I'd have understood what was happening.
Trel is offline   Reply With Quote
Old 12-03-2015, 10:06 AM   #9
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
The code calibre uses to shorten a path is under the spoiler. You will see that calibre shortens each component by a % of the amount needed, thus the longest components are shortened more.
Spoiler:
Code:
def shorten_component(s, by_what):
    l = len(s)
    if l < by_what:
        return s
    l = (l - by_what)//2
    if l <= 0:
        return s
    return s[:l] + s[-l:]

def shorten_components_to(length, components, more_to_take=0, last_has_extension=True):
    filepath = os.sep.join(components)
    extra = len(filepath) - (length - more_to_take)
    if extra < 1:
        return components
    deltas = []
    for x in components:
        pct = len(x)/float(len(filepath))
        deltas.append(int(ceil(pct*extra)))
    ans = []

    for i, x in enumerate(components):
        delta = deltas[i]
        if delta > len(x):
            r = x[0] if x is components[-1] else ''
        else:
            if last_has_extension and x is components[-1]:
                b, e = os.path.splitext(x)
                if e == '.':
                    e = ''
                r = shorten_component(b, delta)+e
                if r.startswith('.'):
                    r = x[0]+r
            else:
                r = shorten_component(x, delta)
            r = r.strip()
            if not r:
                r = x.strip()[0] if x.strip() else 'x'
        ans.append(r)
    if len(os.sep.join(ans)) > length:
        return shorten_components_to(length, components, more_to_take+2)
    return ans
chaley is offline   Reply With Quote
Old 12-03-2015, 12:25 PM   #10
Trel
Connoisseur
Trel began at the beginning.
 
Posts: 64
Karma: 10
Join Date: Jan 2010
Device: Onyx Boox Poke 3
And that fully explains it.

Mystery solved, as well as problem solved (by correcting the author field to begin with)
Trel is offline   Reply With Quote
Old 12-04-2015, 04:36 PM   #11
jecilop
Addict
jecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day nowjecilop will be dicovering the secret to cold fusion any day now
 
Posts: 260
Karma: 139980
Join Date: Mar 2014
Device: Android
I just skipped the tech talk on this one to answer...based on what you said..you exported the files in a group and not the entire folders individually.

It sounds as if you didn't update the metadata in the files. If you are just importing individual files, it will pull from the metadata in them. If it was never updated, then you won't see your fixes. Calibre doesn't do this automatically. You have to update the metadata for it to be "sealed" in the file.

I hope this helps.
jecilop is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Folder names in calibre library AlexBell Library Management 17 06-19-2014 04:49 PM
Folder names question JMikeD Calibre 2 11-27-2012 01:35 PM
PRS-T1 Invisible Folder names etc? wjdzm Sony Reader Dev Corner 1 08-22-2012 07:18 PM
Parens after folder/file names BrownSamurai Calibre 2 12-07-2011 02:45 AM
Using Folder Names as Metadata volkermord Calibre 7 08-24-2010 01:36 AM


All times are GMT -4. The time now is 07:24 PM.


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