def main(): mount_point = '/media/IPOD' db = Database(mount_point) try: # db.__repr__() folders = list_files('/home/don/Music') remove_deleted(db, folders) copy_tracks(db, folders) # switch_to_podcast(db) # list_all(db) # remove_all(db) filename = '/home/don/Music/NPR: Planet Money Podcast/npr_157681373.mp3' # copy_file(db, filename) db.copy_delayed_files() print "%sMB free space remaining." % get_fs_freespace(mount_point) print 'Success.' finally: db.close() print 'Done.'
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()
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)
def __init__(self, config): self.db = Database(config.mount) print 'created %s' % db