fnp
/
wolnelektury.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
66ab038
)
Updated and fixes.
author
Radek Czajka
<rczajka@rczajka.pl>
Tue, 10 Jan 2023 14:40:13 +0000
(15:40 +0100)
committer
Radek Czajka
<rczajka@rczajka.pl>
Tue, 10 Jan 2023 14:40:13 +0000
(15:40 +0100)
requirements/requirements.txt
patch
|
blob
|
history
src/catalogue/templates/catalogue/book_text.html
patch
|
blob
|
history
src/catalogue/templatetags/catalogue_tags.py
patch
|
blob
|
history
src/education/models.py
patch
|
blob
|
history
src/search/index.py
patch
|
blob
|
history
src/wolnelektury/settings/apps.py
patch
|
blob
|
history
diff --git
a/requirements/requirements.txt
b/requirements/requirements.txt
index
2dec1cc
..
c78c3f5
100644
(file)
--- a/
requirements/requirements.txt
+++ b/
requirements/requirements.txt
@@
-40,7
+40,7
@@
mutagen==1.45.1
sorl-thumbnail==12.8.0
# home-brewed & dependencies
sorl-thumbnail==12.8.0
# home-brewed & dependencies
-librarian==2.4.
1
+librarian==2.4.
9
# celery tasks
celery[redis]==5.2.7
# celery tasks
celery[redis]==5.2.7
diff --git
a/src/catalogue/templates/catalogue/book_text.html
b/src/catalogue/templates/catalogue/book_text.html
index
9d28bd7
..
78067d7
100644
(file)
--- a/
src/catalogue/templates/catalogue/book_text.html
+++ b/
src/catalogue/templates/catalogue/book_text.html
@@
-198,9
+198,10
@@
"label": "{{ ref.entity.label }}",
"description": "{{ ref.entity.description }}",
"wikipedia_link": "{{ ref.entity.wikipedia_link }}"
"label": "{{ ref.entity.label }}",
"description": "{{ ref.entity.description }}",
"wikipedia_link": "{{ ref.entity.wikipedia_link }}"
- }
{% if not forloop.last %},{% endif %}
+ }
,
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
+ "": null
}
</script>
{% endlocalize %}
}
</script>
{% endlocalize %}
diff --git
a/src/catalogue/templatetags/catalogue_tags.py
b/src/catalogue/templatetags/catalogue_tags.py
index
6ee1777
..
1d5cee0
100644
(file)
--- a/
src/catalogue/templatetags/catalogue_tags.py
+++ b/
src/catalogue/templatetags/catalogue_tags.py
@@
-106,7
+106,7
@@
def nice_title_from_tags(tags, related_tags):
# No info on genre, but there's only one kind related.
subpieces = []
pieces.append([
# No info on genre, but there's only one kind related.
subpieces = []
pieces.append([
- t.collective_noun or t.name for t in
self
['kind']
+ t.collective_noun or t.name for t in
related_tags
['kind']
])
plural = False
else:
])
plural = False
else:
diff --git
a/src/education/models.py
b/src/education/models.py
index
5d11004
..
33064a1
100644
(file)
--- a/
src/education/models.py
+++ b/
src/education/models.py
@@
-49,15
+49,18
@@
class YPlaylist(models.Model):
super().save()
self.download()
super().save()
self.download()
- def download(self):
- response = YouTubeToken.objects.first().call(
- "GET",
- "https://www.googleapis.com/youtube/v3/playlistItems",
- params={
+ def download(self, page_token=None):
+ params = {
'part': 'snippet',
'playlistId': self.youtube_id,
'maxResults': 50,
'part': 'snippet',
'playlistId': self.youtube_id,
'maxResults': 50,
- },
+ }
+ if page_token:
+ params['pageToken'] = page_token
+ response = YouTubeToken.objects.first().call(
+ "GET",
+ "https://www.googleapis.com/youtube/v3/playlistItems",
+ params=params
)
data = response.json()
for item in data['items']:
)
data = response.json()
for item in data['items']:
@@
-68,6
+71,8
@@
class YPlaylist(models.Model):
'order': item['snippet']['position'],
}
)
'order': item['snippet']['position'],
}
)
+ if data.get('nextPageToken'):
+ self.download(page_token=data['nextPageToken'])
diff --git
a/src/search/index.py
b/src/search/index.py
index
2be60fd
..
68a2b3b
100644
(file)
--- a/
src/search/index.py
+++ b/
src/search/index.py
@@
-9,6
+9,9
@@
import os
import re
from django.conf import settings
from librarian import dcparser
import re
from django.conf import settings
from librarian import dcparser
+import librarian.meta.types.date
+import librarian.meta.types.person
+import librarian.meta.types.text
from librarian.parser import WLDocument
from lxml import etree
import scorched
from librarian.parser import WLDocument
from lxml import etree
import scorched
@@
-318,21
+321,20
@@
class Index(SolrIndex):
if hasattr(book_info, field.name):
if not getattr(book_info, field.name):
continue
if hasattr(book_info, field.name):
if not getattr(book_info, field.name):
continue
- # since no type information is available, we use validator
- type_indicator = field.validator
- if type_indicator == dcparser.as_unicode:
+ type_indicator = field.value_type
+ if issubclass(type_indicator, librarian.meta.types.text.TextValue):
s = getattr(book_info, field.name)
if field.multiple:
s = ', '.join(s)
fields[field.name] = s
s = getattr(book_info, field.name)
if field.multiple:
s = ', '.join(s)
fields[field.name] = s
- elif
type_indicator == dcparser.as_person
:
+ elif
issubclass(type_indicator, librarian.meta.types.person.Person)
:
p = getattr(book_info, field.name)
p = getattr(book_info, field.name)
- if isinstance(p,
dcparser
.Person):
+ if isinstance(p,
librarian.meta.types.person
.Person):
persons = str(p)
else:
persons = ', '.join(map(str, p))
fields[field.name] = persons
persons = str(p)
else:
persons = ', '.join(map(str, p))
fields[field.name] = persons
- elif
type_indicator == dcparser.as_date
:
+ elif
issubclass(type_indicator, librarian.meta.types.date.DateValue)
:
dt = getattr(book_info, field.name)
fields[field.name] = dt
dt = getattr(book_info, field.name)
fields[field.name] = dt
diff --git
a/src/wolnelektury/settings/apps.py
b/src/wolnelektury/settings/apps.py
index
ad0ff15
..
fe42e04
100644
(file)
--- a/
src/wolnelektury/settings/apps.py
+++ b/
src/wolnelektury/settings/apps.py
@@
-11,6
+11,7
@@
INSTALLED_APPS_OUR = [
'catalogue',
'chunks',
'dictionary',
'catalogue',
'chunks',
'dictionary',
+ 'education',
'experiments',
'infopages',
'lesmianator',
'experiments',
'infopages',
'lesmianator',