diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2016-09-22 21:47:25 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2016-09-22 21:47:25 +0200 |
commit | d028768179d4fd1555831e26daaa9aae9ac94e85 (patch) | |
tree | c7dc2e8b589c87d50961b60ddfa17b739ef4e9fb /music_sampler/actions/load_music.py | |
parent | d4217fda2ff3991eb1ee9a9bec6acff751798507 (diff) | |
parent | f9aeecf1a00e0e632546db00cb0cfa31b078dbe9 (diff) | |
download | MusicSampler-d028768179d4fd1555831e26daaa9aae9ac94e85.tar.gz MusicSampler-d028768179d4fd1555831e26daaa9aae9ac94e85.tar.zst MusicSampler-d028768179d4fd1555831e26daaa9aae9ac94e85.zip |
Merge branch 'load_action'1.3.0
Diffstat (limited to 'music_sampler/actions/load_music.py')
-rw-r--r-- | music_sampler/actions/load_music.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/music_sampler/actions/load_music.py b/music_sampler/actions/load_music.py new file mode 100644 index 0000000..f3e02ba --- /dev/null +++ b/music_sampler/actions/load_music.py | |||
@@ -0,0 +1,12 @@ | |||
1 | import threading | ||
2 | |||
3 | def run(action, music=None, **kwargs): | ||
4 | for music in action.music_list(music): | ||
5 | if not music.is_loaded(allow_substates=True): | ||
6 | threading.Thread(name="MSMusicLoad", target=music.load).start() | ||
7 | |||
8 | def description(action, music=None, **kwargs): | ||
9 | if music is not None: | ||
10 | return "load music « {} » to memory".format(music.name) | ||
11 | else: | ||
12 | return "load all music to memory" | ||