I seem to have left my iPod playing when I got home last night, 'cos it was dead this morning. I hate commuting without music. (It's happy enough now though - it was just the battery.)
Besides which, being the nerd I am, I had to knock this up to make sure that my metadata is still correct:
import win32com.client
def main():
iTunes = win32com.client.gencache.EnsureDispatch("iTunes.Application")
quiet_tracks_playlist = iTunes.LibrarySource.Playlists.ItemByName('Reduce Played Count')
for track in quiet_tracks_playlist.Tracks:
print 'reducing played count for', track.Artist, '-', track.Album, '-', track.Name, 'from', track.PlayedCount,
track.PlayedCount -= 1
print 'to', track.PlayedCount
if __name__ == '__main__':
main()
How sad is that?
(I suppose that I'll be learning how to script iTunes all over again once I've got my new Mac.)
Why do I care about re-setting the played count? 'Cos I want this to be right:
import datetime
import time
import win32com.client
def main():
iTunes = win32com.client.gencache.EnsureDispatch("iTunes.Application")
total_time = datetime.timedelta(0)
for track in iTunes.LibraryPlaylist.Tracks:
try:
track_time = time.strptime(track.Time, '%M:%S')
except ValueError:
track_time = time.strptime(track.Time, '%H:%M:%S')
track_length = datetime.timedelta(hours=track_time.tm_hour,
minutes=track_time.tm_min,
seconds=track_time.tm_sec)
track_time = track_length * track.PlayedCount
total_time += track_time
print 'Total iPod time:', total_time
if __name__ == '__main__':
main()
raw_input('Hit enter to continue...')
And how sad is that?
Posted to iPod by Simon Brunning at August 17, 2005 05:08 PMSimon, what are you using to script itunes on your pc? When I had my mac I had loads of mac scripts....
Posted by: Mark Boyce on August 18, 2005 04:09 PMPython. What, is there anything else? ;-)
Posted by: Simon Brunning on August 18, 2005 04:11 PMsuckit sexiest soccer team picture closeup cum ebony domina
Posted by: Sasha on October 27, 2008 08:17 AMgirl hockey players hoodcanalbridge girl scout uniforms tulare pics of almost nude ladies
Posted by: Future_dim on October 29, 2008 06:57 AMPosted by: Future_dim on November 1, 2008 04:16 AM
Posted by: Future_dim on November 1, 2008 04:16 AM
Posted by: Future_dim on November 1, 2008 04:17 AM