Guest User

Untitled

a guest
Oct 31st, 2025
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.00 KB | Music | 0 0
  1. 🚀 The Ultimate AI Playlist Setup Guide
  2.  
  3. We are creating three files: one for the initial data export/setup (plex_music_exporter.py), one for the final playlist creation (ai_playlist_builder.py), and one simple shell script for daily use (new_playlist.sh).
  4.  
  5. Step 1: Initial Setup & Dependencies
  6.  
  7. 1 SSH into your server and go to your working directory.
  8. 2 Activate your environment (if it's not already active):
Bash

source plex_ai_env/bin/activate
  9. 3 



  10. 4 Install/Update Dependencies (This ensures you have the latest stable tools):
Bash

pip install plexapi google-genai pydantic
  11. 5 



(Note: If you didn't install screen yet, run sudo apt install screen now to handle background running.)
  12.  
  13.  
  14. Step 2: Create the Data Exporter (plex_music_exporter.py)
  15.  
  16. This script runs weekly to refresh your entire library and upload it to Gemini's storage, saving you API costs.
  17. Create the file and paste the code below. Remember to replace all {INSERT YOUR...} placeholders.
  18. https://colab.research.google.com/drive/15gqZz7wr2MVRYIwcbGnHG-v-8LmXoMD6?usp=sharing
  19.  
  20.  
  21.  
  22.  
  23. 🏃 First Run (The Long Wait)
  24.  
  25. 1 Save the file.
  26. 2 Run this script in a screen session (if you have thousands of tracks) to perform the initial large upload:
Bash

screen -S exporter-init
  27. 3 source plex_ai_env/bin/activate
  28. 4 python3 plex_music_exporter.py
  29. 5 # Press Ctrl + A, then D to detach and safely close your Mac.
  30. 6
  31. 7 



  32.  
  33.  
  34. Step 3: Create the Playlist Builder (ai_playlist_builder.py)
  35.  
  36. This script handles the AI communication, the retry loop for guaranteed length, and the tricky Plex search.
  37. Create the file and paste the code below:
  38. https://colab.research.google.com/drive/1qkHFoAzDYppkI1T97n7RLwGUQgnnRWQ6?usp=sharing
  39.  
  40.  
  41.  
  42. Step 4: 💾 File: new_playlist.sh (Usability Interface)
  43.  
  44. Create the file named new_playlist.sh and paste the following code:
  45. #!/bin/bash
  46.  
  47. # 1. Activate the Python virtual environment
  48. # IMPORTANT: Replace /home/user/ with your actual user path (e.g., /home/chris/)
  49. source /home/user/plex_ai_env/bin/activate
  50.  
  51. # 2. Ask the user for the playlist prompt
  52. echo "--------------------------------------------------------"
  53. echo " AI PLAYLIST CREATOR"
  54. echo "--------------------------------------------------------"
  55. echo "Enter your request (e.g., '90s Grunge with female vocals'):"
  56. read -r USER_PROMPT
  57.  
  58. # 3. Ask the user for the max track count
  59. echo "Enter MAX number of tracks (e.g., 10 or 45):"
  60. read -r MAX_TRACKS
  61.  
  62. # 4. Run the Python script with BOTH arguments
  63. # IMPORTANT: Replace /home/user/ with your actual user path (e.g., /home/chris/)
  64. /home/user/plex_ai_env/bin/python /home/user/ai_playlist_builder.py "$USER_PROMPT" "$MAX_TRACKS"
  65.  
  66. # 5. Deactivate environment
  67. deactivate
  68.  
  69.  
  70.  
  71. Final Steps to Run the System:
  72.  
  73. 1 Save the file (Ctrl + O, Enter, Ctrl + X).
  74. 2 Make the script executable:
Bash

chmod +x new_playlist.sh
  75. 3 3. **Run your new interface:**
  76. 4 ```bash
  77. 5 ./new_playlist.sh
  78. 6
  79. 7 



  80. You now have the full, end-to-end stable system!
  81.  
Advertisement
Add Comment
Please, Sign In to add comment