Note that there are some explanatory texts on larger screens.

plurals
  1. POiTunes COM - How to acess Lyrics
    text
    copied!<p>I have been messing around with iTunes COM from python.</p> <p>However, I haven't been able to access the Lyrics of any track.</p> <p>I have been using python for this. Here is the code:</p> <pre><code>&gt;&gt;&gt; import win32com.client &gt;&gt;&gt; itunes = win32com.client.Dispatch("iTunes.Application") &gt;&gt;&gt; lib = itunes.LibraryPlaylist &gt;&gt;&gt; tracks = lib.Tracks &gt;&gt;&gt; tracks &lt;win32com.gen_py.iTunes 1.12 Type Library.IITTrackCollection instance at 0x16726176&gt; &gt;&gt;&gt; tracks[1] &lt;win32com.gen_py.iTunes 1.12 Type Library.IITTrack instance at 0x16746256&gt; &gt;&gt;&gt; tracks[1].Lyrics Traceback (most recent call last): File "&lt;interactive input&gt;", line 1, in &lt;module&gt; File "D:\Programas\Python26\lib\site-packages\win32com\client\__init__.py", line 462, in __getattr__ raise AttributeError("'%s' object has no attribute '%s'" % (repr(self), attr)) AttributeError: '&lt;win32com.gen_py.iTunes 1.12 Type Library.IITTrack instance at 0x16780824&gt;' object has no attribute 'Lyrics' </code></pre> <p>tracks[1] has no attribute 'Lyrics' because it is of type 'IITTrack'. Only 'IITFileOrCDTrack', which is a sub-type of 'IITTrack' has this attribute. My question is how to access the 'IITFileOrCDTrack's? Or how to convert a 'IITTrack' to a 'IITFileOrCDTrack'? </p> <p>Any help on this is greatly appreciated. Thanks.</p> <p>P.S: Info on how to download documentation of iTunes COM interface <a href="http://www.paraesthesia.com/archive/2009/05/20/itunes-com-for-windows-sdk-now-in-adc.aspx" rel="nofollow noreferrer">here</a>.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload