Music Player

Hi,

I am a beginer in wxpython,i have a project to create a music player and that has the the ability to read from a xml file, go to that folder and fetch a song from that folder and play according to that xml file, i am really messed up how to do it in python , pls pls can any one help me on this.

Thank you

Hi,

Hi,

I am a beginer in wxpython,i have a project to create a music player and that has the the ability to read from a xml file, go to that folder and fetch a song from that folder and play according to that xml file, i am really messed up how to do it in python , pls pls can any one help me on this.

Thank you

Reading an XML file in Python is pretty easy. I have several tutorials on the subject that might help you:

I prefer the lxml module, but element tree is easy to use too. In wxPython, you can use wx.media to play music. It’s a fairly limited widget, but it does have the basics. Here’s a tutorial on that too:

There is a custom mplayer widget, however I’m not sure that it is still maintained. I thought it was more robust for playing media, but it could be a bit painful to set up:

You’ll have to play around with those and see if they really accomplish what you want. If not, you might want to check this out too:

Good luck and welcome to Python!
Mike

···

On Wednesday, November 26, 2014 12:25:04 AM UTC-6, Dheeraj B wrote:

For playing music, I’ve had good success with wx.MediaCtrl.

Patrick

Hi,

Thanks a ton, it is helping me a lot ,i started writing code as per your suggestions and going ahead…

···

On Wednesday, November 26, 2014 7:35:32 PM UTC+5:30, Mike Driscoll wrote:

Hi,

On Wednesday, November 26, 2014 12:25:04 AM UTC-6, Dheeraj B wrote:

Hi,

I am a beginer in wxpython,i have a project to create a music player and that has the the ability to read from a xml file, go to that folder and fetch a song from that folder and play according to that xml file, i am really messed up how to do it in python , pls pls can any one help me on this.

Thank you

Reading an XML file in Python is pretty easy. I have several tutorials on the subject that might help you:

I prefer the lxml module, but element tree is easy to use too. In wxPython, you can use wx.media to play music. It’s a fairly limited widget, but it does have the basics. Here’s a tutorial on that too:

There is a custom mplayer widget, however I’m not sure that it is still maintained. I thought it was more robust for playing media, but it could be a bit painful to set up:

You’ll have to play around with those and see if they really accomplish what you want. If not, you might want to check this out too:

Good luck and welcome to Python!
Mike

Hi,

I am finding difficult to use lxml libraries , is there any tutorial, or can you please guide me…

···

On Wednesday, November 26, 2014 7:35:32 PM UTC+5:30, Mike Driscoll wrote:

Hi,

On Wednesday, November 26, 2014 12:25:04 AM UTC-6, Dheeraj B wrote:

Hi,

I am a beginer in wxpython,i have a project to create a music player and that has the the ability to read from a xml file, go to that folder and fetch a song from that folder and play according to that xml file, i am really messed up how to do it in python , pls pls can any one help me on this.

Thank you

Reading an XML file in Python is pretty easy. I have several tutorials on the subject that might help you:

I prefer the lxml module, but element tree is easy to use too. In wxPython, you can use wx.media to play music. It’s a fairly limited widget, but it does have the basics. Here’s a tutorial on that too:

There is a custom mplayer widget, however I’m not sure that it is still maintained. I thought it was more robust for playing media, but it could be a bit painful to set up:

You’ll have to play around with those and see if they really accomplish what you want. If not, you might want to check this out too:

Good luck and welcome to Python!
Mike

Dheeraj roy wrote:

Hi,

I am finding difficult to use lxml libraries , is there any tutorial,
or can you please guide me....

Did you any looking at all? The first Google hit for "lxml" is the
project's web site at lxml.de, which includes several tutorials.

You should also look at the ElementTree link from his original message.
You may find that easier going.

It may be that you're expecting something very easy. The XML tools he's
showing do make XML handling easier, but because XML is so flexible, the
results are still a bit daunting. Remember, these tools take an XML
file and convert it into a tree of Python objects. It's still up to you
to handle the Python objects. The objects reflect the structure of the
XML file. So, for example, if your top-level object is a <library> tag,
and it contains a series of <album> tags, each of which contains <song>
tags, then that's how you'd process it. The XML parsing process will
return a top-level object, which is the "library" object. You will loop
through each of its children, which will be the "album" objects. Then
you will loop through each of THEIR children, which will be the "song"
objects.

···

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Hi,

I am very thankful for your suggestions, now i am able to parse the xml to an extent and i want to know …if theres any ide available for python that i can design a gui and script for that like eclipse or visual studio…pls help me i am a beginner and facing problems to create an UI with python script…Thank you.

···

On Tuesday, December 16, 2014 12:08:07 AM UTC+5:30, Tim Roberts wrote:

Dheeraj roy wrote:

Hi,

I am finding difficult to use lxml libraries , is there any tutorial,

or can you please guide me…

Did you any looking at all? The first Google hit for “lxml” is the

project’s web site at lxml.de, which includes several tutorials.

You should also look at the ElementTree link from his original message.
You may find that easier going.

