26 lines
549 B
Python
26 lines
549 B
Python
# -*- coding: utf-8 -*-
|
|
|
|
|
|
import os
|
|
import ox
|
|
|
|
def cover(path):
|
|
data = None
|
|
#open rar file and extract first page here
|
|
try:
|
|
from unrar import rarfile
|
|
rar = rarfile.RarFile(path)
|
|
files = rar.namelist()
|
|
if files:
|
|
cover = ox.sorted_strings(files)[0]
|
|
data = rar.read(cover)
|
|
except:
|
|
data = None
|
|
return data
|
|
|
|
def info(path):
|
|
data = {}
|
|
data['title'] = os.path.splitext(os.path.basename(path))[0]
|
|
#data['pages'] = fixme read rar to count pages
|
|
return data
|
|
|