mirror of https://gitlab.com/bashrc2/epicyon
Tidying
parent
06f324b7d6
commit
ca43402bed
|
@ -840,6 +840,20 @@ def _isAttachedImage(attachmentFilename: str) -> bool:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def _isAttachedVideo(attachmentFilename: str) -> bool:
|
||||||
|
"""Is the given attachment filename a video?
|
||||||
|
"""
|
||||||
|
if '.' not in attachmentFilename:
|
||||||
|
return False
|
||||||
|
videoExt = (
|
||||||
|
'mp4', 'webm', 'ogv'
|
||||||
|
)
|
||||||
|
ext = attachmentFilename.split('.')[-1]
|
||||||
|
if ext in videoExt:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def getPostAttachmentsAsHtml(postJsonObject: {}, boxName: str, translate: {},
|
def getPostAttachmentsAsHtml(postJsonObject: {}, boxName: str, translate: {},
|
||||||
isMuted: bool, avatarLink: str,
|
isMuted: bool, avatarLink: str,
|
||||||
replyStr: str, announceStr: str, likeStr: str,
|
replyStr: str, announceStr: str, likeStr: str,
|
||||||
|
@ -907,12 +921,8 @@ def getPostAttachmentsAsHtml(postJsonObject: {}, boxName: str, translate: {},
|
||||||
imageDescription + '" class="attachment"></a>\n'
|
imageDescription + '" class="attachment"></a>\n'
|
||||||
attachmentCtr += 1
|
attachmentCtr += 1
|
||||||
elif _isVideoMimeType(mediaType):
|
elif _isVideoMimeType(mediaType):
|
||||||
extension = '.mp4'
|
if _isAttachedVideo(attach['url']):
|
||||||
if attach['url'].endswith('.webm'):
|
extension = attach['url'].split('.')[-1]
|
||||||
extension = '.webm'
|
|
||||||
elif attach['url'].endswith('.ogv'):
|
|
||||||
extension = '.ogv'
|
|
||||||
if attach['url'].endswith(extension):
|
|
||||||
if attachmentCtr > 0:
|
if attachmentCtr > 0:
|
||||||
attachmentStr += '<br>'
|
attachmentStr += '<br>'
|
||||||
if boxName == 'tlmedia':
|
if boxName == 'tlmedia':
|
||||||
|
@ -926,7 +936,7 @@ def getPostAttachmentsAsHtml(postJsonObject: {}, boxName: str, translate: {},
|
||||||
'" alt="' + imageDescription + \
|
'" alt="' + imageDescription + \
|
||||||
'" title="' + imageDescription + \
|
'" title="' + imageDescription + \
|
||||||
'" class="attachment" type="video/' + \
|
'" class="attachment" type="video/' + \
|
||||||
extension.replace('.', '') + '">'
|
extension + '">'
|
||||||
idx = 'Your browser does not support the video tag.'
|
idx = 'Your browser does not support the video tag.'
|
||||||
galleryStr += translate[idx]
|
galleryStr += translate[idx]
|
||||||
galleryStr += ' </video>\n'
|
galleryStr += ' </video>\n'
|
||||||
|
@ -960,7 +970,7 @@ def getPostAttachmentsAsHtml(postJsonObject: {}, boxName: str, translate: {},
|
||||||
'<source src="' + attach['url'] + '" alt="' + \
|
'<source src="' + attach['url'] + '" alt="' + \
|
||||||
imageDescription + '" title="' + imageDescription + \
|
imageDescription + '" title="' + imageDescription + \
|
||||||
'" class="attachment" type="video/' + \
|
'" class="attachment" type="video/' + \
|
||||||
extension.replace('.', '') + '">'
|
extension + '">'
|
||||||
attachmentStr += \
|
attachmentStr += \
|
||||||
translate['Your browser does not support the video tag.']
|
translate['Your browser does not support the video tag.']
|
||||||
attachmentStr += '</video></center>'
|
attachmentStr += '</video></center>'
|
||||||
|
|
Loading…
Reference in New Issue