Exemple #1
0
def plugins():
    plugins = {}
    platform = PlatformPackage(_config['PLATFORM_DIR'] + _config['PLATFORM_JAR'])
    platform.setBrandModel(_config['PLATFORM_BRAND'], _config['PLATFORM_MODEL'])
    readerPackage = ReaderPackage(_config['READER_JAR'], platform)
    for plugin in readerPackage.getPlugins():
        if not plugin.name == 'pager':
            plugins[plugin.name] = (plugin.description, plugin.compressedSize)
    return plugins
Exemple #2
0
def supported():
    supported = {}
    for f in File(_config['PLATFORM_DIR']).list():
        platform = PlatformPackage(_config['PLATFORM_DIR'] + f)
        platformSupported = platform.getSupported()
        for brand in platformSupported.keySet():
            if not supported.has_key(brand):
                supported[brand] = {}
            for model in platformSupported[brand]:
                if not supported[brand].has_key(model):
                    supported[brand][model] = {}
                supported[brand][model][f] = (f, platform.getDescription())
    return supported    
Exemple #3
0
class Bookshelf:
    def __init__(self):
        self.books = []
        self.configure()

    def configure(self):       
        self.font_fabric = FontFabric(config('FONT_DIRECTORY'))
        self.platform = PlatformPackage(config('PLATFORM_DIR') + config('PLATFORM_JAR'))
        self.platform.setBrandModel(config('PLATFORM_BRAND'), config('PLATFORM_MODEL'))
        self.platform.setRotation(config('SCREEN_ROTATION'))
        self.reader_package = ReaderPackage(config('READER_JAR'), self.platform)

    def add_book(self, f):
        book = Book(f, self)
        self.books.append(book)            
        return book

    def add_fo_book(self, f):
        book = FoBook(f, self)
        self.books.append(book)            
        return book

    def del_book(self, book):
        self.books.remove(book)
        
    def save(self, f):
        # TODO check if previews been generated / ie book rendered
        builder = MidletBuilder(self.reader_package, self.platform)
        builder.language = config('MIDLET_LOCALE')
        for book in self.books:
            builder.add(book.book)
        # add plugins
        for plugin in config('PLUGIN_LIST'):
            builder.addPlugin(plugin)
        # always add pager
        builder.addPlugin('pager')
        builder.write(f, config('MAKE_FOLDER'))
Exemple #4
0
 def configure(self):       
     self.font_fabric = FontFabric(config('FONT_DIRECTORY'))
     self.platform = PlatformPackage(config('PLATFORM_DIR') + config('PLATFORM_JAR'))
     self.platform.setBrandModel(config('PLATFORM_BRAND'), config('PLATFORM_MODEL'))
     self.platform.setRotation(config('SCREEN_ROTATION'))
     self.reader_package = ReaderPackage(config('READER_JAR'), self.platform)