Exemple #1
0
    def test_load(self):
        db = Database('/media/[email protected]')
#        db = Database('/mnt/usb')
        itdb_device_set_sysinfo(db._itdb.device, "ModelNumStr", "C297")
#        itdb_device_set_sysinfo(db._itdb.device, "ModelNumStr", "xB150")
#        itdb_device_set_sysinfo(db._itdb.device, "ModelNumStr", ITDB_IPOD_GENERATION_CLASSIC_3)
#        db.import_file("/home/andrew/project/ypod/music/ZZ Top/Tres Hombres/ZZ Top - 01 - Waitin' for the Bus.mp3")
        db.import_file('/home/andrew/project/ypod/music/Various/Underground Communication/Bassnectar - 07 - Kick It Complex (Bassnectar remix).mp3')
        db.copy_delayed_files()
        db.close()
Exemple #2
0
class GPod(object):

    def __init__(self, config):
        self.db = Database(config.mount)
        print 'created %s' % db

    def __enter__(self):
        return self

    def __exit__(self, exc_type, exc_val, exc_tb):
        print 'flushing %s' % db
        self.db.copy_delayed_files()
        print 'closing %s' % db
        self.db.close()

    def load_track(self, track):
        print 'loading: %s from %s' % (track, track.path)
        self.db.import_file(track.path)

    def delete_all_tracks(self):
        while self.db:
            print 'deleting: %s' % db[0]
            self.db.remove(db[0], ipod=True)