Compare commits
3 commits
760494dd6d
...
3ec0930f52
| Author | SHA1 | Date | |
|---|---|---|---|
| 3ec0930f52 | |||
| 8fdda01d4d | |||
| 58689cd4ff |
7 changed files with 61 additions and 5 deletions
8
ctl
8
ctl
|
|
@ -37,7 +37,7 @@ if [ ! -e "$PID" ]; then
|
|||
fi
|
||||
|
||||
PLATFORM_PYTHON=3.4
|
||||
SHARED_PYTHON=3.4
|
||||
SHARED_PYTHON=3.7
|
||||
if [ -e "$BASE/platform_local" ]; then
|
||||
export PLATFORM_ENV="$BASE/platform_local"
|
||||
else
|
||||
|
|
@ -56,10 +56,16 @@ else
|
|||
ARCH="_armv7l"
|
||||
fi
|
||||
PLATFORM="linux$ARCH"
|
||||
if [ -e $BASE/platform_${PLATFORM}/lib/libunrar.so ]; then
|
||||
export UNRAR_LIB_PATH="$BASE/platform_${PLATFORM}/lib/libunrar.so"
|
||||
fi
|
||||
fi
|
||||
if [ $SYSTEM == "Darwin" ]; then
|
||||
PLATFORM="darwin64"
|
||||
PLATFORM_PYTHON=3.7
|
||||
if [ -e $BASE/platform_${PLATFORM}/lib/libunrar.dylib ]; then
|
||||
export UNRAR_LIB_PATH="$BASE/platform_${PLATFORM}/lib/libunrar.dylib"
|
||||
fi
|
||||
fi
|
||||
export PLATFORM_ENV="$BASE/platform_${PLATFORM}"
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ if sys.platform == 'win32':
|
|||
site.addsitedir(site_packages)
|
||||
sys.path.append(join(base, 'platform_win32'))
|
||||
os.environ['oxCACHE'] = join(base, 'data', 'ox')
|
||||
unrar_dll = join(base, 'platform_win32', 'unrar.dll')
|
||||
if os.path.exists(unrar_dll):
|
||||
os.environ['UNRAR_LIB_PATH'] = unrar_dll
|
||||
|
||||
import api
|
||||
import commands
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import ox
|
|||
|
||||
from . import pdf
|
||||
from . import cbr
|
||||
cbz = cbr
|
||||
from . import cbz
|
||||
from . import epub
|
||||
from . import txt
|
||||
from . import opf
|
||||
|
|
@ -34,8 +34,10 @@ def metadata(f, from_=None):
|
|||
data['size'] = os.stat(f).st_size
|
||||
|
||||
try:
|
||||
if ext in ('cbr', 'cbz'):
|
||||
if ext in ('cbr', ):
|
||||
info = cbr.info(f)
|
||||
elif ext in ('cbz', ):
|
||||
info = cbz.info(f)
|
||||
elif ext in ('epub', 'kepub'):
|
||||
info = epub.info(f)
|
||||
data['extension'] = 'epub'
|
||||
|
|
|
|||
|
|
@ -2,11 +2,23 @@
|
|||
|
||||
|
||||
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)
|
||||
for cover in ox.sorted_strings(rar.namelist()):
|
||||
try:
|
||||
data = rar.read(cover)
|
||||
except:
|
||||
data = None
|
||||
finally:
|
||||
return data
|
||||
except:
|
||||
data = None
|
||||
return data
|
||||
|
||||
def info(path):
|
||||
|
|
|
|||
32
oml/media/cbz.py
Normal file
32
oml/media/cbz.py
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import os
|
||||
import zipfile
|
||||
|
||||
import ox
|
||||
|
||||
def cover(path):
|
||||
data = None
|
||||
logger.debug('cover %s', path)
|
||||
data = None
|
||||
try:
|
||||
z = zipfile.ZipFile(path)
|
||||
except zipfile.BadZipFile:
|
||||
logger.debug('invalid zbc file %s', path)
|
||||
return data
|
||||
files = [f.filename for f in z.filelist]
|
||||
if files:
|
||||
for cover in ox.sortedstrings(files):
|
||||
try:
|
||||
data = z.read(cover)
|
||||
except:
|
||||
data = None
|
||||
finally:
|
||||
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
|
||||
|
||||
|
|
@ -10,3 +10,4 @@ pysocks
|
|||
stem
|
||||
sqlitedict==1.6.0
|
||||
zeroconf
|
||||
unrar
|
||||
|
|
|
|||
|
|
@ -338,7 +338,7 @@ oml.ui.folders = function() {
|
|||
that.updateOwnLists = function(callback) {
|
||||
oml.getLists(function(lists) {
|
||||
var items = lists.filter(function(list) {
|
||||
return list.user == '' && list.type != 'library';
|
||||
return list.user == '' && list.type != 'library' && list.name != 'Inbox';
|
||||
});
|
||||
oml.$ui.folder[0].$content
|
||||
.css({height: 16 + items.length * 16 + 'px'});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue