diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2016-09-19 15:57:26 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2016-09-19 16:00:43 +0200 |
commit | 6dc040edf2f31497d4492c159397c4634037be66 (patch) | |
tree | 93da3ca7f67fc3012e3793870c6f6a9b4e96220c /music_sampler/actions/load_music.py | |
parent | a9324e30da6292f53f008f1b827779c7f8e2fcdf (diff) | |
download | MusicSampler-6dc040edf2f31497d4492c159397c4634037be66.tar.gz MusicSampler-6dc040edf2f31497d4492c159397c4634037be66.tar.zst MusicSampler-6dc040edf2f31497d4492c159397c4634037be66.zip |
Add load_all_musics flag and corresponding actions
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" | ||