+ return actions
+
+ def append_actions_to_key(mapped_key, actions, aliases, seen_files, music_properties, key_properties):
+ for index, action in enumerate(check_mapped_key(actions, mapped_key)):
+ if not isinstance(action, dict) or\
+ not len(action) == 1 or\
+ not isinstance(list(action.values())[0] or {}, dict):
+ warn_print("action number {} of key '{}' is invalid, "
+ "ignored".format(index + 1, mapped_key))
+ continue
+ append_action_to_key(action, mapped_key, aliases, seen_files, music_properties, key_properties)
+
+ def append_action_to_key(action, mapped_key, aliases, seen_files, music_properties, key_properties):
+ action_name = list(action)[0]
+ action_args = {}
+ if action[action_name] is None:
+ action[action_name] = {}
+
+ include_aliases(action[action_name], aliases)
+
+ for argument in action[action_name]:
+ if argument == 'file':
+ filename = str(action[action_name]['file'])
+ if filename not in seen_files:
+ music_property = check_music_property(
+ music_properties[filename],
+ filename)
+
+ if filename in self.open_files:
+ self.open_files[filename]\
+ .reload_properties(**music_property)
+
+ seen_files[filename] =\
+ self.open_files[filename]
+ else:
+ seen_files[filename] = MusicFile(
+ filename, self, **music_property)
+
+ if filename not in key_properties[mapped_key]['files']:
+ key_properties[mapped_key]['files'] \
+ .append(seen_files[filename])
+
+ action_args['music'] = seen_files[filename]
+ else:
+ action_args[argument] = action[action_name][argument]
+
+ key_properties[mapped_key]['actions'] \
+ .append([action_name, action_args])