mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
f25d6f9203
commit
544f94b306
4
media.py
4
media.py
|
@ -18,7 +18,7 @@ from auth import createPassword
|
|||
from utils import get_base_content_from_post
|
||||
from utils import get_full_domain
|
||||
from utils import getImageExtensions
|
||||
from utils import getVideoExtensions
|
||||
from utils import get_video_extensions
|
||||
from utils import getAudioExtensions
|
||||
from utils import getMediaExtensions
|
||||
from utils import has_object_dict
|
||||
|
@ -250,7 +250,7 @@ def getAttachmentMediaType(filename: str) -> str:
|
|||
for mType in imageTypes:
|
||||
if filename.endswith('.' + mType):
|
||||
return 'image'
|
||||
videoTypes = getVideoExtensions()
|
||||
videoTypes = get_video_extensions()
|
||||
for mType in videoTypes:
|
||||
if filename.endswith('.' + mType):
|
||||
return 'video'
|
||||
|
|
10
utils.py
10
utils.py
|
@ -317,9 +317,9 @@ def is_editor(base_dir: str, nickname: str) -> bool:
|
|||
def is_artist(base_dir: str, nickname: str) -> bool:
|
||||
"""Returns true if the given nickname is an artist
|
||||
"""
|
||||
artistsFile = base_dir + '/accounts/artists.txt'
|
||||
artists_file = base_dir + '/accounts/artists.txt'
|
||||
|
||||
if not os.path.isfile(artistsFile):
|
||||
if not os.path.isfile(artists_file):
|
||||
admin_name = get_config_param(base_dir, 'admin')
|
||||
if not admin_name:
|
||||
return False
|
||||
|
@ -327,7 +327,7 @@ def is_artist(base_dir: str, nickname: str) -> bool:
|
|||
return True
|
||||
return False
|
||||
|
||||
with open(artistsFile, 'r') as f:
|
||||
with open(artists_file, 'r') as f:
|
||||
lines = f.readlines()
|
||||
if len(lines) == 0:
|
||||
admin_name = get_config_param(base_dir, 'admin')
|
||||
|
@ -342,7 +342,7 @@ def is_artist(base_dir: str, nickname: str) -> bool:
|
|||
return False
|
||||
|
||||
|
||||
def getVideoExtensions() -> []:
|
||||
def get_video_extensions() -> []:
|
||||
"""Returns a list of the possible video file extensions
|
||||
"""
|
||||
return ('mp4', 'webm', 'ogv')
|
||||
|
@ -399,7 +399,7 @@ def getImageExtensionFromMimeType(contentType: str) -> str:
|
|||
def getMediaExtensions() -> []:
|
||||
"""Returns a list of the possible media file extensions
|
||||
"""
|
||||
return getImageExtensions() + getVideoExtensions() + getAudioExtensions()
|
||||
return getImageExtensions() + get_video_extensions() + getAudioExtensions()
|
||||
|
||||
|
||||
def getImageFormats() -> str:
|
||||
|
|
|
@ -21,7 +21,7 @@ from utils import acct_dir
|
|||
from utils import getNicknameFromActor
|
||||
from utils import isfloat
|
||||
from utils import getAudioExtensions
|
||||
from utils import getVideoExtensions
|
||||
from utils import get_video_extensions
|
||||
from utils import getImageExtensions
|
||||
from utils import local_actor_url
|
||||
from cache import storePersonInCache
|
||||
|
@ -955,7 +955,7 @@ def _isVideoMimeType(mimeType: str) -> bool:
|
|||
"""
|
||||
if not mimeType.startswith('video/'):
|
||||
return False
|
||||
extensions = getVideoExtensions()
|
||||
extensions = get_video_extensions()
|
||||
ext = mimeType.split('/')[1]
|
||||
if ext in extensions:
|
||||
return True
|
||||
|
|
Loading…
Reference in New Issue