当前位置: 首页>>代码示例>>Python>>正文


Python repository.GstPbutils类代码示例

本文整理汇总了Python中gi.repository.GstPbutils的典型用法代码示例。如果您正苦于以下问题:Python GstPbutils类的具体用法?Python GstPbutils怎么用?Python GstPbutils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了GstPbutils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: install

 def install(self):
     """
         Install missing plugins
     """
     try:
         context = GstPbutils.InstallPluginsContext.new()
         try:
             context.set_desktop_id('lollypop.desktop')
         except:
             pass  # Not supported by Ubuntu VIVID
         details = []
         for message in self._messages:
             detail = \
                 GstPbutils.missing_plugin_message_get_installer_detail(
                     message)
             details.append(detail)
         GstPbutils.install_plugins_async(
             details,
             context,
             self._null)
         if Lp.notify is not None:
             GLib.timeout_add(
                 10000,
                 Lp.notify.send,
                 _("Restart lollypop after installing codecs"))
     except Exception as e:
         print("Codecs::__init__(): %s" % e)
开发者ID:ktosiu,项目名称:lollypop,代码行数:27,代码来源:codecs.py

示例2: on_gst_element

 def on_gst_element(self, bus, message):
     if GstPbutils.is_missing_plugin_message(message):
         if GstPbutils.install_plugins_supported():
             details = GstPbutils.missing_plugin_message_get_installer_detail(message)
             GstPbutils.install_plugins_async([details,], None, self.on_gst_plugin_installed, None)
         else:
             self.error_dialog(_("Missing codec"), None,
                     submsg=_("GStreamer is missing a plugin and it could not be automatically installed. Either manually install it or try another quality setting."))
开发者ID:Greenginer,项目名称:pithos,代码行数:8,代码来源:pithos.py

示例3: _on_element

 def _on_element(self, bus, message):
     if GstPbutils.is_missing_plugin_message(message):
         if GstPbutils.install_plugins_supported():
             details = (
                 GstPbutils.missing_plugin_message_get_installer_detail(
                     message))
             GstPbutils.install_plugins_async(
                 [details], None, self._plugin_installation_complete, None)
         else:
             self.emit("error", "Missing codec",
                       "GStreamer is missing a plugin and it could not be "
                       "automatically installed. Either manually install "
                       "it or try another quality setting.",
                       False)
开发者ID:glennimoss,项目名称:pithos,代码行数:14,代码来源:gstplayer.py

示例4: __init__

    def __init__(self):
        super().__init__()

        try:
            Gst.init(None)
            GstPbutils.pb_utils_init()
        except GLib.Error as error:
            logger.warning("Error: {}, {}".format(error.domain, error.message))
            return

        self._media_art = MediaArt.Process.new()

        self._album = None
        self._artist = None
        self._media = None
        self._path = None
开发者ID:GNOME,项目名称:gnome-music,代码行数:16,代码来源:albumartcache.py

示例5: __handle_missing_plugin

    def __handle_missing_plugin(self, message):
        get_installer_detail = \
            GstPbutils.missing_plugin_message_get_installer_detail
        get_description = GstPbutils.missing_plugin_message_get_description

        details = get_installer_detail(message)
        if details is None:
            return

        self.stop()

        format_desc = get_description(message)
        title = _(u"No GStreamer element found to handle media format")
        error_details = _(u"Media format: %(format-description)s") % {
            "format-description": format_desc.decode("utf-8")}

        def install_done_cb(plugins_return, *args):
            print_d("Gstreamer plugin install return: %r" % plugins_return)
            Gst.update_registry()

        context = GstPbutils.InstallPluginsContext.new()
        res = GstPbutils.install_plugins_async(
            [details], context, install_done_cb, None)
        print_d("Gstreamer plugin install result: %r" % res)

        if res in (GstPbutils.InstallPluginsReturn.HELPER_MISSING,
                GstPbutils.InstallPluginsReturn.INTERNAL_FAILURE):
            self._error(PlayerError(title, error_details))
开发者ID:thisfred,项目名称:quodlibet,代码行数:28,代码来源:player.py

