funkwhale/api/funkwhale_api/music/fake_data.py

24 wiersze
585 B
Python
Czysty Zwykły widok Historia

2017-12-12 21:58:17 +00:00
"""
Populates the database with fake data
"""
import random
2018-01-11 20:35:51 +00:00
from funkwhale_api.music import factories
2017-12-12 21:58:17 +00:00
def create_data(count=25):
artists = factories.ArtistFactory.create_batch(size=count)
for artist in artists:
2018-06-09 13:36:16 +00:00
print("Creating data for", artist)
2017-12-12 21:58:17 +00:00
albums = factories.AlbumFactory.create_batch(
2018-06-09 13:36:16 +00:00
artist=artist, size=random.randint(1, 5)
)
2017-12-12 21:58:17 +00:00
for album in albums:
2018-09-22 12:29:30 +00:00
factories.UploadFactory.create_batch(
2018-06-09 13:36:16 +00:00
track__album=album, size=random.randint(3, 18)
)
2017-12-12 21:58:17 +00:00
2018-06-09 13:36:16 +00:00
if __name__ == "__main__":
2018-01-11 20:35:51 +00:00
create_data()