home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2011 January / maximum-cd-2011-01.iso / DiscContents / calibre-0.7.26.msi / file_1073 (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2010-10-31  |  1.1 KB  |  29 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. __license__ = 'GPL 3'
  5. __copyright__ = '2009, John Schember <john@nachtimwald.com>'
  6. __docformat__ = 'restructuredtext en'
  7. import os
  8. HEADER = '\xb0\x0c\xb0\x0c\x02\x00NUVO\x00\x00\x00\x00'
  9.  
  10. class RocketBookError(Exception):
  11.     pass
  12.  
  13.  
  14. def unique_name(name, used_names):
  15.     name = os.path.basename(name)
  16.     if len(name) < 32 and name not in used_names:
  17.         return name
  18.     ext = os.path.splitext(name)[1][:3]
  19.     base_name = name[:22]
  20.     for i in range(0, 9999):
  21.         name = '%s-%s.%s' % (str(i).rjust('0', 4)[:4], base_name, ext)
  22.         if name not in used_names:
  23.             break
  24.             continue
  25.         name not in used_names
  26.     
  27.     return name
  28.  
  29.