04-18-2010, 04:13 PM | #1 |
Fanatic
Posts: 556
Karma: 1020204
Join Date: Sep 2008
Location: Bosnia and Herzegovina
Device: Lenovo Yoga Tab 2 (Android)
|
Sorting a collection
Hello all, I hope you can help me with a problem I'm having.
I had tried Calibre some time ago for organizing my ebook collection, but finding it was not for me I uninstalled it. I recently discovered that it exists in a portable version, so I thought I should give it another chance and try to learn how to use it efficiently. I ran into a problem when I added a folder containing a large number of files. The files are txt files titled in the following format: Series - number - Title.txt Authors were not in the title, as they weren't important for this collection. When I added the books, the series became the title, the titles became authors, and the "series" column in Calibre was blank. I read the FAQ and went through several threads here, but all the mentions of command lines, regex, codes in curly brackets are making my head spin. I don't understand any of them, nor do I know anything about any level of programming. What I'm looking for is someone who would be so good to explain to me as they would to a small child, what do I need to do to have Calibre recognize the correct titles. Thank you in advance. |
04-18-2010, 06:06 PM | #2 | |
Wizard
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
Quote:
Click Add/Save Put this: Code:
(?P<series>.+) - (?P<series_index>\d+) - (?P<title>.*) Then drag your books in to the main window. |
|
Advert | |
|
04-18-2010, 07:41 PM | #3 | |
Fanatic
Posts: 556
Karma: 1020204
Join Date: Sep 2008
Location: Bosnia and Herzegovina
Device: Lenovo Yoga Tab 2 (Android)
|
Quote:
thank you for the suggestion, I tried that but it doesn't recognize the series now. When I opened the Preferences dialog, I found this: (?P<title>.+) - (?P<author>[^_]+) I replaced it with this: (?P<series>.+) - (?P<title>[^_]+) I'm using the portable version found on the PortableApps website, if that makes a difference. How would I need to name a file for cases where I'd like to see the series index and author names, for book where I want that distinction? Also, is there a way to minimize the number of folders/subfolders I get in the "Saving books" dialog? ETA I did some poking around, and discovered that (?P<series>[^_]+) (?P<series_index>[0-9]+) - (?P<title>.+) - (?P<author>[^_]+) seems to work but only if I choose to have Calibre use file names as it's source of metadata. What will happen if I import a book which has metadata in the file? Will it be ignored? Also, can I have a different scheme for files named in a different way? I have some files where author is listed first; will the file be read in the correct way? Last edited by citac; 04-18-2010 at 11:27 PM. |
|
04-19-2010, 10:23 AM | #4 | ||||||||||
Wizard
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
Quote:
Quote:
Code:
Series - 5 - Book title.txt Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
|
||||||||||
04-19-2010, 10:29 AM | #5 |
Wizard
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
I see that I didn't answer this correctly. It's easy to make the author optional. You simply put parentheses around the author and add a question mark after the closing parentheses. Post some book titles that you actually have, with and without author, and someone will show you how to do it.
|
Advert | |
|
04-19-2010, 09:48 PM | #6 |
Fanatic
Posts: 556
Karma: 1020204
Join Date: Sep 2008
Location: Bosnia and Herzegovina
Device: Lenovo Yoga Tab 2 (Android)
|
Thank you, I will try these as soon as time allows, and make sure to include a hyphen between the series and series #. I found the Saving books tab, but I'm still getting too many folders for my taste, and will have to do some further research.
As for using file names as a source of metadata, I imagine it would be possible to use it as a first step during import, and later download metadata for files. I just don't have as much time as I want to research and familiarize myself with all the details so it will take me a while. Thanks again for all the suggestions. |
04-20-2010, 06:52 PM | #7 |
Fanatic
Posts: 556
Karma: 1020204
Join Date: Sep 2008
Location: Bosnia and Herzegovina
Device: Lenovo Yoga Tab 2 (Android)
|
I tried adding parentheses around (?P<author>[^_]+) followed by a question mark, but that didn't seem to do the trick. You said I needed to add some titles for you, so here they are if you're willing to have a look.
These are all from the same author, so I want that to show up: Beth Baker - FBI - 01 - The Games People Play Beth Baker - FBI - 02 - The Devil’s Den Beth Baker - FBI - 03 - Memories of the Dead These are from various authors, about the same subject Brothers - 01 - Reading of the Will Brothers - 02 - Fortunate Sons Brothers - 03 - A Matter Of Family These two go well together: (?P<series>.+) - (?P<series_index>\d+) - (?P<title>.*) Brothers - 01 - Reading of the Will If I change it to ((?P<author>[^_]+))? - (?P<series>.+) - (?P<series_index>\d+) - (?P<title>.*) it doesn't work. Did I place the parentheses and question mark in the proper place? I googled various phrases containing calibre, regex, optional author but was unable to find what I needed - all possibilities seemed very complicated and didn't achieve what I was looking for when I tried them (most of my searches pointed to this forum so I went through most of them). |
04-21-2010, 09:22 AM | #8 | ||||
Wizard
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
Quote:
Quote:
Quote:
Quote:
Here is what you wanted .. or more accurately, what I thought would work: Code:
((?P<author>[^_]+) - )?(?P<series>.+) - (?P<series_index>\d+) - (?P<title>.*) Unfortunately, when I did that, it worked great for the titles that have an author, but Calibre threw an error when it did not have an author. I then tried this ({0,1} says the preceding is there zero or one times): Code:
((?P<author>[^_]+) - ){0,1}(?P<series>.+) - (?P<series_index>\d+) - (?P<title>.*) Code:
ERROR: ERROR: Unhandled exception: <b>AttributeError</b>:'NoneType' object has no attribute 'replace' Traceback (most recent call last): File "site-packages\calibre\gui2\widgets.py", line 74, in do_test File "site-packages\calibre\ebooks\metadata\meta.py", line 147, in metadata_from_filename File "site-packages\calibre\ebooks\metadata\__init__.py", line 20, in string_to_authors AttributeError: 'NoneType' object has no attribute 'replace' Sorry, but I'm out of ideas. I've never actually needed an optional author regex, and I'm a bit short on time to test it further. Last edited by Starson17; 04-21-2010 at 09:37 AM. |
||||
04-21-2010, 04:22 PM | #9 | |
Fanatic
Posts: 556
Karma: 1020204
Join Date: Sep 2008
Location: Bosnia and Herzegovina
Device: Lenovo Yoga Tab 2 (Android)
|
Quote:
I will look into posting a bug report for this. In the mean time, I went through the Calibre forum one more time with a fine tooth comb, and found a thread where the OP requested help with something similar. There were several regexes there, and I tried each. Finally, it turned out this worked: ^((?P<author>([^\-_0-9]+)(?=\s*-\s*)(?!\s*-\s*[0-9.]+)|\b))(\s*-\s*)?(\[?(?P<series>[^0-9\-]+) (- )?(?P<series_index>[0-9.]+)\]?\s*-\s*)?(?P<title>.+) It doesn't add "Unknown" but leaves the author's name completely blank. Why, I have no idea, and I guess you would understand it better than I do. Thanks again. |
|
04-21-2010, 04:53 PM | #10 | |||
Wizard
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
Quote:
That's what I get for listening to you when you said: Quote:
I'm really going to have to look at why my simpler expressions threw errors. Quote:
|
|||
04-21-2010, 08:23 PM | #11 | |||
Fanatic
Posts: 556
Karma: 1020204
Join Date: Sep 2008
Location: Bosnia and Herzegovina
Device: Lenovo Yoga Tab 2 (Android)
|
Quote:
Quote:
Quote:
|
|||
04-21-2010, 08:44 PM | #12 |
Wizard
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
|
Tags |
calibre sorting |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Sorting by Author | Ben Thornton | Amazon Kindle | 6 | 08-31-2010 10:03 PM |
Title Sorting / Author Sorting | ahi | Sony Reader | 0 | 09-14-2009 01:51 PM |
"Sort By Author" not sorting correctly within author's collection | Sonist | Amazon Kindle | 1 | 08-05-2009 07:52 PM |
Sorting out my ebook collection using Calibre | river | Calibre | 6 | 06-16-2009 03:16 AM |
sorting | strahlemann | Sony Reader | 0 | 11-19-2008 10:09 PM |