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