Command line-based music player in Linux

Source: Internet
Author: User
Tags gstreamer
According to my colleagues, I am an excellent command controller. I wrote a music player under the command line to meet my linux command requirements during the idle time of the latest project. Player exploitation technology: Python + GST (http://gstreamer.freedesktop.org/modules/gst-python.html) + Co according to my colleague, I am a full command control.
I wrote a music player under the command line to meet my linux command requirements during the idle time of the latest project.

Player exploitation technology:
Python + GST (html "> Http://gstreamer.freedesktop.org/modules/gst-python.html) + Console parsing

Player self-sustaining operations:
1. play
2. Next
3. Previous
4. pause
5. view the playlist information
6. view the current playback information
7. stop (exit)

Take a look:


By analyzing the memory information dumped by meliae dump, the memory usage is less than MB, which is relatively small.

Code: (need to install py-gst, ubuntu: sudo apt-get install python-gst0.10)
1  # ! /Usr/bin/env python

3  Import Gst
4  Import Gobject
5  Import Sys
6  # To avoid eclipsewarning
7  Eval ( Gobject. threads_init () )
8  From Threading Import Thread

10  Class AudioPlayer:
11 
12  EVENT_PLAY_NEW =   1
13 
14  Def   _ Init __ (Self, advisor ):
15  Self. main = Gobject. MainLoop ()
16  Self. player = Gst. element_factory_make ( Playbin , Player )
17  Self. index =   - 1
18  Self. list = None
19  Self. advisor = Advisor
20 
21  Bus = Self. player. get_bus ()
22  Bus. add_signal_watch ()
23  Bus. connect ( Message , Self. on_message)
24 
25  Thread (target = Self. main. run). start ()
26 
27  Def Add_list (self, list = []):
28  If List Is None:
29  List = []
30  Self. list = [(I, l. strip (), l [l. rfind ( /
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.