def start (self):
        if len (self.errors) == 0:
            e = operations.FinishedEvent (self, operations.SUCCESSFUL)
            for l in self.listeners:
                l.on_finished (e)
            return
                
        elif len (self.errors) > 1:
            title = _("Unsupported file types")
        else:
            title = _("Unsupported file type")
            
        filenames = []
        for e in self.errors:
            filenames.append (urlutil.basename(e.hints['location']))
        del self.__errors
        
        if len (filenames) == 1:
            msg = _("The following files were not added:") + "\n"
        else:
            msg = _("The following files were not added:") + "\n"
        
        msg += " "
        msg += ", ".join (filenames)

        gtkutil.dialog_error (title, msg, parent = self.parent)
        
        e = operations.FinishedEvent (self, operations.SUCCESSFUL)
        for l in self.listeners:
            l.on_finished (e)
    def on_metadata (self, event, metadata):
        title = urlutil.basename(self.hints['location'])
        title = path.splitext(title)[0]
        
        row = {
            "location": self.hints['location'],
            "cache_location": "",
            "title": title or _("Unknown"),
            "artist": _("Unknown Artist"),
            "duration": int(metadata['duration']),
        }
        
        if metadata.has_key ('title'):
            row['title'] = metadata['title']
        if metadata.has_key ('artist'):
            row['artist'] = metadata['artist']
            
        if self.hints.has_key ('title'):
            row['title'] = self.hints['title']
        if self.hints.has_key ('artist'):
            row['artist'] = self.hints['artist']

        if self.insert is not None:
            self.music_list.insert (self.insert, row)
        else:
            self.music_list.append (row)
    def start(self):
        if len(self.errors) == 0:
            e = operations.FinishedEvent(self, operations.SUCCESSFUL)
            for l in self.listeners:
                l.on_finished(e)
            return

        filenames = []
        for e in self.errors:
            filenames.append(urlutil.basename(e.hints["location"]))
        del self.__errors

        title = N_("Unsupported file type", "Unsupported file types", len(filenames))

        msg = N_("The following file was not added:", "The following files were not added:", len(filenames))

        gtkutil.list_dialog(
            title,
            _(
                "If you're having problems opening certain files make sure you "
                "have the GStreamer plugins needed to decode them."
            ),
            list_title=msg,
            parent=self.parent,
            items=filenames,
            stock=gtk.STOCK_DIALOG_ERROR,
            buttons=(gtk.STOCK_CLOSE, gtk.RESPONSE_OK),
        )

        e = operations.FinishedEvent(self, operations.SUCCESSFUL)
        for l in self.listeners:
            l.on_finished(e)
    def start (self):
        if len (self.errors) == 0:
            e = operations.FinishedEvent (self, operations.SUCCESSFUL)
            for l in self.listeners:
                l.on_finished (e)
            return

        filenames = []
        for e in self.errors:
            filenames.append (urlutil.basename(e.hints['location']))
        del self.__errors
        
        title = N_(
            "Unsupported file type",
            "Unsupported file types",
            len(filenames)
        )

        msg = N_(
            "The following file was not added:",
            "The following files were not added:",
            len(filenames)
        )

        gtkutil.list_dialog(
            title,
            _("If you're having problems opening certain files make sure you "
              "have the GStreamer plugins needed to decode them."),
            list_title=msg,
            parent=self.parent,
            items=filenames,
            stock = gtk.STOCK_DIALOG_ERROR,
            buttons =(gtk.STOCK_CLOSE, gtk.RESPONSE_OK),
        )
        
        e = operations.FinishedEvent (self, operations.SUCCESSFUL)
        for l in self.listeners:
            l.on_finished (e)