Command Line-based music player in Linux

Source: Internet
Author: User

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 (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 ImportGst
4 ImportGobject
5 ImportSys
6 #To avoid eclipsewarning
7 Eval (Gobject. threads_init ())
8 FromThreadingImportThread

10 ClassAudioPlayer:
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 DefAdd_list (self, list=[]):
28 IfListIsNone:
29 List=[]
30 Self. list=[(I, l. strip (), l [l. rfind (/

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.