View Single Post
Old 02-12-2008, 04:22 AM   #6
gwynevans
Wizzard
gwynevans ought to be getting tired of karma fortunes by now.gwynevans ought to be getting tired of karma fortunes by now.gwynevans ought to be getting tired of karma fortunes by now.gwynevans ought to be getting tired of karma fortunes by now.gwynevans ought to be getting tired of karma fortunes by now.gwynevans ought to be getting tired of karma fortunes by now.gwynevans ought to be getting tired of karma fortunes by now.gwynevans ought to be getting tired of karma fortunes by now.gwynevans ought to be getting tired of karma fortunes by now.gwynevans ought to be getting tired of karma fortunes by now.gwynevans ought to be getting tired of karma fortunes by now.
 
gwynevans's Avatar
 
Posts: 1,402
Karma: 2000000
Join Date: Nov 2007
Location: UK
Device: iPad 2, iPhone 6s, Kindle Voyage & Kindle PaperWhite
Quote:
Originally Posted by dhbailey View Post
I'm not sure it can be -- how will title / author /author-sort info be entered for each book, if you don't do it manually? It's not like files will all have this data in clearly recognizable areas so that the program can generate it automatically.
Unless you're naming your files to a particular scheme, which you can parse to obtain the meta-data, e.g. "Drake, David - RCN 01 - With the Lightnings.lit".

With that, something like the following can parse the name...
Code:
dash = file.find(' - ')
if dash != -1:
    fileAuthor = file[:dash]
    dash = file.rfind(' - ')  # Search back to allow for series seperators
    fileTitle  = file[dash+3:-4]

Last edited by gwynevans; 02-12-2008 at 04:26 AM.
gwynevans is offline   Reply With Quote