django-restit 4.2.131__py3-none-any.whl → 4.2.133__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- {django_restit-4.2.131.dist-info → django_restit-4.2.133.dist-info}/METADATA +1 -1
- {django_restit-4.2.131.dist-info → django_restit-4.2.133.dist-info}/RECORD +9 -8
- medialib/migrations/0002_alter_mediaitemrendition_bytes.py +18 -0
- medialib/models.py +32 -3
- medialib/render/render_utils.py +1 -1
- rest/__init__.py +1 -1
- wiki/renderers/mistune/media.py +3 -0
- {django_restit-4.2.131.dist-info → django_restit-4.2.133.dist-info}/LICENSE.md +0 -0
- {django_restit-4.2.131.dist-info → django_restit-4.2.133.dist-info}/WHEEL +0 -0
@@ -172,8 +172,9 @@ medialib/fixtures/medialib.json,sha256=Q2-30qjHI6gfHIT-8qsz8_WjL_ldrWIUIOKmJR9eJ
|
|
172
172
|
medialib/fixtures/medialib_test_fixture.json,sha256=7M7zvGI2S5G3ENV8OQ3Ks4149lEiQ-bjH3nCFLwwRFo,16989
|
173
173
|
medialib/forms.py,sha256=nrE6QTPNPiIeX7Nx4l9DEmAQeQXqFyCg1C3JEDBYJfE,5442
|
174
174
|
medialib/migrations/0001_initial.py,sha256=H3JliH5aw7tiHef8MhrJr_9rGetqgA7UjTF-eKziRSM,20518
|
175
|
+
medialib/migrations/0002_alter_mediaitemrendition_bytes.py,sha256=igC1R02smbNoWlk2T4uCi9cNilOsxGKD-D24fQv92dM,414
|
175
176
|
medialib/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
176
|
-
medialib/models.py,sha256=
|
177
|
+
medialib/models.py,sha256=eTfUiYrazCHMGcyBg9fPCRxx_NMOaM_MTb7vuUOymgc,54794
|
177
178
|
medialib/ocr.py,sha256=zlP7-NBiXhW7jR9pljmEPl5xzLVZpLN5QLAELQgU0Fk,1189
|
178
179
|
medialib/pdf.py,sha256=l28WwM0JKbT9boV-b_9TFh9jhvGcrquR8GqC8wfEaLk,1275
|
179
180
|
medialib/qrcode.py,sha256=vHyA5egXOX70EFiUDgr1njI9zcF6bXQJ_hKAQrppRow,545
|
@@ -205,7 +206,7 @@ medialib/render/presets/video_still.py,sha256=VSWtr6k3UJta3YdOpEfU9d7p46XKi98aPt
|
|
205
206
|
medialib/render/presets/video_validate.py,sha256=pC6MzzgVWZKGJj6NkQ8SHcDj8z45kxHMuwxK82f8vIU,3228
|
206
207
|
medialib/render/presets/websnap.py,sha256=RSxJ7T2ICU_KQn48yHWLj4qXCABTC7uVIPwe-z_CSkI,863
|
207
208
|
medialib/render/presets/youtube.py,sha256=M4bTZju1u7rrvwLOG89cNUaelHUtnRFss7hggvZCAuE,2282
|
208
|
-
medialib/render/render_utils.py,sha256=
|
209
|
+
medialib/render/render_utils.py,sha256=kJlluBmkXoABQqZ6cJFQ3u07cl5ela-Gvu6w96hd6uA,16460
|
209
210
|
medialib/render/schedule.py,sha256=iDSekfsY31SEXF-MR-YdJ9-a3UJ3SoJsZJpiEcbiNZA,370
|
210
211
|
medialib/rpc/__init__.py,sha256=K84yMB6sUr7zTeECxca-_2jyHiUGCHTM-XYmJK6jQCo,82
|
211
212
|
medialib/rpc/legacy.py,sha256=KTNmNJIxfFkZfAj0LXx9-e8bJonOfCoNE0-c_cugsNc,37925
|
@@ -376,7 +377,7 @@ pushit/utils.py,sha256=IeTCGa-164nmB1jIsK1lu1O1QzUhS3BKfuXHGjCW-ck,2121
|
|
376
377
|
rest/.gitignore,sha256=TbEvWRMnAiajCTOdhiNrd9eeCAaIjRp9PRjE_VkMM5g,118
|
377
378
|
rest/README.md,sha256=V3ETc-cJu8PZIbKr9xSe_pA4JEUpC8Dhw4bQeVCDJPw,5460
|
378
379
|
rest/RemoteEvents.py,sha256=nL46U7AuxIrlw2JunphR1tsXyqi-ep_gD9CYGpYbNgE,72
|
379
|
-
rest/__init__.py,sha256=
|
380
|
+
rest/__init__.py,sha256=UcJ4qn_3ls-tLEam46gewXaZeqzOJZ2DjbFhQy7G1j4,122
|
380
381
|
rest/arc4.py,sha256=y644IbF1ec--e4cUJ3KEYsewTCITK0gmlwa5mJruFC0,1967
|
381
382
|
rest/cache.py,sha256=1Qg0rkaCJCaVP0-l5hZg2CIblTdeBSlj_0fP6vlKUpU,83
|
382
383
|
rest/crypto/__init__.py,sha256=Tl0U11rgj1eBYqd6OXJ2_XSdNLumW_JkBZnaJqI6Ldw,72
|
@@ -492,7 +493,7 @@ wiki/renderers/__init__.py,sha256=lLEoJvjU3ezXwBGcjleKk_kMyNeMD9MpfBlEiKayEiM,46
|
|
492
493
|
wiki/renderers/mistune/__init__.py,sha256=baClLWELOwy5n8UUFi7qmoFBU6QaeegD-wRNZ7fIW_w,84
|
493
494
|
wiki/renderers/mistune/highlight.py,sha256=BosglMQUxc_KVbLapQ4gCt6rCc0rAF1vCtUR7R1Ad4c,1264
|
494
495
|
wiki/renderers/mistune/math.py,sha256=dgQpH9CIDiqyESphoK5XUVFxK5Yb5VhEIoLgjp3Vtcs,1901
|
495
|
-
wiki/renderers/mistune/media.py,sha256=
|
496
|
+
wiki/renderers/mistune/media.py,sha256=SYwjhX6_DKfqJ00yLxfKrIHu6JnnwKnroqRm6ySDMfY,2688
|
496
497
|
wiki/renderers/mistune/meta.py,sha256=1lry9m-4wiwsivWnqYHYjwmGv91BGUSB7niJuZ1Xx54,805
|
497
498
|
wiki/renderers/mistune/task_list.py,sha256=Ex0gUPX_d9jtbPbnEEktlqAJsM6wIt5Md2wsltX7LIY,1889
|
498
499
|
wiki/renderers/mistune/toc.py,sha256=TKGiuMVpKqzDGUx5bAjJYpZIzG6n3wTjtuBdBc-TM_8,2302
|
@@ -512,7 +513,7 @@ ws4redis/servers/uwsgi.py,sha256=VyhoCI1DnVFqBiJYHoxqn5Idlf6uJPHvfBKgkjs34mo,172
|
|
512
513
|
ws4redis/settings.py,sha256=K0yBiLUuY81iDM4Yr-k8hbvjn5VVHu5zQhmMK8Dtz0s,1536
|
513
514
|
ws4redis/utf8validator.py,sha256=S0OlfjeGRP75aO6CzZsF4oTjRQAgR17OWE9rgZdMBZA,5122
|
514
515
|
ws4redis/websocket.py,sha256=R0TUyPsoVRD7Y_oU7w2I6NL4fPwiz5Vl94-fUkZgLHA,14848
|
515
|
-
django_restit-4.2.
|
516
|
-
django_restit-4.2.
|
517
|
-
django_restit-4.2.
|
518
|
-
django_restit-4.2.
|
516
|
+
django_restit-4.2.133.dist-info/LICENSE.md,sha256=VHN4hhEeVOoFjtG-5fVv4jesA4SWi0Z-KgOzzN6a1ps,1068
|
517
|
+
django_restit-4.2.133.dist-info/METADATA,sha256=jMlQpj_jltlJ8hSiJoNQ5YmPrGumAhVk0L2nBVMi54s,7663
|
518
|
+
django_restit-4.2.133.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
519
|
+
django_restit-4.2.133.dist-info/RECORD,,
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# Generated by Django 4.1.5 on 2024-08-14 19:20
|
2
|
+
|
3
|
+
from django.db import migrations, models
|
4
|
+
|
5
|
+
|
6
|
+
class Migration(migrations.Migration):
|
7
|
+
|
8
|
+
dependencies = [
|
9
|
+
('medialib', '0001_initial'),
|
10
|
+
]
|
11
|
+
|
12
|
+
operations = [
|
13
|
+
migrations.AlterField(
|
14
|
+
model_name='mediaitemrendition',
|
15
|
+
name='bytes',
|
16
|
+
field=models.BigIntegerField(help_text='Size of rendition file'),
|
17
|
+
),
|
18
|
+
]
|
medialib/models.py
CHANGED
@@ -20,6 +20,7 @@ import hashlib
|
|
20
20
|
import time
|
21
21
|
import mimetypes
|
22
22
|
import tempfile
|
23
|
+
import re
|
23
24
|
|
24
25
|
from medialib import utils
|
25
26
|
from rest import settings
|
@@ -29,6 +30,7 @@ from rest.decorators import rest_async
|
|
29
30
|
from taskqueue.models import Task
|
30
31
|
|
31
32
|
|
33
|
+
MEDIA_FRIENDLY_FILENAMES = settings.get("MEDIA_FRIENDLY_FILENAMES", True)
|
32
34
|
TASKQUEUE_RENDERING = settings.get("TASKQUEUE_RENDERING", False)
|
33
35
|
|
34
36
|
from rest.log import getLogger
|
@@ -1118,7 +1120,7 @@ class MediaItemRendition(models.Model):
|
|
1118
1120
|
created = models.DateTimeField(auto_now_add=True, editable=False, help_text="When item was created")
|
1119
1121
|
width = models.IntegerField(null=True, help_text="Width (if available)")
|
1120
1122
|
height = models.IntegerField(null=True, help_text="Height (if available)")
|
1121
|
-
bytes = models.
|
1123
|
+
bytes = models.BigIntegerField(help_text="Size of rendition file")
|
1122
1124
|
kind = models.CharField(max_length=1, choices=RenditionKinds, help_text="Kind of rendition")
|
1123
1125
|
is_original = models.BooleanField(default=False, help_text="Whether is original of kind")
|
1124
1126
|
|
@@ -1155,9 +1157,36 @@ class MediaItemRendition(models.Model):
|
|
1155
1157
|
from medialib.stores import s3
|
1156
1158
|
return s3.generate_upload_url(self.url, filetype)
|
1157
1159
|
|
1158
|
-
def
|
1160
|
+
def generateFriendlyURL(self, name, prefix="", store=None):
|
1161
|
+
from rest import helpers as rh
|
1162
|
+
rh.log_error("generateFriendlyURL", name, self.use, self.mediaitem.name, " ")
|
1159
1163
|
if store is None:
|
1160
1164
|
store = self.mediaitem.default_store()
|
1165
|
+
if self.use != "original":
|
1166
|
+
if "." in self.mediaitem.name:
|
1167
|
+
orig_name = self.mediaitem.name.split('.')
|
1168
|
+
orig_ext = orig_name.pop()
|
1169
|
+
orig_name = "".join(orig_name)
|
1170
|
+
if "." in name:
|
1171
|
+
ext = name.split('.')[-1]
|
1172
|
+
else:
|
1173
|
+
ext = orig_ext
|
1174
|
+
name = f"{orig_name}__{self.name}.{ext}"
|
1175
|
+
rh.log_error("--- now ---", name, " ")
|
1176
|
+
name = name.replace(" ", "_")
|
1177
|
+
name = re.sub(r'[^A-Za-z0-9._-]', '', name)
|
1178
|
+
paths = []
|
1179
|
+
paths.append(store)
|
1180
|
+
paths.append("/")
|
1181
|
+
paths.append(int_to_base36(self.mediaitem.pk))
|
1182
|
+
paths.append("/")
|
1183
|
+
paths.append(name)
|
1184
|
+
return "".join(paths)
|
1185
|
+
|
1186
|
+
def generateURL(self, name, prefix="", store=None):
|
1187
|
+
if MEDIA_FRIENDLY_FILENAMES:
|
1188
|
+
return self.generateFriendlyURL(name, prefix, store)
|
1189
|
+
|
1161
1190
|
paths = []
|
1162
1191
|
paths.append(store)
|
1163
1192
|
paths.append("/{}/".format(int_to_base36(self.mediaitem.pk)))
|
@@ -1169,7 +1198,7 @@ class MediaItemRendition(models.Model):
|
|
1169
1198
|
paths.append("_")
|
1170
1199
|
paths.append(utils.toMD5(path, int(time.time())))
|
1171
1200
|
paths.append(".")
|
1172
|
-
ext = "
|
1201
|
+
ext = "dat"
|
1173
1202
|
if "." in name:
|
1174
1203
|
ext = name.split('.')[-1]
|
1175
1204
|
elif hasattr(self.mediaitem, "ext"):
|
medialib/render/render_utils.py
CHANGED
rest/__init__.py
CHANGED
wiki/renderers/mistune/media.py
CHANGED
@@ -38,6 +38,7 @@ class MediaMixin(object):
|
|
38
38
|
return url
|
39
39
|
|
40
40
|
def link(self, link, text=None, title=None):
|
41
|
+
label = text
|
41
42
|
if text is None:
|
42
43
|
text = link
|
43
44
|
o = urllib.parse.urlparse(link)
|
@@ -47,6 +48,8 @@ class MediaMixin(object):
|
|
47
48
|
params = {"href":href}
|
48
49
|
if title:
|
49
50
|
params["title"] = title
|
51
|
+
if label:
|
52
|
+
params["download"] = label
|
50
53
|
if not href.startswith("http"):
|
51
54
|
params["data-action"] = "local_page"
|
52
55
|
flat_params = ' '.join("{}='{}'".format(key,val) for (key,val) in list(params.items()))
|
File without changes
|
File without changes
|