Back to Home

Sorting tracks in a VK playlist

python · vk api · music · sorting

Sorting tracks in a VK playlist



    Disclaimer: I started writing this script when the fun news hadn't arrived yet.

    I will be brief.
    • What does it do?
      • Reorders the tracks in your playlist on VK so that with minimal intervention it looks neater.
    • Where to get?
    • How to use?
      • You will need the Python 2.7.x . Download, install. You take a file vk_music_organizer.pyfrom the archive, open it in a notebook, at the very beginning, write in lines email = '...'and password = '...'your username and password, respectively. Save. If you have Python installed correctly, then after that just start this file with a double click.


    • How does it work?
      • The sorting algorithm is as follows:
        1. Break all the tracks into albums, if the user has one, drop all the tracks without the specified album into one unnamed album. All albums sorted alphabetically, nameless put first.
        2. Go through all the tracks inside each album and combine the chains of tracks in a row with one artist into clusters.
        3. Inside each album, for all artists met, find the largest cluster with them. From the same size, select the first one in the list.
        4. Drag and drop all the tracks that are not in the largest cluster of your artist into this cluster.
        5. Combine all the clusters inside each album in a row. Combine all albums.

        In addition to sorting, there is nothing particularly meaningful there. I use the authorizer and API call code from this article. Apart from sorting, the operation of the program is limited to one request to audio.get, one to audio.getAlbumsand a bunch of to audio.reorder. Free bonus: all tracks that fall under the harsh hand of copyright are sent to the basement.

    The script is provided as is, with all the bugs and flaws. Use at your own risk. Enjoy!

    Read Next