示例6: _on_bus_element

 def _on_bus_element(self, bus, message):
     """
         Set elements for missings plugins
         @param bus as Gst.Bus
         @param message as Gst.Message
     """
     if GstPbutils.is_missing_plugin_message(message):
         self._codecs.append(message)
开发者ID:Nikhil-z,项目名称:lollypop,代码行数:8,代码来源:player_bin.py

示例7: loadAll

    def loadAll(self):
        """Loads profiles from GstEncodingTarget and add them to self.combo.

        Override from PresetManager
        """
        for target in GstPbutils.encoding_list_all_targets():
            if target.get_category() != GstPbutils.ENCODING_CATEGORY_FILE_EXTENSION:
                self._add_target(target)
开发者ID:cfoch,项目名称:pitivi,代码行数:8,代码来源:preset.py

示例8: __init__

    def __init__(self):
        super().__init__()

        GstPbutils.pb_utils_init()

        self._songs = []
        self._shuffle_indexes = []
        self._current_index = 0

        self._type = -1
        self._id = -1

        self._validation_indexes = None
        self._discoverer = GstPbutils.Discoverer()
        self._discoverer.connect('discovered', self._on_discovered)
        self._discoverer.start()

        self.connect("notify::repeat-mode", self._on_repeat_mode_changed)
开发者ID:GNOME,项目名称:gnome-music,代码行数:18,代码来源:player.py

示例9: __handle_plugin_missing_message

def __handle_plugin_missing_message(message, engine):

    desc = GstPbutils.missing_plugin_message_get_description(message)
    installer_details = GstPbutils.missing_plugin_message_get_installer_detail(message)
    LOGGER.warn("A plugin for %s is missing, stopping playback", desc)

    user_message = _(
        "A GStreamer 1.x plugin for %s is missing. "
        "Without this software installed, Exaile will not be able to play the current file. "
        "Please install the required software on your computer. See %s for details."
    ) % (desc, MISSING_PLUGIN_URL)
    # TODO make URL clickable by utilizing xlgui.widgets.dialogs.MessageBar

    engine.stop()
    __notify_user_on_error(user_message, engine)
    if GstPbutils.install_plugins_supported():
        if __run_installer_helper(installer_details):
            return
    LOGGER.warn("Installation of GStreamer plugins not supported on this platform.")
开发者ID:exaile,项目名称:exaile,代码行数:19,代码来源:missing_plugin.py

示例10: on_gst_error

    def on_gst_error(self, bus, message):
        err, debug = message.parse_error()
        logging.error("Gstreamer error: %s, %s, %s" % (err, debug, err.code))
        if self.current_song:
            self.current_song.message = "Error: "+str(err)

        self.gstreamer_error = str(err)
        self.gstreamer_errorcount_1 += 1

        if not GstPbutils.install_plugins_installation_in_progress():
            self.next_song()
开发者ID:Greenginer,项目名称:pithos,代码行数:11,代码来源:pithos.py

示例11: _start_plugin_installation

    def _start_plugin_installation(self, missing_plugin_messages, confirm_search):
        install_ctx = GstPbutils.InstallPluginsContext.new()

        if self._gst_plugins_base_check_version(1, 5, 0):
            install_ctx.set_desktop_id('gnome-music.desktop')
            install_ctx.set_confirm_search(confirm_search)

            startup_id = '_TIME%u' % Gtk.get_current_event_time()
            install_ctx.set_startup_notification_id(startup_id)

        installer_details = []
        for message in missing_plugin_messages:
            installer_detail = GstPbutils.missing_plugin_message_get_installer_detail(message)
            installer_details.append(installer_detail)

        def on_install_done(res):
            # We get the callback too soon, before the installation has
            # actually finished. Do nothing for now.
            pass

        GstPbutils.install_plugins_async(installer_details, install_ctx, on_install_done)
开发者ID:saifulbkhan,项目名称:gnome-music,代码行数:21,代码来源:player.py

