mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
3e69d8f5ea
commit
47e648e516
6
media.py
6
media.py
|
|
@ -20,7 +20,7 @@ from utils import get_full_domain
|
||||||
from utils import get_image_extensions
|
from utils import get_image_extensions
|
||||||
from utils import get_video_extensions
|
from utils import get_video_extensions
|
||||||
from utils import get_audio_extensions
|
from utils import get_audio_extensions
|
||||||
from utils import getMediaExtensions
|
from utils import get_media_extensions
|
||||||
from utils import has_object_dict
|
from utils import has_object_dict
|
||||||
from utils import acct_dir
|
from utils import acct_dir
|
||||||
from shutil import copyfile
|
from shutil import copyfile
|
||||||
|
|
@ -220,7 +220,7 @@ def _isMedia(imageFilename: str) -> bool:
|
||||||
if not os.path.isfile(imageFilename):
|
if not os.path.isfile(imageFilename):
|
||||||
print('WARN: Media file does not exist ' + imageFilename)
|
print('WARN: Media file does not exist ' + imageFilename)
|
||||||
return False
|
return False
|
||||||
permittedMedia = getMediaExtensions()
|
permittedMedia = get_media_extensions()
|
||||||
for m in permittedMedia:
|
for m in permittedMedia:
|
||||||
if imageFilename.endswith('.' + m):
|
if imageFilename.endswith('.' + m):
|
||||||
return True
|
return True
|
||||||
|
|
@ -306,7 +306,7 @@ def attachMedia(base_dir: str, http_prefix: str,
|
||||||
return postJson
|
return postJson
|
||||||
|
|
||||||
fileExtension = None
|
fileExtension = None
|
||||||
acceptedTypes = getMediaExtensions()
|
acceptedTypes = get_media_extensions()
|
||||||
for mType in acceptedTypes:
|
for mType in acceptedTypes:
|
||||||
if imageFilename.endswith('.' + mType):
|
if imageFilename.endswith('.' + mType):
|
||||||
if mType == 'jpg':
|
if mType == 'jpg':
|
||||||
|
|
|
||||||
4
utils.py
4
utils.py
|
|
@ -396,7 +396,7 @@ def getImageExtensionFromMimeType(contentType: str) -> str:
|
||||||
return 'png'
|
return 'png'
|
||||||
|
|
||||||
|
|
||||||
def getMediaExtensions() -> []:
|
def get_media_extensions() -> []:
|
||||||
"""Returns a list of the possible media file extensions
|
"""Returns a list of the possible media file extensions
|
||||||
"""
|
"""
|
||||||
return get_image_extensions() + \
|
return get_image_extensions() + \
|
||||||
|
|
@ -430,7 +430,7 @@ def getMediaFormats() -> str:
|
||||||
"""Returns a string of permissable media formats
|
"""Returns a string of permissable media formats
|
||||||
used when selecting an attachment for a new post
|
used when selecting an attachment for a new post
|
||||||
"""
|
"""
|
||||||
mediaExt = getMediaExtensions()
|
mediaExt = get_media_extensions()
|
||||||
|
|
||||||
mediaFormats = ''
|
mediaFormats = ''
|
||||||
for ext in mediaExt:
|
for ext in mediaExt:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue