niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
· nixdoc.net · man pages · Linux HOWTOs · FreeBSD Tips · Forums
navigation Forum index » Programming » python
Controlling Windows Media Player from Python
Post new topic   Reply to topic Page 1 of 1 [5 Posts] View previous topic :: View next topic
Author Message
Jeffrey Barish
*nix forums beginner


Joined: 26 Apr 2005
Posts: 9

PostPosted: Mon Jul 03, 2006 3:38 pm    Post subject: Controlling Windows Media Player from Python Reply with quote

Is there a way to interact with Windows Media Player from Python? I would
like to be able to do things like tell WMP to play a given sound file or to
ask WMP for metadata about a sound file.
--
Jeffrey Barish
Back to top
Avizoa@gmail.com
*nix forums beginner


Joined: 26 Apr 2006
Posts: 6

PostPosted: Mon Jul 03, 2006 3:47 pm    Post subject: Re: Controlling Windows Media Player from Python Reply with quote

Jeffrey Barish wrote:
Quote:
Is there a way to interact with Windows Media Player from Python? I would
like to be able to do things like tell WMP to play a given sound file or to
ask WMP for metadata about a sound file.
--
Jeffrey Barish



The fact of the matter is that python doesn't need to ask WMP for the
metadata. Python can get the metadata from the file itself and then
tell the computer to play the file.

If you're looking to do something more complicated, try PyMedia or even
download wxPython and take a look at the examples. There's an embedded
WMP example.



By the way, someone has most likely made a module specifically for
reading the metadata from many types of music files, but I don't have
time to look. Maybe someone else can point you in the right direction.
For telling WMP to play the file you want one of the os.exec variants.
Back to top
Lawrence Oluyede
*nix forums addict


Joined: 20 Oct 2005
Posts: 61

PostPosted: Tue Jul 04, 2006 12:37 am    Post subject: Re: Controlling Windows Media Player from Python Reply with quote

Jeffrey Barish <jeff_barish@earthlink.net> wrote:

Quote:
Is there a way to interact with Windows Media Player from Python? I would
like to be able to do things like tell WMP to play a given sound file or to
ask WMP for metadata about a sound file.

Take a look at pywinauto, I attended the today talk at EP2006 and seemed
really cool. http://pywinauto.pbwiki.com

--
Lawrence - http://www.oluyede.org/blog
"Nothing is more dangerous than an idea
if it's the only one you have" - E. A. Chartier
Back to top
Roger Upole
*nix forums Guru Wannabe


Joined: 24 Feb 2005
Posts: 139

PostPosted: Tue Jul 04, 2006 6:35 am    Post subject: Re: Controlling Windows Media Player from Python Reply with quote

"Jeffrey Barish" <jeff_barish@earthlink.net> wrote in message news:mailman.7729.1151941150.27775.python-list@python.org...
Quote:
Is there a way to interact with Windows Media Player from Python? I would
like to be able to do things like tell WMP to play a given sound file or to
ask WMP for metadata about a sound file.
--
Jeffrey Barish

WMP can be automated using COM:

import win32com.client

w=win32com.client.gencache.EnsureDispatch('WMPlayer.OCX',0)
pl=w.playlistCollection.getByName('All Music')[0]
s=pl[0]
print s.name, s.duration
w.currentMedia=s

Roger
Back to top
Alex Biddle
*nix forums beginner


Joined: 03 Jul 2006
Posts: 7

PostPosted: Tue Jul 04, 2006 8:27 am    Post subject: Re: Controlling Windows Media Player from Python Reply with quote

Quote:

Take a look at pywinauto, I attended the today talk at EP2006 and seemed
really cool. http://pywinauto.pbwiki.com



Cool, that looks really interesting.

....theres a problem I could solve with that....
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [5 Posts] View previous topic :: View next topic
The time now is Fri Jul 30, 2010 2:58 am | All times are GMT
navigation Forum index » Programming » python
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts problem with windows installer Christian Rengstl PostgreSQL 0 Fri Jul 21, 2006 10:55 am
No new posts Python proficiency test Kent Johnson python 0 Fri Jul 21, 2006 10:47 am
No new posts Problem with Win32-SerialPort over bluetooth @ windows + ... ctloh Perl 0 Fri Jul 21, 2006 8:08 am
No new posts flash player Osman Kemal Kadiroglu Suse 2 Fri Jul 21, 2006 7:01 am
No new posts Capturing user login Information of windows sachin PHP 3 Fri Jul 21, 2006 5:44 am

Copyright © 2004-2005 DeniX Solutions SRL   Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum |  Privacy Policy



Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1037s ][ Queries: 14 (0.0754s) ][ GZIP on - Debug on ]