Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #75080
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <DMusiige@sennheisercommunications.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.005 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'mrab': 0.05; 'init': 0.07; '__name__': 0.09; 'assuming': 0.09; 'attributes': 0.09; 'tune': 0.09; 'unittest': 0.09; 'windows': 0.15; "'''": 0.16; "'__main__':": 0.16; '12:57': 0.16; 'missing?': 0.16; 'perfect.': 0.16; 'skip:[ 50': 0.16; 'subject:media': 0.16; 'subject:windows': 0.16; 'win7': 0.16; 'fix': 0.17; 'wrote:': 0.18; 'code.': 0.18; 'file,': 0.19; 'message-----': 0.19; 'import': 0.22; 'to:name :python-list@python.org': 0.22; 'instance,': 0.24; 'player': 0.26; 'primary': 0.26; 'header:In-Reply-To:1': 0.27; 'to:2**1': 0.27; 'testing': 0.29; "i'm": 0.30; 'url:mailman': 0.30; 'code': 0.31; 'class': 0.32; 'skip:c 30': 0.32; 'skip:m 30': 0.32; 'run': 0.32; 'another': 0.32; 'url:python': 0.33; 'skip:d 20': 0.34; 'problem': 0.35; 'var': 0.36; 'url:listinfo': 0.36; 'charset:us-ascii': 0.36; 'hi,': 0.36; 'url:org': 0.36; 'email addr:python.org': 0.37; 'audio': 0.38; 'to:addr:python-list': 0.38; 'files': 0.38; 'skip:- 10': 0.38; 'fact': 0.38; 'subject:': 0.39; 'to:addr:python.org': 0.39; 'url:mail': 0.40; 'skip:u 10': 0.60; 'mentioned': 0.61; 'matter': 0.61; "you're": 0.61; 're:': 0.63; 'email name:python- list': 0.65; 'media': 0.66; 'direct': 0.67; 'mate,': 0.84; 'subject:player': 0.84; 'do:': 0.91 |
| From | Deogratius Musiige <DMusiige@sennheisercommunications.com> |
| To | MRAB <python@mrabarnett.plus.com>, "python-list@python.org" <python-list@python.org> |
| Subject | RE: Automating windows media player on win7 |
| Thread-Topic | Automating windows media player on win7 |
| Thread-Index | Ac9/Ao92/LcZpfCnSxeQrPxiZS+XUABFxWqAAFxltGAJMrY4UP///AcA///PVmA= |
| Date | Wed, 23 Jul 2014 11:55:03 +0000 |
| References | <A804AEE67207BF42BAF8CEC79839C8D613BF3275@kbnmxexc11.Demant.com> <538F7219.2020705@mrabarnett.plus.com> <A804AEE67207BF42BAF8CEC79839C8D613BF85BA@kbnmxexc11.Demant.com> <A804AEE67207BF42BAF8CEC79839C8D613C3320E@kbnmxexc11.Demant.com> <53CF950A.8040905@mrabarnett.plus.com> |
| In-Reply-To | <53CF950A.8040905@mrabarnett.plus.com> |
| Accept-Language | da-DK, en-US |
| Content-Language | en-US |
| X-MS-Has-Attach | |
| X-MS-TNEF-Correlator | |
| x-originating-ip | [10.100.3.117] |
| Content-Type | text/plain; charset="us-ascii" |
| Content-Transfer-Encoding | quoted-printable |
| MIME-Version | 1.0 |
| X-EOPAttributedMessage | 0 |
| X-Forefront-Antispam-Report | CIP:185.34.132.54; CTRY:EU; IPV:NLI; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(6009001)(438002)(189002)(51704005)(199002)(24454002)(13464003)(377424004)(23726002)(95666004)(99396002)(4396001)(85306003)(92726001)(79102001)(86362001)(76482001)(92566001)(77982001)(97756001)(106466001)(55846006)(44976005)(6806004)(46406003)(74662001)(81342001)(31966008)(81542001)(2656002)(83072002)(85852003)(74502001)(87936001)(50986999)(93886003)(104016003)(15975445006)(54356999)(76176999)(80022001)(33656002)(20776003)(47776003)(107046002)(50466002)(46102001)(77096002)(21056001)(19580405001)(83322001)(19580395003)(64706001)(53416004)(107886001)(80792004)(554374003); DIR:OUT; SFP:; SCL:1; SRVR:DB4PR02MB0607; H:mail.demant.com; FPR:; MLV:sfv; PTR:mail1.demant.com; MX:1; A:1; LANG:en; |
| X-Microsoft-Antispam | BCL:0;PCL:0;RULEID: |
| X-Forefront-PRVS | 028166BF91 |
| Received-SPF | Pass (: domain of sennheisercommunications.com designates 185.34.132.54 as permitted sender) receiver=; client-ip=185.34.132.54; helo=mail.demant.com; |
| Authentication-Results | spf=pass (sender IP is 185.34.132.54) smtp.mailfrom=DMusiige@sennheisercommunications.com; |
| X-OriginatorOrg | sennheisercommunications.com |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.12235.1406116507.18130.python-list@python.org> (permalink) |
| Lines | 115 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1406116507 news.xs4all.nl 2854 [2001:888:2000:d::a6]:51405 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:75080 |
Show key headers only | View raw
Hi,
I have the mentioned imports. And for the matter of fact I can play the audio.
The problem is when I make a class with the wmplayer automating code and make an instance of this class in my testing code.
When I run this instance, I do not get any audio out?
Best regards / Med venlig hilsen
Deogratius Musiige
Sennheiser Communications A/S
Direct +45 5618 0320
-----Original Message-----
From: Python-list [mailto:python-list-bounces+demu=senncom.com@python.org] On Behalf Of MRAB
Sent: 23. juli 2014 12:57
To: python-list@python.org
Subject: Re: Automating windows media player on win7
On 2014-07-23 10:20, Deogratius Musiige wrote:
>
> Hi mate,
>
> The fix you provided works perfect. However, if I put it in a class
> and import, make instance and execute in another file, the audio is
> not played.
>
> What am I missing? This is what I do:
>
I'm assuming that you're not actually calling the files FileA.py and FileB.py.
>
> *FileA.py*
>
You need these imports:
from win32com.client import Dispatch
from time import sleep
> classWMPlayer():
>
> '''
>
> @
>
> '''
>
> #static var
>
> #first instance is a primary , following are secondary.
>
> #you can have one primary and as many secondary as you like
>
> def__init__(self):
>
> '''
>
> init all attributes
>
> '''
>
> #self.mp = Dispatch("WMPlayer.OCX")
>
> #pass
>
> defplay_song(self):
>
> mp = Dispatch("WMPlayer.OCX")
>
> tune = mp.newMedia(r"./SleepAway.mp3")
>
> mp.currentPlaylist.appendItem(tune)
>
> mp.controls.play()
>
> sleep(1)
>
> mp.controls.playItem(tune)
>
> raw_input("Press Enter to stop playing")
>
> #sleep(5)
>
> mp.controls.stop()
>
> **
>
> *FileB.py*
>
You need this import:
import unittest
> **
>
> fromwmp.WMPlayer import*
>
> classsTest(unittest.TestCase):
>
> deftest_wmplayer(self):
>
> self.wmp = WMPlayer()
>
> self.wmp.play_song()
>
You also need to run the test:
if __name__ == '__main__':
unittest.main()
--
https://mail.python.org/mailman/listinfo/python-list
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
RE: Automating windows media player on win7 Deogratius Musiige <DMusiige@sennheisercommunications.com> - 2014-07-23 11:55 +0000
csiph-web