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
|
fi
|
||||||
|
|
||||||
PLATFORM_PYTHON=3.4
|
PLATFORM_PYTHON=3.4
|
||||||
SHARED_PYTHON=3.4
|
SHARED_PYTHON=3.7
|
||||||
if [ -e "$BASE/platform_local" ]; then
|
if [ -e "$BASE/platform_local" ]; then
|
||||||
export PLATFORM_ENV="$BASE/platform_local"
|
export PLATFORM_ENV="$BASE/platform_local"
|
||||||
else
|
else
|
||||||
|
|
@ -56,10 +56,16 @@ else
|
||||||
ARCH="_armv7l"
|
ARCH="_armv7l"
|
||||||
fi
|
fi
|
||||||
PLATFORM="linux$ARCH"
|
PLATFORM="linux$ARCH"
|
||||||
|
if [ -e $BASE/platform_${PLATFORM}/lib/libunrar.so ]; then
|
||||||
|
export UNRAR_LIB_PATH="$BASE/platform_${PLATFORM}/lib/libunrar.so"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
if [ $SYSTEM == "Darwin" ]; then
|
if [ $SYSTEM == "Darwin" ]; then
|
||||||
PLATFORM="darwin64"
|
PLATFORM="darwin64"
|
||||||
PLATFORM_PYTHON=3.7
|
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
|
fi
|
||||||
export PLATFORM_ENV="$BASE/platform_${PLATFORM}"
|
export PLATFORM_ENV="$BASE/platform_${PLATFORM}"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,9 @@ if sys.platform == 'win32':
|
||||||
site.addsitedir(site_packages)
|
site.addsitedir(site_packages)
|
||||||
sys.path.append(join(base, 'platform_win32'))
|
sys.path.append(join(base, 'platform_win32'))
|
||||||
os.environ['oxCACHE'] = join(base, 'data', 'ox')
|
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 api
|
||||||
import commands
|
import commands
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import ox
|
||||||
|
|
||||||
from . import pdf
|
from . import pdf
|
||||||
from . import cbr
|
from . import cbr
|
||||||
cbz = cbr
|
from . import cbz
|
||||||
from . import epub
|
from . import epub
|
||||||
from . import txt
|
from . import txt
|
||||||
from . import opf
|
from . import opf
|
||||||
|
|
@ -34,8 +34,10 @@ def metadata(f, from_=None):
|
||||||
data['size'] = os.stat(f).st_size
|
data['size'] = os.stat(f).st_size
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if ext in ('cbr', 'cbz'):
|
if ext in ('cbr', ):
|
||||||
info = cbr.info(f)
|
info = cbr.info(f)
|
||||||
|
elif ext in ('cbz', ):
|
||||||
|
info = cbz.info(f)
|
||||||
elif ext in ('epub', 'kepub'):
|
elif ext in ('epub', 'kepub'):
|
||||||
info = epub.info(f)
|
info = epub.info(f)
|
||||||
data['extension'] = 'epub'
|
data['extension'] = 'epub'
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,23 @@
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import ox
|
||||||
|
|
||||||
def cover(path):
|
def cover(path):
|
||||||
data = None
|
data = None
|
||||||
#open rar file and extract first page here
|
#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
|
return data
|
||||||
|
|
||||||
def info(path):
|
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
|
stem
|
||||||
sqlitedict==1.6.0
|
sqlitedict==1.6.0
|
||||||
zeroconf
|
zeroconf
|
||||||
|
unrar
|
||||||
|
|
|
||||||
|
|
@ -338,7 +338,7 @@ oml.ui.folders = function() {
|
||||||
that.updateOwnLists = function(callback) {
|
that.updateOwnLists = function(callback) {
|
||||||
oml.getLists(function(lists) {
|
oml.getLists(function(lists) {
|
||||||
var items = lists.filter(function(list) {
|
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
|
oml.$ui.folder[0].$content
|
||||||
.css({height: 16 + items.length * 16 + 'px'});
|
.css({height: 16 + items.length * 16 + 'px'});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue