def _on_import_done(self, thread): '''Called when the grouping data is retrieved''' if self.import_thread is None: return track_data = self.import_thread.track_data self.import_thread = None logger.info('Group import finished, %s new tracks found' % len(track_data)) if len(track_data) == 0: self.destroy() locations = ';'.join([l.get_location() for l in self.collection.get_libraries()]) dialogs.info(self.exaile.gui.main.window, 'No new tracks found at "%s"' % locations) return self.tags_view.freeze_child_notify() self.tags_view.set_model(None) # add the data to the model for old_group_str, new_group_str, matched_track, newgroups in track_data: self.tags_model.append((True, str(matched_track), old_group_str, new_group_str, matched_track, newgroups)) self.tags_view.set_model(self.tags_model) self.tags_view.thaw_child_notify() self.ok_button.set_sensitive(True) self.tags_vbox.set_visible(True)
def on_replace_clicked(self, widget): tracks = [row[2] for row in self.tracks_list.get_model() if row[1]] replace_str = self.replace_entry.get_text().strip() if replace_str: query = _("Replace '%s' with '%s' on %s tracks?") % ( self.search_str, replace_str, len(tracks)) else: query = _("Delete '%s' from %s tracks?") % (self.search_str, len(tracks)) if dialogs.yesno(self, query) != Gtk.ResponseType.YES: return for track in tracks: groups = gt_common._get_track_groups(track, self.tagname) if self.search_str != '': groups.discard(self.search_str) if replace_str != '': groups.add(replace_str) if not gt_common.set_track_groups(track, groups): return dialogs.info(self, "Tags successfully renamed!") self.reset()
def _on_import_done(self, thread): '''Called when the grouping data is retrieved''' if self.import_thread is None: return track_data = self.import_track_data self.import_thread = None self.import_track_data = None logger.info('Group import finished, %s new tracks found' % len(track_data)) if len(track_data) == 0: self.destroy() locations = ';'.join([l.get_location() for l in self.collection.get_libraries()]) dialogs.info(self.exaile.gui.main.window, 'No new tracks found at "%s"' % locations) return self.tags_view.freeze_child_notify() self.tags_view.set_model(None) # add the data to the model for old_group_str, new_group_str, matched_track, newgroups in track_data: self.tags_model.append((True, str(matched_track), old_group_str, new_group_str, matched_track, newgroups)) self.tags_view.set_model(self.tags_model) self.tags_view.thaw_child_notify() self.ok_button.set_sensitive(True) self.tags_vbox.set_visible(True)
def search_done(self, keyword, lists): """ Called when the search is finished """ if not lists: dialogs.info(self.exaile.gui.main.window, _('No Stations Found')) return dialog = ResultsDialog(_("Icecast Search Results")) dialog.set_items(lists) dialog.connect('response', self._search_response) dialog.show_all() self._keyword = keyword
def _on_import_done(self, thread): '''Called when the grouping data is retrieved''' if self.import_thread is None: return track_data = self.import_thread.track_data self.import_thread = None logger.info('Group import finished, %s new tracks found' % len(track_data)) if len(track_data) == 0: self.window.destroy() # TODO: this isn't on another thread, but if we don't call # threads_enter/leave then it deadlocks. Not sure why... locations = ';'.join( [l.get_location() for l in self.collection.get_libraries()]) gtk.gdk.threads_enter() dialogs.info(self.window, 'No new tracks found at "%s"' % locations) gtk.gdk.threads_leave() return self.tags_view.freeze_child_notify() self.tags_view.set_model(None) # add the data to the model for old_group_str, new_group_str, matched_track, newgroups in track_data: self.tags_model.append((True, str(matched_track), old_group_str, new_group_str, matched_track, newgroups)) self.tags_view.set_model(self.tags_model) self.tags_view.thaw_child_notify() self.ok_button.set_sensitive(True) self.tags_vbox.set_visible(True)
def on_replace_clicked(self, widget): tracks = [row[2] for row in self.tracks_list.get_model() if row[1]] replace_str = self.replace_entry.get_text().strip() if replace_str: query = ngettext( "Replace '{old_tag}' with '{new_tag}' on {amount} track?", "Replace '{old_tag}' with '{new_tag}' on {amount} tracks?", len(tracks), ).format( old_tag=self.search_str, new_tag=replace_str, amount=len(tracks), ) else: query = ngettext( "Delete '{tag}' from {amount} track?", "Delete '{tag}' from {amount} tracks?", len(tracks), ).format(tag=self.search_str, amount=len(tracks)) if dialogs.yesno(self, query) != Gtk.ResponseType.YES: return for track in tracks: groups = gt_common._get_track_groups(track, self.tagname) if self.search_str != '': groups.discard(self.search_str) if replace_str != '': groups.add(replace_str) if not gt_common.set_track_groups(track, groups): return dialogs.info(self, "Tags successfully renamed!") self.reset()
def on_replace_clicked(self, widget): tracks = [row[2] for row in self.tracks_list.get_model() if row[1]] query = _("Replace '%s' with '%s' on %s tracks?") % (self.search_str, self.replace_str, len(tracks)) if dialogs.yesno(self, query) != Gtk.ResponseType.YES: return for track in tracks: groups = gt_common._get_track_groups(track, self.tagname) if self.search_str != '': groups.discard(self.search_str) if self.replace_str != '': groups.add(self.replace_str) if not gt_common.set_track_groups(track, groups): return dialogs.info(self, "Tags successfully renamed!") self.reset()
def _on_import_done(self, thread): '''Called when the grouping data is retrieved''' if self.import_thread is None: return track_data = self.import_thread.track_data self.import_thread = None logger.info('Group import finished, %s new tracks found' % len(track_data)) if len(track_data) == 0: self.window.destroy() # TODO: this isn't on another thread, but if we don't call # threads_enter/leave then it deadlocks. Not sure why... locations = ';'.join([l.get_location() for l in self.collection.get_libraries()]) gtk.gdk.threads_enter() dialogs.info(self.window, 'No new tracks found at "%s"' % locations) gtk.gdk.threads_leave() return self.tags_view.freeze_child_notify() self.tags_view.set_model(None) # add the data to the model for old_group_str, new_group_str, matched_track, newgroups in track_data: self.tags_model.append((True, str(matched_track), old_group_str, new_group_str, matched_track, newgroups)) self.tags_view.set_model(self.tags_model) self.tags_view.thaw_child_notify() self.ok_button.set_sensitive(True) self.tags_vbox.set_visible(True)
def on_replace_clicked(self, widget): tracks = [row[2] for row in self.tracks_list.get_model() if row[1]] query = _("Replace '%s' with '%s' on %s tracks?") % ( self.search_str, self.replace_str, len(tracks)) if dialogs.yesno(self.window, query) != gtk.RESPONSE_YES: return for track in tracks: groups = gt_common._get_track_groups(track, self.tagname) if self.search_str != '': groups.discard(self.search_str) if self.replace_str != '': groups.add(self.replace_str) if not gt_common.set_track_groups(track, groups): return dialogs.info(self.window, "Tags successfully renamed!") self.reset()