-
Notifications
You must be signed in to change notification settings - Fork 0
How it Works
Playlist Archiver works by utilizing the YouTube Data API to retrieve metadata from playlists. It parses playlist URLs to extract IDs and fetches data, which is then serialized and saved locally in structured JSON files. JSON files are deserialized when needed. The program uses the Spotify API to export playlists by creating new Spotify playlists and matching YouTube songs to Spotify tracks.
The Caller class is designed for interacting with the YouTube Data API and Spotify API to retrieve and manage playlists. Its methods are focused on fetching data, and exporting data to Spotify.
Fetches metadata and all videos in a YouTube playlist from its URL. Input: Playlist URL (address) Output: Metadata and video data in a tuple.
Description: Retrieves all playlists from a specified YouTube channel. Input: Channel ID (channel_id) Output: A dictionary containing playlists' metadata.
Description: Gets detailed information about a playlist by its ID. Input: Playlist ID (playlist_id) Output: Tuple with playlist metadata and video data.
Description: Creates a Spotify playlist, adds songs, and organizes them. Input: Playlist Name (playlist_name), Playlist Description (playlist_description), List of songs (songs)
This class provides functionality for managing YouTube playlists by handling playlist records. The class also enables users to save, load, and update playlists while maintaining their structure.
This method creates and stores multiple playlist records by retrieving playlists from a given channel address. The includes parameter determines which metadata fields should be included in the records.
Generates a new playlist record based on the provided playlist address. The includes parameter specifies the fields to be included in the record.
Returns the name of a playlist. If sanitized is True, the name will be stripped of invalid file system characters. The playlist_index specifies which playlist to retrieve.
Provides a brief summary of the specified playlist, such as its title, description, and item count.
Loads a playlist record from a specified file path and integrates it into the program’s playlist management system.
compare_playlist_record_with_online(playlist_index: int = 0, by_index: bool = True, by_ids: bool = True) -> None
Compares the local playlist record with the online version. The by_index parameter checks positions, while by_ids verifies video IDs.
update_playlist_record(playlist_index: int = 0, remove_missing: bool = False, add_new: bool = True) -> None
Synchronizes the local playlist record with the corresponding online playlist. Missing items can be removed, and new items can be added based on the parameters.
save_playlist_record(filepath: str, playlist_index: int = 0, remove_from_list: bool = False, safe_to_save: bool = True) -> None
Saves the specified playlist record to a file. The remove_from_list parameter determines if the playlist is removed from the current session after saving.
save_multiple_playlist_records(filepath: str, safe_to_save: bool = True, get_unique_names: bool = True) -> None
Saves multiple playlist records to files. If get_unique_names is True, each file will have a unique name to prevent overwriting.
Exports the specified playlist to Spotify. Returns the number of songs successfully added to the Spotify playlist.
Resets the state of the PlaylistManager by clearing all loaded playlists and resetting the internal state to free.