It may be that you’re expecting something very easy. The XML tools he’s

showing do make XML handling easier, but because XML is so flexible, the

results are still a bit daunting. Remember, these tools take an XML

file and convert it into a tree of Python objects. It’s still up to you

to handle the Python objects. The objects reflect the structure of the

XML file. So, for example, if your top-level object is a tag,

and it contains a series of tags, each of which contains

tags, then that’s how you’d process it. The XML parsing process will

return a top-level object, which is the “library” object. You will loop

through each of its children, which will be the “album” objects. Then

you will loop through each of THEIR children, which will be the “song”

objects.


Tim Roberts, ti...@probo.com

Providenza & Boekelheide, Inc.

Hi,

Hi,

I am very thankful for your suggestions, now i am able to parse the xml to an extent and i want to know ..if theres any ide available for python that i can design a gui and script for that like eclipse or visual studio...pls help me i am a beginner and facing problems to create an UI with python script...Thank you.

You could code your UI manually with wxPython, e.g. wx.lib.sized_controls makes this quit easy.
http://wxpython.org/Phoenix/docs/html/lib.sized_controls.html

UI designers for wxPython of the top of my head:
- Boa - http://boa-constructor.sourceforge.net/
- Boa fork which is a bit more up to date then above - https://bitbucket.org/cwt/boa-constructor
- wxGlade - http://wxglade.sourceforge.net/
- wxFormBuilder - http://sourceforge.net/projects/wxformbuilder/

Werner

···

On 12/18/2014 7:52, Dheeraj roy wrote:

Hi,

i got stucked again in xml parsing ,here is my xml example:

<?xml version="1.0" standalone="yes"?> 11414 428467 S 11:00:00 TRACK 29 SINGLE , 428467.aac 00:02:06 -6 db 11414 428487 S 11:02:07 TRACK 57 SINGLE , 428487.aac 00:01:44 -6 db 11414 428447 S 11:03:52 TRACK 06 SINGLE , 428447.aac 00:07:27 -6 db 11414 428454 S 11:11:20 TRACK 14 SINGLE , 428454.aac 00:02:10 -6 db 11414 428453 S 11:13:31 TRACK 13 SINGLE , 428453.aac 00:02:52 -6 db

From this xml i am trying to fetch the “AIRTIME” by comparing the current time…i need only one AIRTIME to move further and also i have a complication that my player has to play one by one… based on this xml sheet.how can i do this…???pls help me regarding this

Here is the code ::

import wx
import datetime
import xml.etree.ElementTree as ET
now = datetime.datetime.now()
td = now.strftime(“%d-%m-%Y”)
tm = now.strftime(“%H:%m-%S”)
path = ‘C:/Users/dheeraj/Desktop/’
np = ‘’.join([path, td,‘.xml’])
tree = ET.parse(np)
root = tree.getroot()
for Airtime in root.iter(“Airtime”):
if Airtime <= tm:
print “@@”, tm

output:

@@ 14:01:56
@@ 14:01:56
@@ 14:01:56
@@ 14:01:56
@@ 14:01:56
@@ 14:01:56
@@ 14:01:56
@@ 14:01:56
@@ 14:01:56
@@ 14:01:56
@@ 14:01:56
@@ 14:01:56
@@ 14:01:56
@@ 14:01:56
@@ 14:01:56
@@ 14:01:56
@@ 14:01:56
@@ 14:01:56
@@ 14:01:56
@@ 14:01:56
@@ 14:01:56

i am unable to fix this …pls help me

thank you:)

question, or an xml question. Having said that, if you change
print "@@", tm
to
print "@@", Airtime
you will probably get more interesting output.

···

On Fri, Jan 9, 2015 at 4:28 AM, Dheeraj B <dheerajb.2020@gmail.com> wrote:

Hi,

i got stucked again in xml parsing ,here is my xml example:

Here is the code ::

>>> import wx
>>> import datetime
>>> import xml.etree.ElementTree as ET
>>> now = datetime.datetime.now()
>>> td = now.strftime("%d-%m-%Y")
>>> tm = now.strftime("%H:%m-%S")
>>> path = 'C:/Users/dheeraj/Desktop/'
>>> np = ''.join([path, td,'.xml'])
>>> tree = ET.parse(np)
>>> root = tree.getroot()
>>> for Airtime in root.iter("Airtime"):
    if Airtime <= tm:
        print "@@", tm

output:

@@ 14:01:56
@@ 14:01:56
@@ 14:01:56
@@ 14:01:56
@@ 14:01:56
@@ 14:01:56
@@ 14:01:56
@@ 14:01:56
@@ 14:01:56
@@ 14:01:56
@@ 14:01:56
@@ 14:01:56
@@ 14:01:56
@@ 14:01:56
@@ 14:01:56
@@ 14:01:56
@@ 14:01:56
@@ 14:01:56
@@ 14:01:56
@@ 14:01:56
@@ 14:01:56

i am unable to fix this ....pls help me

thank you:)

This question has nothing to do with wxPython, it is a general python

--
Best Regards,
Michael Moriarity