import os from api import AppleMusic import unicodedata def…
- User
import os from api import AppleMusic import unicodedata
def check_explicitness(album_link): # Initialize AppleMusic object apple_music = AppleMusic(cache="./cache", sync=1, skipVideo=False)
code# Get album ID and name from the provided link album_id = album_link.split('/')[-1].split('?')[0] # Extract album ID from the URL album_name = album_link.split('/')[-2] # Extract album name from the URL # Construct valid album link valid_album_link = f"https://music.apple.com/us/album/{album_name}/{album_id}" # Print constructed URL print("Constructed URL:", valid_album_link) # Get information about the album from the constructed valid link album_info = apple_music.getInfo(valid_album_link) # Check if any tracks are explicit is_explicit = any(track_info.get('rating', '') == 'Explicit' for track_info in album_info["streams"]) # Modify album name and add [E] if explicit if is_explicit: album_name += " [E]" # Ask user for the directory to save the file save_directory = input("Please provide the directory path to save the 'album_infosse.txt' file: ") file_path = os.path.join(save_directory, "album_infosse.txt") print("album_infosse.txt -- saved") with open(file_path, "w") as file: # Write modified album name to file file.write(f"Album: {album_name}\n\n") file.write(f"Album_ID: {album_id}\n\n") # Write track details to file for track_info in album_info["streams"]: track_name = track_info['song'] explicitness = track_info.get('rating', 'Not Explicit') credits = track_info.get('credits', {}) credits_str = ", ".join([f"{role}: {', '.join(artists)}" for role, artists in credits.items()]) # Add [E] to track name if explicit if explicitness == 'Explicit': track_name += " [E]" file.write(f"Track: {track_name}\n") file.write(f"Explicitness: {explicitness}\n") file.write(f"Credits: {credits_str}\n\n") # Rename album and track files rename_album_and_tracks(save_directory, album_name, album_info["streams"]) - Assistant
- User
(myenv) C:\Users\ILEG-i5-11\Desktop\Needed\API1 full response with AUTH>python gter.py Please provide the directory path where 'apple_music_link.txt' is located: D:\ALAC features(enabled)\apple-music-alac-atmos-downloader\AM-DL downloads\Demi Lovato\REVAMPED [20:23:48] [ManzanaCore] INFO: Checking access token found in cache... [20:23:49] [ManzanaCore] INFO: Checking media-user-token... Constructed URL: https://music.apple.com/us/album/revamped/1697368699 [20:23:51] [ManzanaCore] INFO: Fetching api response... [20:23:51] [ManzanaCore] INFO: Using the previous response found in cache... Please provide the directory path to save the 'album_infosse.txt' file: D:\ALAC features(enabled)\apple-music-alac-atmos-downloader\AM-DL downloads\Demi Lovato\REVAMPED 'album_infosse.txt' saved in D:\ALAC features(enabled)\apple-music-alac-atmos-downloader\AM-DL downloads\Demi Lovato\REVAMPED Error: Album directory for 'revamped' not found in 'D:\ALAC features(enabled)\apple-music-alac-atmos-downloader\AM-DL downloads\Demi Lovato\REVAMPED'.
- Assistant
- User
- Assistant
- User
(myenv) C:\Users\ILEG-i5-11\Desktop\Needed\API1 full response with AUTH>python gter.py Please provide the directory path where 'apple_music_link.txt' is located: D:\ALAC features(enabled)\apple-music-alac-atmos-downloader\AM-DL downloads\Demi Lovato\REVAMPED [20:30:25] [ManzanaCore] INFO: Checking access token found in cache... [20:30:26] [ManzanaCore] INFO: Checking media-user-token... Constructed URL: https://music.apple.com/us/album/revamped/1697368699 [20:30:28] [ManzanaCore] INFO: Fetching api response... [20:30:28] [ManzanaCore] INFO: Using the previous response found in cache... Please provide the directory path to save the 'album_infosse.txt' file: D:\ALAC features(enabled)\apple-music-alac-atmos-downloader\AM-DL downloads\Demi Lovato\REVAMPED 'album_infosse.txt' saved in D:\ALAC features(enabled)\apple-music-alac-atmos-downloader\AM-DL downloads\Demi Lovato\REVAMPED Error: Album directory 'revamped' not found in 'D:\ALAC features(enabled)\apple-music-alac-atmos-downloader\AM-DL downloads\Demi Lovato\REVAMPED' Do you want to choose a different directory? (y/n): y Enter the new directory path: D:\ALAC features(enabled)\apple-music-alac-atmos-downloader\AM-DL downloads\Demi Lovato
Processing files in: D:\ALAC features(enabled)\apple-music-alac-atmos-downloader\AM-DL downloads\Demi Lovato\REVAMPED - Assistant