diff --git a/mumbleBot.py b/mumbleBot.py index c7519e5..fb533c6 100644 --- a/mumbleBot.py +++ b/mumbleBot.py @@ -282,7 +282,7 @@ class MumbleBot: else: ffmpeg_debug = "warning" - command = ["/usr/bin/ffmpeg", '-v', ffmpeg_debug, '-nostdin', '-i', path, '-ac', '1', '-f', 's16le', '-ar', '48000', '-'] + command = ["ffmpeg", '-v', ffmpeg_debug, '-nostdin', '-i', path, '-ac', '1', '-f', 's16le', '-ar', '48000', '-'] self.thread = sp.Popen(command, stdout=sp.PIPE, bufsize=480) var.current_music[2] = title var.current_music[3] = path diff --git a/util.py b/util.py index 1c4d4ed..b979f41 100644 --- a/util.py +++ b/util.py @@ -6,6 +6,7 @@ import os import variables as var import zipfile + def get_recursive_filelist_sorted(path): filelist = [] for root, dirs, files in os.walk(path): @@ -19,6 +20,10 @@ def get_recursive_filelist_sorted(path): continue fullpath = os.path.join(path, relroot, file) + if not os.access(fullpath, os.R_OK): + print("coucou") + continue + 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) @@ -26,6 +31,7 @@ def get_recursive_filelist_sorted(path): filelist.sort() return filelist + # - zips all files of the given zippath (must be a directory) # - returns the absolute path of the created zip file # - zip file will be in the applications tmp folder (according to configuration) @@ -56,6 +62,7 @@ def zipdir(zippath, zipname_prefix=None): zipf.close() return zipname + class Dir(object): def __init__(self, path): self.name = os.path.basename(path.strip('/')) @@ -103,7 +110,7 @@ class Dir(object): subdirs = list(self.subdirs.keys()) for key, val in self.subdirs.items(): - subdirs.extend(map(lambda subdir: key + '/' + subdir,val.get_subdirs_recursively())) + subdirs.extend(map(lambda subdir: key + '/' + subdir, val.get_subdirs_recursively())) subdirs.sort() return subdirs @@ -131,13 +138,13 @@ class Dir(object): files = self.files for key, val in self.subdirs.items(): - files.extend(map(lambda file: key + '/' + file,val.get_files_recursively())) + files.extend(map(lambda file: key + '/' + file, val.get_files_recursively())) return files def render_text(self, ident=0): print('{}{}/'.format(' ' * (ident * 4), self.name)) for key, val in self.subdirs.items(): - val.render_text(ident+1) + val.render_text(ident + 1) for file in self.files: print('{}{}'.format(' ' * ((ident + 1)) * 4, file))