コード例 #1
0
ファイル: disk.py プロジェクト: andrewcooke/ypod
 def test_sync_mp3(self):
     config = Config(db='sqlite://')
     Session = create_session(config)
     session = Session()
     sync_mp3(config, session)
     assert Track.count(session) == 141, Track.count(session)
     assert Artist.count(session) == 27, Artist.count(session)
     assert Album.count(session) == 12, Album.count(session)
コード例 #2
0
ファイル: schema.py プロジェクト: andrewcooke/ypod
 def test_next_disk_generation(self):
     config = Config(db="sqlite://")
     Session = create_session(config)
     session = Session()
     artist = Artist(name="bob")
     session.add(artist)
     album = Album(name="bob sings")
     session.add(album)
     track = Track(artist=artist, album=album, name="a sad song", disk_generation=3, path="/music/bob/songs")
     session.add(track)
     session.commit()
     assert Track.current_disk_generation(session) == 3
     track = session.query(Track).filter(Track.name == "a sad song").one()
     assert track.name == "a sad song"
     assert track.artist.name == "bob"
     artist = session.query(Artist).filter(Artist.name == "bob").one()
     assert artist.name == "bob"
     assert track.artist == artist
コード例 #3
0
ファイル: schema.py プロジェクト: andrewcooke/ypod
 def test_schema(self):
     config = Config(db="sqlite://")
     Session = create_session(config)
     session = Session()
     assert Track.current_disk_generation(session) == 0, Track.current_disk_generation(session)
コード例 #4
0
ファイル: disk.py プロジェクト: andrewcooke/ypod
def sync_mp3(config, session):
    next_gen = 1 + Track.current_disk_generation(session)
    for root, dirs, files in walk(config.mp3):
        if files:
            sync_album(session, next_gen, root, files)
    session.commit()