Python yandex music Library
Pull request Compare This branch is 1 commit behind nvbn:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Python YaMusic Readme

This library for using yandex music in python with orm and cursor.

Using ORM

Import models:
>>> from import Artist, Album, Track
Use filter for iterate result:
>>> Track.objects.filter(title='this must be', artist__title='royksopp', album__title='junior')
>>> Album.objects.filter(artist__title='royksopp', title='junior')
>>> Artist.objects.filter(title='royksopp')
For managing iterated filter result you can use:
>>> Track.objects.filter(artist__title='unkle').all()
>>> Album.objects.filter(artist__title='a place')[1:5:2]
>>> Artist.objects.filter(title='the')[5]
If you want to get single item use get instead filter:
>>> Track.objects.get(title='this must be', artist__title='royksopp', album__title='junior')
>>> Album.objects.get(artist__title='royksopp', title='junior')
>>> Artist.objects.get(title='royksopp')
You can get Album and Artist by id:
>>> Artist.objects.get(id=49522)
>>> Album.objects.get(id=34596)
For getting track you need id and on of album, album__id or album__title
>>> Track.objects.get(id=id, album__id=album__id)
Or if you only need play use id and storage_dir:
>>> Track.objects.get(id=id, storage_dir=storage_dir)

Using cursor [deprecated]

Import search app:
>>> from import Search, cursor
Cursor can search artists:
>>>, 'query')
>>>, 'query')
And tracks:
>>>, 'query')
If single=True, search return one item:
>>>, 'query', single=True)

Else - return iterator.

Work with search result

For getting data from albums and artists use:
>>> artist.get_albums()
>>> artist.get_tracks()
>>> album.get_tracks()
For opening track like file use:
For fast getting data objects have:
>>> track.artist
>>> track.album
>>> track.title
>>> album.artist
>>> album.title
>>> artist.title

Other you can find in source.