示例12: install

 def install(self):
     """
         Install missing plugins
     """
     try:
         context = GstPbutils.InstallPluginsContext.new()
         try:
             context.set_desktop_id('lollypop.desktop')
         except:
             pass  # Not supported by Ubuntu VIVID
         details = []
         for message in self._messages:
             detail = \
                 GstPbutils.missing_plugin_message_get_installer_detail(
                     message)
             details.append(detail)
         GstPbutils.install_plugins_async(
             details,
             context,
             self._null)
     except Exception as e:
         print("Codecs::__init__(): %s" % e)
开发者ID:IxianPixel,项目名称:lollypop,代码行数:22,代码来源:codecs.py

示例13: _on_gst_error

    def _on_gst_error(self, bus, message):
        err, debug = message.parse_error()
        logging.error("Gstreamer error from %s: %s, %s, %s",
                      message.src, err, debug, err.code)

        if err.matches(Gst.ResourceError.quark(),
                       Gst.ResourceError.NOT_AUTHORIZED):
            err = 'Playlist entry expired'

        if self._current_song:
            self._current_song.message = "Error: " + str(err)

        if not GstPbutils.install_plugins_installation_in_progress():
            self.emit("song-ended")
开发者ID:glennimoss,项目名称:pithos,代码行数:14,代码来源:gstplayer.py

示例14: _start_plugin_installation

    def _start_plugin_installation(
            self, missing_plugin_messages, confirm_search):
        install_ctx = GstPbutils.InstallPluginsContext.new()
        application_id = self._application.props.application_id
        install_ctx.set_desktop_id(application_id + '.desktop')
        install_ctx.set_confirm_search(confirm_search)

        startup_id = "_TIME{}".format(Gtk.get_current_event_time())
        install_ctx.set_startup_notification_id(startup_id)

        installer_details = []
        get_details = GstPbutils.missing_plugin_message_get_installer_detail
        for message in missing_plugin_messages:
            installer_detail = get_details(message)
            installer_details.append(installer_detail)

        def on_install_done(res):
            # We get the callback too soon, before the installation has
            # actually finished. Do nothing for now.
            pass

        GstPbutils.install_plugins_async(
            installer_details, install_ctx, on_install_done)
开发者ID:GNOME,项目名称:gnome-music,代码行数:23,代码来源:gstplayer.py

示例15: on_message

    def on_message(self, bus, message):
        mtype = message.type
        # print(mtype)
        if mtype == Gst.MessageType.ERROR:
            print("we got an error, life is shit")
            err, debug = message.parse_error()
            print(err)
            print(debug)
            Gst.debug_bin_to_dot_file(self.pipeline, Gst.DebugGraphDetails.ALL, "transmageddon-debug-graph")
            # self.emit('got-error', err.message)
        elif mtype == Gst.MessageType.ELEMENT:
            if GstPbutils.is_missing_plugin_message(message):
                print("missing something")
                if self.missingplugin == False:  # don't think this is correct if more than one plugin installed
                    self.missingplugin = message
                    GstPbutils.missing_plugin_message_get_description(message)
                    GstPbutils.missing_plugin_message_get_installer_detail(message)
                    self.uridecoder.set_state(Gst.State.NULL)
                    self.emit("missing-plugin")

        elif mtype == Gst.MessageType.ASYNC_DONE:
            self.emit("ready-for-querying")
        elif mtype == Gst.MessageType.EOS:
            self.usedstreamids = []
            # removing multipass cache file when done
            if (self.streamdata["multipass"] != 0) and (self.streamdata["passcounter"] != self.streamdata["multipass"]):
                if os.access(self.cachefile, os.F_OK):
                    os.remove(self.cachefile)
                    os.remove(self.cachefile + ".mbtree")
            # print(self.streamdata['passcounter'])
            self.emit("got-eos")
            self.pipeline.set_state(Gst.State.NULL)
        elif mtype == Gst.MessageType.APPLICATION:
            self.pipeline.set_state(Gst.State.NULL)
            self.pipeline.remove(self.uridecoder)
        return True
开发者ID:GNOME,项目名称:transmageddon,代码行数:36,代码来源:transcoder_engine.py


注:本文中的gi.repository.GstPbutils类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。