4

iTunes has the old location (file path that no longer exist) of track with ! in front of them. I know this because if you right click on track with ! in front of it and select GetInfo (then choose no, don't locate it). Under Summary tab it has a section that shows the song's path (not working). when I try to get the track location using iTumes COM, IITFileOrCDTrack.location return empty string. So, how do I get this "where" value from Getinfo --> Summary tab?

Below is how I currently try to get track location (using C#). My entire iTunes lib has 10songs all of them point to the wrong file location so it doesn't matter which song I chose.

iTunesApp itunes = new iTunesApp(); IITLibraryPlaylist mainLibrary = itunes.LibraryPlaylist; IITTrackCollection tracks = mainLibrary.Tracks; IITFileOrCDTrack currTrack; currTrack = tracks[5] as IITFileOrCDTrack; Console.WriteLine(currTrack.location) //output is blank. 

1 Answer 1

1

When the file is found, the "where" value shows C:\... but when the file is not found, it shows file:\\C:\... within iTunes, and from the code, you can access the location by using the Location property (a bug perhaps, with your code - capitalize the 'L' in 'Location')

From the SDK documentation:

HRESULT Location ([out, retval] BSTR *location)

Returns the full path to the file represented by this track.

Parameters: location Returns the full path to the file represented by this track.

Return values:

S_OK The operation was successful.
S_FALSE The location could not be retrieved (e.g. no file exists at the expected location).
E_POINTER location is NULL.
ITUNES_E_OBJECTDELETED This track has been deleted.
E_FAIL An unexpected error occurred.

I was able to reproduce this (i.e. see the "where" value in itunes, when the file cannot be found, and get null returned from IITFileOrCDTrack.Location. I don't think it is Unless it is undocumented, it is not possible to return the value if the actual file cannot be found.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.