コード例 #1
0
ファイル: encoder.py プロジェクト: chbrown/iTunesMeta
def savePlaylists(sep='\t'):
    for playlist in iTunes.playlists(smart=False, basic=True):
        print 'Writing playlist', playlist
        with open('Playlist-%s.tsv' % playlist, 'w') as fp:
            for track in playlist.track_iter:
                cells = [unicode(getattr(track, col)) for col in playlist_cols]
                write_n(fp, sep.join(cells))
コード例 #2
0
ファイル: encoder.py プロジェクト: chbrown/iTunesMeta
def savePlaylists(sep='\t'):
    for playlist in iTunes.playlists(smart=False, basic=True):
        print 'Writing playlist', playlist
        with open('Playlist-%s.tsv' % playlist, 'w') as fp:
            for track in playlist.track_iter:
                cells = [unicode(getattr(track, col)) for col in playlist_cols]
                write_n(fp, sep.join(cells))
コード例 #3
0
ファイル: encoder.py プロジェクト: chbrown/iTunesMeta
def findDuplicates():
    duplicates = (p for p in iTunes.playlists(smart=False, basic=True) if p.name == 'Duplicates').next()

    lookup = defaultdict(list)  # track_key -> api.Track
    for track in iTunes.library.track_iter:
        track_key = '\t'.join([track.artist, track.album, track.name])
        lookup[track_key].append(track)

    for track_key, tracks in lookup.iteritems():
        if len(tracks) > 1:
            print len(tracks), track_key
            for track in tracks:
                duplicates.add_track(track)
コード例 #4
0
ファイル: encoder.py プロジェクト: chbrown/iTunesMeta
def findDuplicates():
    duplicates = (p for p in iTunes.playlists(smart=False, basic=True)
                  if p.name == 'Duplicates').next()

    lookup = defaultdict(list)  # track_key -> api.Track
    for track in iTunes.library.track_iter:
        track_key = '\t'.join([track.artist, track.album, track.name])
        lookup[track_key].append(track)

    for track_key, tracks in lookup.iteritems():
        if len(tracks) > 1:
            print len(tracks), track_key
            for track in tracks:
                duplicates.add_track(track)