Update of /cvsroot/gtkpod/libgpod/bindings/python/examples
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28578

Modified Files:
        Makefile.am 
Added Files:
        create_mp3_tags_from_itdb.py 
Log Message:
Add create_mp3_tags_from_itdb.py from Thomas Perl

--- NEW FILE: create_mp3_tags_from_itdb.py ---
#!/usr/bin/env python
# create_mp3_tags_from_itdb.py (Populate iPod's MP3 tags with data from 
iTunesDB)
# Copyright (c) 20060423 Thomas Perl <thp at perli.net>
#
# I wrote this small script to populate MP3 files on my iPod that have set 
# artist/title/album data in their iTunesDB entry, but not in their ID3 tag.
#
# This makes it possible to import your iPod_Control folder with any tool
# you like or even import it into Rockbox' (www.rockbox.org) nifty TagCache.
#
# This file comes with no warranty. It might even kill your iPod, delete all
# your songs, or do some other nasty stuff. Then again, it might just work ;)
#
# Release under the terms of the GNU LGPL.
#
#  The code contained in this file is free software; you can redistribute
#  it and/or modify it under the terms of the GNU Lesser General Public
#  License as published by the Free Software Foundation; either version
#  2.1 of the License, or (at your option) any later version.
#
#  This file is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#  Lesser General Public License for more details.
#
#  You should have received a copy of the GNU Lesser General Public
#  License along with this code; if not, write to the Free Software
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#

import gpod
import eyeD3

# please specify your iPod mountpoint here..
IPOD_MOUNT = '/media/ipod/'

itdb = gpod.itdb_parse( IPOD_MOUNT, None)

if not itdb:
    print 'Cannot open iPod at %s' % ( IPOD_MOUNT )
    sys.exit( 2)

# just for some stats..
counter_upd = 0
counter_left = 0

for track in gpod.sw_get_tracks( itdb):
    if track.artist is None or track.title is None or track.album is None:
        # silently ignore
        continue

    filename = gpod.itdb_filename_on_ipod( track)
    try:
        tag = eyeD3.Tag()
        tag.link( filename)
        if tag.link( filename) != True:
            print ''
            print '%s has no id3 tags' % ( filename )
            print 'iTDB says: AR = %s, TI = %s, AL = %s' % ( track.artist, 
track.title, track.album )
            tag.setVersion( eyeD3.ID3_DEFAULT_VERSION)
            tag.setArtist( track.artist)
            tag.setAlbum( track.album)
            tag.setTitle( track.title)
            tag.addComment( 'tagged from itdb with libgpod')
            tag.update()
            counter_upd = counter_upd + 1
            print 'wrote tags to: %s' % ( filename )
    except:
        print 'informative debug output: something went wrong.. :/'
        counter_left = counter_left + 1

print ''
print ' ++ results ++'
print "updated: %d\nleft as-is: %d" % ( counter_upd, counter_left )
print ''


Index: Makefile.am
===================================================================
RCS file: /cvsroot/gtkpod/libgpod/bindings/python/examples/Makefile.am,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- Makefile.am 9 Apr 2006 16:38:12 -0000       1.3
+++ Makefile.am 24 Apr 2006 09:49:10 -0000      1.4
@@ -1,4 +1,3 @@
 EXTRA_DIST = coverart_fetch.py toy_around.py \
              tag_genre_from_audioscrobber.py add_song.py \
-             playwith_ipod_api.py
-
+             playwith_ipod_api.py create_mp3_tags_from_itdb.py



-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to