Skip to content

avnisinngh/YouTube-Manager---Python-Terminal-Application

Repository files navigation

YouTube Manager - Python Terminal Application

A lightweight Python-based YouTube video manager that allows users to track their favorite videos without requiring a database. This application stores video information in a simple text file using JSON format, making it perfect for beginners learning file handling and basic CRUD operations in Python.

Features

  • List Videos: View all saved YouTube videos with their names and durations
  • Add Videos: Store new YouTube videos with name and duration
  • Update Videos: Modify existing video details
  • Delete Videos: Remove videos from your collection
  • Persistent Storage: Data is saved between sessions using a text file

Code Explanation

1. Data Storage Functions

def load_data():
  try:
      with open('youtube.txt', 'r') as file:
        return json.load(file)
  except FileNotFoundError:
      return []
    
def save_data_helper(videos):
      with open('youtube.txt', 'w') as file:
        json.dump(videos, file)
  • load_data(): Reads video data from 'youtube.txt' using JSON format. If the file doesn't exist, returns an empty list.

  • save_data_helper(videos): Writes the current video list to 'youtube.txt' in JSON format.

2. Core Operations

def list_all_videos(videos):
    # Displays all videos with numbering

def add_video(videos):
    # Adds a new video with user-provided name and duration

def update_video(videos):
    # Updates an existing video's details

def delete_video(videos):
    # Removes a video from the collection

Each operation calls save_data_helper(videos) to persist changes to the file.

3. Main Application Loop

  def main():
    videos = load_data()
    while True:
        # Display menu options
        # Process user choice with match-case statement

The main function loads existing data and presents a continuous menu until the user chooses to exit.

Installation & Usage

1. Clone the repository:

  git clone https://github.com/your-username/youtube-manager.git

2. Navigate to the project directory:

  cd youtube-manager

3. Run the application:

 python youtube_manager.py

Screenshots

Menu Screenshot Video List Screenshot

File Structure

youtube-manager/
├── youtube_manager.py  # Main application file
├── youtube.txt         # Data storage file (created automatically)
├── README.md           # Project documentation
└── screenshots/        # Folder for application screenshots
    ├── menu.png
    └── video-list.png

Technologies Used

  • Python 3.10+ (for match-case feature)

  • JSON for data serialization

  • File I/O for persistent storage

Learning Outcomes

This project demonstrates:

  • File handling in Python
  • JSON serialization/deserialization
  • CRUD operations implementation
  • Basic error handling with try-except
  • Menu-driven application design

Perfect for Python beginners learning file handling, data management, and practical application development!

About

YouTube Manager: A Python terminal app that organizes your favorite videos without a database. Store, update, and track YouTube content with JSON file persistence. Perfect for learning Python fundamentals and CRUD operations through practical application.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages