473,395 Members | 2,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Controlling Windows Media Player from Python

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

Jul 3 '06 #1
4 7915

Jeffrey Barish wrote:
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.

Jul 3 '06 #2
Jeffrey Barish <je*********@earthlink.netwrote:
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
Jul 4 '06 #3
"Jeffrey Barish" <je*********@earthlink.netwrote in message news:ma***************************************@pyt hon.org...
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('WMPlaye r.OCX',0)
pl=w.playlistCollection.getByName('All Music')[0]
s=pl[0]
print s.name, s.duration
w.currentMedia=s

Roger
Jul 4 '06 #4
>
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....
Jul 4 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Bart Simpson | last post by:
Hi, I would like to create/delete ftp accounts of windows IIS, and to control MS Media Service under windows 2003 by Python program. A few days ago, I found there is iisftp.vbs vb-script that...
0
by: Mickel Grönroos | last post by:
Hi! Anybody tried using Windows Media Player 9 via win32com? (And more precisely, combining that with a Tkinter application.) I found a few earlier threads on Windows Media Player and Python,...
1
by: Anise | last post by:
I have a question concerning embedding a windows media player into a web application in .net.. I download Windows Media Player 10 and its SDK On the .ascx page I placed a windows media player...
1
by: Stephen Adam | last post by:
Hi there, Have spent a while trying to find out how to connect to Windows Media Player through COM. Unfortunately there doesnt seem to be much stuff about it on the web. What I need to do is...
4
by: BobAchgill | last post by:
What is the best way to show a video file directly in a Form? Can I use functions of Windows Player in a Windows Form? Functions like: play video or show visualization for music, etc.
3
by: UJ | last post by:
I have a .avi file that uses the Divx codec. If I load it with windows media player program it works fine. If I load it using my control in a program, it doesn't display. Over standard media files...
1
by: sri2097 | last post by:
Basically, I want to check if a URL is playable or not (without actually playing it). i.e. given a URL I want to write an automation script to figure it out for me if it's playable or not. If...
3
by: Herb | last post by:
I've found how to use javascript to embed a Windows Media Player in a web page. How do I go about controlling the player in response to user input? There should be calls to start, stop and also...
0
by: artsohc | last post by:
Hey Everyone, this is my first time posting so go easy on me. I am trying to hook up music-on-hold at the office I work at. I got all the music loaded and I got Windows Media Player working while...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.