Ignore non-audio/video files
This commit is contained in:
parent
f45aa6c712
commit
adfdb6f06c
@ -2,3 +2,4 @@ opuslib==1.1.0
|
|||||||
protobuf==3.1.0
|
protobuf==3.1.0
|
||||||
flask
|
flask
|
||||||
youtube-dl
|
youtube-dl
|
||||||
|
python-magic
|
||||||
|
5
util.py
5
util.py
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import configparser
|
import configparser
|
||||||
import hashlib
|
import hashlib
|
||||||
|
import magic
|
||||||
import os
|
import os
|
||||||
import variables as var
|
import variables as var
|
||||||
import zipfile
|
import zipfile
|
||||||
@ -20,6 +21,10 @@ def get_recursive_filelist_sorted(path):
|
|||||||
for file in files:
|
for file in files:
|
||||||
if file in __CONFIG.get('bot', 'ignored_files'):
|
if file in __CONFIG.get('bot', 'ignored_files'):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
fullpath = os.path.join(path, relroot, file)
|
||||||
|
mime = magic.from_file(fullpath, mime=True)
|
||||||
|
if 'audio' in mime or 'audio' in magic.from_file(fullpath).lower() or 'video' in mime:
|
||||||
filelist.append(relroot + file)
|
filelist.append(relroot + file)
|
||||||
|
|
||||||
filelist.sort()
|
filelist.sort()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user