load folder in class
This commit is contained in:
parent
ba037e0c85
commit
dcba17e5ca
29
ffplayout.py
29
ffplayout.py
@ -798,14 +798,21 @@ class MediaStore:
|
|||||||
MediaWatch will interact with add and remove
|
MediaWatch will interact with add and remove
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, extensions):
|
def __init__(self):
|
||||||
self._extensions = extensions
|
|
||||||
self.store = []
|
self.store = []
|
||||||
|
|
||||||
def fill(self, folder):
|
if stdin_args.folder:
|
||||||
for ext in self._extensions:
|
self.folder = stdin_args.folder
|
||||||
|
else:
|
||||||
|
self.folder = _storage.path
|
||||||
|
|
||||||
|
self.fill()
|
||||||
|
|
||||||
|
def fill(self):
|
||||||
|
for ext in _storage.extensions:
|
||||||
self.store.extend(
|
self.store.extend(
|
||||||
glob.glob(os.path.join(folder, '**', ext), recursive=True))
|
glob.glob(os.path.join(self.folder, '**', ext),
|
||||||
|
recursive=True))
|
||||||
|
|
||||||
self.sort()
|
self.sort()
|
||||||
|
|
||||||
@ -1306,16 +1313,8 @@ def main():
|
|||||||
get_source = GetSourceIter(encoder)
|
get_source = GetSourceIter(encoder)
|
||||||
else:
|
else:
|
||||||
logger.info("start folder mode")
|
logger.info("start folder mode")
|
||||||
media = MediaStore(_storage.extensions)
|
media = MediaStore()
|
||||||
|
watcher = MediaWatcher(media.folder, _storage.extensions, media)
|
||||||
if stdin_args.folder:
|
|
||||||
folder = stdin_args.folder
|
|
||||||
else:
|
|
||||||
folder = _storage.path
|
|
||||||
|
|
||||||
media.fill(folder)
|
|
||||||
|
|
||||||
watcher = MediaWatcher(folder, _storage.extensions, media)
|
|
||||||
get_source = GetSource(media, _storage.shuffle)
|
get_source = GetSource(media, _storage.shuffle)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user