def __init__(self, app): self._app = app self._playlist = [] self._shuffle_list = [] self.active_preset = None self.next_preset = None self._playlist_data = None self._loader = PatternLoader(self) self.available_pattern_classes = self._loader.all_patterns() self.last_active_preset = self._app.settings.get("last-preset", None) self.active_preset = None self.next_preset = None self._shuffle = self._app.settings['mixer']['shuffle'] self._shuffle_list = [] self.name = app.args.playlist if self.name is None: self.name = self._app.settings.get("mixer").get("last_playlist", None) if self.name is None or self.name == "": self.filetype = "playlist" self.filename = "" self.initialized = False else: filepath = os.path.join(os.getcwd(), "data", "playlists", "".join([self.name, ".json"])) JSONDict.__init__(self, 'playlist', filepath, True) self.open()
def __init__(self, app): self._app = app self._name = app.args.scene self._filepath = os.path.join(os.getcwd(), "data", "scenes", "".join([self._name, ".json"])) JSONDict.__init__(self, 'scene', self._filepath, False) self._fixtures = None self._fixture_dict = {} self._fixture_hierarchy = None self._colliding_fixtures_cache = {} self._pixel_neighbors_cache = {} self._pixel_locations_cache = {} self._pixel_distance_cache = {} self._intersection_points = None self._all_pixels = None self._all_pixel_locations = None log.info("Warming up scene caches...") fh = self.fixture_hierarchy() for strand in fh: for fixture in fh[strand]: self.get_colliding_fixtures(strand, fixture) for pixel in range(self.fixture(strand, fixture).pixels): neighbors = self.get_pixel_neighbors((strand, fixture, pixel)) self.get_pixel_location((strand, fixture, pixel)) for neighbor in neighbors: self.get_pixel_distance((strand, fixture, pixel), neighbor) self.get_fixture_bounding_box() self.get_intersection_points() self.get_all_pixels() self.get_all_pixel_locations() log.info("Done")
def __init__(self, app): self._app = app self._playlist = [] self._shuffle_list = [] self.active_preset = None self.next_preset = None self._playlist_data = None self._loader = PatternLoader(self) self.available_pattern_classes = self._loader.all_patterns() self.last_active_preset = self._app.settings.get("last-preset", None) self.active_preset = None self.next_preset = None self._shuffle = self._app.settings['mixer']['shuffle'] self._shuffle_list = [] self.name = app.args.playlist if self.name is None: self.name = self._app.settings.get("mixer").get( "last_playlist", None) if self.name is None or self.name == "": self.filetype = "playlist" self.filename = "" self.initialized = False else: filepath = os.path.join(os.getcwd(), "data", "playlists", "".join([self.name, ".json"])) JSONDict.__init__(self, 'playlist', filepath, True) self.open()
def save(self): self.data["name"] = self._instance_name self.data["classname"] = self.__class__.__name__ self.data["file-version"] = 1 self.data["params"] = {} for n, p in self._parameters.items(): self.data["params"][n] = p.get_as_str() JSONDict.save(self)
def __init__(self, app): self._app = app self.name = app.args.playlist if self.name is None: self.name = self._app.settings.get("mixer").get("last_playlist", "default") filepath = os.path.join(os.getcwd(), "data", "playlists", "".join([self.name, ".json"])) JSONDict.__init__(self, 'playlist', filepath, True) self.open()
def __init__(self, app, name, last_playlist_settings_key): self._app = app self._notifier = Playlist.Notifier() self._last_playlist_settings_key = last_playlist_settings_key self.name = name if self.name is None: self.name = self._app.settings.get("mixer").get( self.last_playlist_settings_key, "default") filepath = os.path.join(os.getcwd(), "data", "playlists", "".join([self.name, ".json"])) JSONDict.__init__(self, 'playlist', filepath, True) self.open()
def save(self, save_all_presets=True): log.info("Saving playlist") playlist = [] for preset in self._playlist: playlist.append(preset.slug()) if save_all_presets: preset.save() self.data['playlist'] = playlist # Superclass write to file self._app.settings.get("mixer")["last_playlist"] = self.name JSONDict.save(self)
def __init__(self, app, slug=""): self._app = app self._ticks = 0 self._elapsed_time = 0 self._parameters = {} self._watches = {} self._instance_name = "" self._instance_slug = slug self.initialized = False self.disabled = False filepath = os.path.join(os.getcwd(), "data", "presets", "".join([slug, ".json"])) JSONDict.__init__(self, 'preset', filepath, True) self.open()
def save(self): log.info("Saving playlist") # Pack the current state into self.data self.data = {'file-type': 'playlist'} playlist = [] for preset in self._playlist: playlist_entry = {'classname': preset.__class__.__name__, 'name': preset.get_name()} param_dict = {} for name, param in preset.get_parameters().iteritems(): param_dict[name] = param.get() playlist_entry['params'] = param_dict playlist.append(playlist_entry) self.data['playlist'] = playlist # Superclass write to file JSONDict.save(self)
def __init__(self, app): self._app = app self._name = app.args.playlist self._filepath = os.path.join(os.getcwd(), "data", "playlists", "".join([self._name, ".json"])) JSONDict.__init__(self, 'playlist', self._filepath, True) self._loader = PresetLoader() self._preset_classes = self._loader.load() self._playlist_data = self.data.get('playlist', []) self._playlist = [] self._active_index = 0 self._next_index = 0 self._shuffle = self._app.settings['mixer']['shuffle'] self._shuffle_list = [] self.generate_playlist()
def __init__(self, app): self._app = app self._name = app.args.scene self._filepath = os.path.join(os.getcwd(), "data", "scenes", "".join([self._name, ".json"])) JSONDict.__init__(self, 'scene', self._filepath, False) self._fixtures = None self._fixture_dict = {} self._fixture_hierarchy = None self._colliding_fixtures_cache = {} self._pixel_neighbors_cache = {} self._pixel_locations_cache = {} self._pixel_distance_cache = {} self._intersection_points = None self._all_pixels = None self._all_pixel_locations = None self._all_pixels_raw = None
def save(self): log.info("Saving playlist") # Pack the current state into self.data self.data = {'file-type': 'playlist'} playlist = [] for preset in self._playlist: playlist_entry = {'classname': preset.__class__.__name__, 'name': preset.get_name()} param_dict = {} for name, param in preset.get_parameters().iteritems(): param_dict[name] = param.get_as_str() playlist_entry['params'] = param_dict playlist.append(playlist_entry) self.data['playlist'] = playlist # Superclass write to file self._app.settings.get("mixer")[self._last_playlist_settings_key] = self.name JSONDict.save(self)
def save(self, save_all_presets=True): if not self.initialized: return log.info("Saving playlist") playlist = [] for preset in self._playlist: playlist.append(preset.slug()) if save_all_presets: preset.save() self.data['playlist'] = playlist self.data["file-version"] = 2 # Superclass write to file self._app.settings.get("mixer")["last_playlist"] = self.name self._app.settings["last-preset"] = self.active_preset.name() JSONDict.save(self)
def __init__(self, app): self._app = app self._playlist = [] self._shuffle_list = [] self.active_preset = None self.next_preset = None self._playlist_data = None self.name = app.args.playlist if self.name is None: self.name = self._app.settings.get("mixer").get("last_playlist", None) if self.name is None or self.name == "": self.filetype = "playlist" self.filename = "" self.initialized = False else: filepath = os.path.join(os.getcwd(), "data", "playlists", "".join([self.name, ".json"])) JSONDict.__init__(self, 'playlist', filepath, True) self.open()
def __init__(self, app): self._app = app self._playlist = [] self._shuffle_list = [] self.active_preset = None self.next_preset = None self._playlist_data = None self.name = app.args.playlist if self.name is None: self.name = self._app.settings.get("mixer").get( "last_playlist", None) if self.name is None or self.name == "": self.filetype = "playlist" self.filename = "" self.initialized = False else: filepath = os.path.join(os.getcwd(), "data", "playlists", "".join([self.name, ".json"])) JSONDict.__init__(self, 'playlist', filepath, True) self.open()
def __init__(self): filepath = os.path.join(os.getcwd(), "data", "settings.json") JSONDict.__init__(self, 'settings', filepath, False)
def save(self): JSONDict.save(self)
def __init__(self, app): filename = app.args.scene self._filename = os.path.join(os.getcwd(), "data", "scenes", "".join([filename, ".json"])) JSONDict.__init__(self, 'scene', self._filename, False) self.data["filepath"] = self._filename