~ubuntu-branches/ubuntu/karmic/calibre/karmic

« back to all changes in this revision

Viewing changes to src/calibre/ebooks/metadata/imp.py

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-07-30 12:49:41 UTC
  • mfrom: (1.3.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090730124941-qjdsmri25zt8zocn
Tags: 0.6.3+dfsg-0ubuntu1
* New upstream release. Please see http://calibre.kovidgoyal.net/new_in_6/
  for the list of new features and changes.
* remove_postinstall.patch: Update for new version.
* build_debug.patch: Does not apply any more, disable for now. Might not be
  necessary any more.
* debian/copyright: Fix reference to versionless GPL.
* debian/rules: Drop obsolete dh_desktop call.
* debian/rules: Add workaround for weird Python 2.6 setuptools behaviour of
  putting compiled .so files into src/calibre/plugins/calibre/plugins
  instead of src/calibre/plugins.
* debian/rules: Drop hal fdi moving, new upstream version does not use hal
  any more. Drop hal dependency, too.
* debian/rules: Install udev rules into /lib/udev/rules.d.
* Add debian/calibre.preinst: Remove unmodified
  /etc/udev/rules.d/95-calibre.rules on upgrade.
* debian/control: Bump Python dependencies to 2.6, since upstream needs
  it now.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
 
5
5
import sys, os
6
6
 
7
 
from calibre.ebooks.metadata import MetaInformation
 
7
from calibre.ebooks.metadata import MetaInformation, string_to_authors
8
8
 
9
9
MAGIC = ['\x00\x01BOOKDOUG', '\x00\x02BOOKDOUG']
10
10
 
34
34
        if title:
35
35
            mi.title = title
36
36
        if author:
37
 
            src = author.split('&')
38
 
            authors = []
39
 
            for au in src:
40
 
                authors += au.split(',')
41
 
            mi.authors = authors
 
37
            mi.authors = string_to_authors(author)
42
38
            mi.author = author
43
39
        if category:
44
40
            mi.category = category
46
42
        msg = u'Couldn\'t read metadata from imp: %s with error %s'%(mi.title, unicode(err))
47
43
        print >>sys.stderr, msg.encode('utf8')
48
44
    return mi
49
 
        
50
 
            
51
 
def main(args=sys.argv):
52
 
    if len(args) != 2:
53
 
        print >>sys.stderr, _('Usage: imp-meta file.imp')
54
 
        print >>sys.stderr, _('No filename specified.')
55
 
        return 1
56
 
    
57
 
    path = os.path.abspath(os.path.expanduser(args[1]))
58
 
    print get_metadata(open(path, 'rb'))
59
 
    return 0
60
 
 
61
 
if __name__ == '__main__':
62
 
    sys.exit(main())