Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Simple OPDS
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirror
Simple OPDS
Commits
50a08fb9
Commit
50a08fb9
authored
Mar 17, 2018
by
Dmitry Shelepnev
Browse files
Options
Downloads
Patches
Plain Diff
Add handled UnicodeDecode Exception for book parse
parent
204218e6
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
opds_catalog/sopdscan.py
+51
-46
51 additions, 46 deletions
opds_catalog/sopdscan.py
raspberry.txt
+76
-0
76 additions, 0 deletions
raspberry.txt
with
127 additions
and
46 deletions
opds_catalog/sopdscan.py
+
51
−
46
View file @
50a08fb9
...
@@ -203,6 +203,7 @@ class opdsScanner:
...
@@ -203,6 +203,7 @@ class opdsScanner:
if
e
.
lower
()
in
config
.
SOPDS_BOOK_EXTENSIONS
.
split
():
if
e
.
lower
()
in
config
.
SOPDS_BOOK_EXTENSIONS
.
split
():
rel_path
=
os
.
path
.
relpath
(
full_path
,
config
.
SOPDS_ROOT_LIB
)
rel_path
=
os
.
path
.
relpath
(
full_path
,
config
.
SOPDS_ROOT_LIB
)
self
.
logger
.
debug
(
"
Attempt to add book
"
+
rel_path
+
"
/
"
+
name
)
self
.
logger
.
debug
(
"
Attempt to add book
"
+
rel_path
+
"
/
"
+
name
)
try
:
if
opdsdb
.
findbook
(
name
,
rel_path
,
1
)
==
None
:
if
opdsdb
.
findbook
(
name
,
rel_path
,
1
)
==
None
:
if
archive
==
0
:
if
archive
==
0
:
cat
=
opdsdb
.
addcattree
(
rel_path
,
archive
)
cat
=
opdsdb
.
addcattree
(
rel_path
,
archive
)
...
@@ -249,3 +250,7 @@ class opdsScanner:
...
@@ -249,3 +250,7 @@ class opdsScanner:
else
:
else
:
self
.
books_skipped
+=
1
self
.
books_skipped
+=
1
self
.
logger
.
debug
(
"
Book
"
+
rel_path
+
"
/
"
+
name
+
"
Already in DB.
"
)
self
.
logger
.
debug
(
"
Book
"
+
rel_path
+
"
/
"
+
name
+
"
Already in DB.
"
)
except
UnicodeEncodeError
as
err
:
self
.
logger
.
warning
(
rel_path
+
'
-
'
+
name
+
'
Book UnicodeEncodeError error, skipping... (Error: %s)
'
%
err
)
self
.
bad_books
+=
1
This diff is collapsed.
Click to expand it.
raspberry.txt
0 → 100644
+
76
−
0
View file @
50a08fb9
##
## RaspberryPI
## SQLITE
##
sudo apt-get update
sudo apt-get install git
sudo apt-get install python3-pip
sudo apt-get install python3-lxml
sudo apt-get install libopenjp2-7-dev
sudo apt-get install libtiff5
cd /home
sudo git clone https://github.com/mitshel/sopds.git
cd /home/sopds
sudo python3 -m pip install -r requirements.txt
sudo python3 manage.py migrate
sudo python3 manage.py sopds_util clear
sudo python3 manage.py createsuperuser
sudo python3 manage.py sopds_util setconf SOPDS_ROOT_LIB /home/sopds/opds_catalog/tests/data
sudo python3 manage.py sopds_util setconf SOPDS_LANGUAGE ru-RU
sudo python3 manage.py sopds_util setconf SOPDS_SCAN_START_DIRECTLY True
sudo python3 manage.py sopds_scanner start --daemon
sudo python3 manage.py sopds_server start --daemon
##
## MYSQL
##
##
sudo apt-get install mysql-server
sudo apt-get install python3-mysqldb
sudo mysql mysql
mysql > create database if not exists sopds default charset=utf8;
mysql > grant all on sopds.* to 'sopds'@'localhost' identified by 'sopds';
mysql > commit;
mysql > ^C
cd /home/sopds
sudo vi sopds/settings.py
# Mysql
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'sopds',
'HOST': 'localhost',
'USER': 'sopds',
'PASSWORD' : 'sopds',
'OPTIONS' : {^M
'init_command': "SET default_storage_engine=MyISAM;\
SET sql_mode='';"
}
}
}
# SQLITE
#
#
#DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
# }
#}
##
##
## Warning -
##
##
sudo python3 manage.py migrate
sudo python3 manage.py sopds_util clear
sudo python3 manage.py createsuperuser
sudo python3 manage.py sopds_util setconf SOPDS_ROOT_LIB /home/sopds/opds_catalog/tests/data
sudo python3 manage.py sopds_util setconf SOPDS_LANGUAGE ru-RU
sudo python3 manage.py sopds_util setconf SOPDS_SCAN_START_DIRECTLY True
sudo python3 manage.py sopds_scanner start --daemon
sudo python3 manage.py sopds_server start --daemon
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment