-
Notifications
You must be signed in to change notification settings - Fork 5
/
listFiles.py
71 lines (61 loc) · 2.81 KB
/
listFiles.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
""" _ _____ _ _
| | /\ / ____| | (_)
_ __ | | / \ | | __ _ _ _ __| |_ ___
| '_ \| | / /\ \| | / _` | | | |/ _` | |/ _ \
| |_) | |____ / ____ \ |___| (_| | |_| | (_| | | (_) |
| .__/|______/_/ \_\_____\__,_|\__,_|\__,_|_|\___/
| |
|_|
This file is part of pLAC-audio.
pLAC-audio is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
pLAC-audio is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pLAC-audio. If not, see <http://www.gnu.org/licenses/>
Copyright (c) 2019 Fabrice Zaoui
License GNU GPL v3
"""
import glob
import logging
from PyQt5.QtWidgets import QMessageBox
def listofFiles(self):
self.audio_files = []
ext = 'm4a'
audio_alac = glob.glob(self.lossless_folder + '/**/*.' + ext, recursive=True)
ext = 'flac'
audio_flac = glob.glob(self.lossless_folder + '/**/*.' + ext, recursive=True)
ext = 'dsf'
audio_dsf = glob.glob(self.lossless_folder + '/**/*.' + ext, recursive=True)
ext = 'ape'
audio_ape = glob.glob(self.lossless_folder + '/**/*.' + ext, recursive=True)
ext = 'wav'
audio_wav = glob.glob(self.lossless_folder + '/**/*.' + ext, recursive=True)
ext = 'aif'
audio_aiff1 = glob.glob(self.lossless_folder + '/**/*.' + ext, recursive=True)
ext = 'aiff'
audio_aiff2 = glob.glob(self.lossless_folder + '/**/*.' + ext, recursive=True)
audio_aiff = audio_aiff1 + audio_aiff2
self.audio_files = audio_alac + audio_flac + audio_dsf + audio_ape + audio_wav + audio_aiff
if len(self.audio_files) == 0:
logging.error('No files found!')
QMessageBox.warning(self, 'Warning', 'No lossless files found!')
return
else:
logging.info('Number of ALAC files: ' + str(len(audio_alac)))
logging.info('Number of FLAC files: ' + str(len(audio_flac)))
logging.info('Number of DSF files: ' + str(len(audio_dsf)))
logging.info('Number of APE files: ' + str(len(audio_ape)))
logging.info('Number of WAV files: ' + str(len(audio_wav)))
logging.info('Number of AIFF files: ' + str(len(audio_aiff)))
logging.info('Total number of files: ' + str(len(self.audio_files)))
self.progress.setMinimum(0)
self.progress.setMaximum(len(self.audio_files) - 1)
self.progress.setValue(0)
self.lcd_count.display(len(self.audio_files))
self.nm1 = len(self.audio_files)
self.n0 = len(self.audio_files)