RADIO PROJECT 1 - INTRODUCTION 2 - SPOTIFY ISSUES 3 - SOLUTIONS 4 - PROJECT 5 - GETTING STARTED (INSTALLING PYTHON) 6 - SPOTIFY APP INTEGRATION 7 - REQUIRED PLAYLISTS 8 - SECRETS.PY SETTINGS 9 - OTHER 10 - OPTIONAL EXTRAS 11 - CREDITS https://github.com/Anku5hk/Programmers_guide_to_Python/blob/FEED/book.md 1 - INTRODUCTION By utilising Spotify s API (Application Program Interface) and Python scripting language, it's possible to manipulate Spotify playlists in a number of ways to enhance your listening experience. Tis is just one of them. 2 - SPOTIFY ISSUES Anyone that has a large favorites playlist, will know that it s easy to lose your place in Spotify's 'Custom order of play. (Unless you change the sort order using the Windows Spotify App or play tracks with SHUFFLED on). If you play any tracks outside of that playlist, currently there is no way to 'bookmark' the last played track. Also, Spotify's shuffle is probably the most complained about function, but there's a work-around for that too! See CUSTOM SORT.TXT for more details. 3 - SOLUTIONS Using this Python script, you no longer need to scroll through your FAVORITES (FEED) playlist, as the next track (least recently played/added), should always be first in the playlist and will maintain a 50 track MIXTAPE static playlist that's always available to play. (change required 'queue_max' in module 'bot_04.py' - line 17). 4 - PROJECT The App consists of a series of small modules of Python code. The modules make testing easier as it provides the ability to check each individual section of functionality to ensure it performs as expected. When completed, simply run 'main.py'. RADIO PROJECT makes use of 3 playlists, FEED, MIXER and MIXTAPE - (optional a BACKUP of FEED). 4.1) Removes up to 50 recently played tracks from the MIXTAPE playlist. 4.2) When MIXTAPE track total drops below (selected) number, tracks in position #1 to #50 copied from FEED to MIXER, overwriting any that already exist in MIXER. 4.3) Removes those tracks from FEED, so that the next batch of 50 moves to the top postion. 4.4) Shuffles the added tracks in MIXER. 4.5) Shuffled tracks are copied back to FEED to become to the bottom, to complete the cycle. 4.6) Shuffled tracks are then copied to MIXTAPE. We suggest that you start off with TEST playlists until you're confident that all is functioning as expected before trying it on a live FEED, MIXER and MIXTAPE. File "main.py" can be run at any time, and will only top-up to a total of 50 tracks maximun in MIXTAPE if some have already been played. Any additional tracks that you manually add to FEED will get placed at the end of that playlist, so if you have a very large FEED playlist, it may take months before the tracks appear in your MIXTAPE. 5 - GETTING STARTED - INSTALLING PYTHON 5.1) Check the version of Windows operating system. Click Start button > Settings > System > About. Under Device specifications = [64-bit operating system, x64-based processor] 5.2) Download latest version of Python. https://www.python.org/downloads/windows/ 5.3) Uninstall any current version of Python. Control Panel > Uninstall a program. 5.4) Install Python. C:\Users\User\AppData\Local\Programs\Python\Python39 Tick the checkbox "Add Python 3.9 to PATH" Click Install Now. 5.5) Run CMD window in Admin mode. python -m pip install --upgrade pip python -m pip install requests 6 - YOU WILL NEED SPOTIFY APP INTEGRATION To create a Spotify App Integration Application , follow the steps in App Building For Beginners And / or watch this YouTube video https://www.youtube.com/watch?v=jzH3n5GvmoA 7 - REQUIRED PLAYLISTS Botify makes use of 3 playlists: FEED, MIXER and MIXTAPE. Just load FEED with your favorite tracks and add the URI s of all 3 into "secrets.py" 8 - SECRETS.PY SETTINGS Add these detals to "secrets.py". [a] Your "spotify_user_id". [b] Your "refresh_token" [c] Your "base_64" [d] The URI of your FEED playlist to "feed_id": [e] The URI of your MIXER playlist to "mixer_id" : [f] The URI of your MIXTAPE playlist to "mixtape_id": 9 - OTHER You can manually reorder tracks with 'drag-and-drop' using the Windows app. Playlists can only be re-ordered if they are displayed in their original 'custom order' , so you may need to change the playlist sort view. To do this, click the column that displays the arrow until the arrow disappears then the column is reset. 10 - OPTIONAL EXTRAS REJECTS Using the Python module 'bot_RJ.py' you can add an extra playlist REJECTS, to store any tracks you no longer like or want in your collection. Just include the REJECTS URL, plus those of any other playlists in your library, to easily rid them of those rejected tracks. FANCY HEADER For fancy ASCII header in FEED menu:- pip install pyfiglet https://www.devdungeon.com/content/create-ascii-art-text-banners-python http://www.figlet.org/examples.html BEAUTIFUL SOUP Install Beautuful Soup to display logfile results in html. https://www.crummy.com/software/BeautifulSoup/ pip install beautifulsoup4 11 - CREDITS Original concept, API format, code fixes, courtesy of Euan Morgan. https://euanmorgan.github.io Ideas spawned by Euan s YouTube video https://www.youtube.com/watch?v=jzH3n5GvmoA Last update: 27 Jan 2022