Skip to main content

Basic Usage

Single File Upload

Simplest form - interactive folder selection:
./gdrive_ingest.sh https://example.com/song.mp3
What happens:
  1. Interactive folder browser opens
  2. Use arrow keys to select destination
  3. File downloads with progress bar
  4. Uploads to selected folder

Direct Upload to Folder

Skip interactive mode:
./gdrive_ingest.sh --folder "Music" https://example.com/song.mp3
What happens:
  1. Searches for “Music” folder (creates if doesn’t exist)
  2. Downloads file
  3. Uploads directly to Music folder

Multiple Files

Command-Line Arguments

./gdrive_ingest.sh url1.mp3 url2.mp3 url3.mp3
Process:
  • Folder selection once at start
  • All files download and upload sequentially
  • Progress shown for each file

Comma-Separated URLs

./gdrive_ingest.sh "url1.mp3,url2.mp3,url3.mp3"
Use quotes when passing comma-separated URLs.

From JSON File

Create downloads.json:
downloads.json
[
  "https://example.com/file1.mp3",
  "https://example.com/file2.zip",
  "https://example.com/file3.mp4",
  "https://t.me/channel/123"
]
Then run:
./gdrive_ingest.sh --json downloads.json
Benefits:
  • Organize URLs in a file
  • Easy to edit and reuse
  • Mix different file types
  • Include Telegram links

Music Files

Single Song

./gdrive_ingest.sh https://example.com/song.mp3
Result:
Music/
└── Artist Name/
    └── Album Title (2025)/
        ├── song.mp3
        └── cover.jpg
Features:
  • Extracts artist, album, title, year from ID3 tags
  • Creates folder structure automatically
  • Extracts embedded cover art
  • Cleans metadata (removes website spam)

Album (Multiple Songs)

./gdrive_ingest.sh \
  https://example.com/track01.mp3 \
  https://example.com/track02.mp3 \
  https://example.com/track03.mp3
Result:
Music/
└── Artist Name/
    └── Album Title (2025)/
        ├── 01 - First Track.mp3
        ├── 02 - Second Track.mp3
        ├── 03 - Third Track.mp3
        └── cover.jpg  (extracted once)
Smart features:
  • Cover art extracted from first track only
  • Prompts before uploading to existing album
  • Groups all tracks in same album folder

Songs Without Album Metadata

./gdrive_ingest.sh https://example.com/single.mp3
If album tag is missing:
Music/
└── Artist Name/
    └── single.mp3  (no album folder)

Telegram Downloads

Public Channel

./gdrive_ingest.sh https://t.me/musicchannel/456
Requirements:
  • Telethon installed (pip install telethon)
  • Telegram API credentials in .env
  • First-time: phone number + verification code

Private Channel

./gdrive_ingest.sh https://t.me/c/1234567890/789
Requirements:
  • Same as public channel
  • You must be a member of the private channel

Multiple Telegram Files

./gdrive_ingest.sh \
  https://t.me/channel/123 \
  https://t.me/channel/124 \
  https://t.me/channel/125

Mixed URLs (Telegram + Regular)

./gdrive_ingest.sh \
  https://t.me/channel/123 \
  https://example.com/song.mp3 \
  https://t.me/channel/456
All URLs processed in order with same destination folder.

ZIP Files

Extract and Upload

./gdrive_ingest.sh https://example.com/archive.zip
Interactive prompt:
📦 ZIP detected
Extract and upload files? (y/n): y
If you choose ‘y’:
Folders/
└── archive/
    ├── file1.txt
    ├── file2.jpg
    └── file3.pdf
If you choose ‘n’:
Others/
└── archive.zip  (uploaded as-is)

Album ZIP

ZIP containing music files:
./gdrive_ingest.sh https://example.com/album.zip
Prompt to extract:
Extract and upload files? (y/n): y
Extracting...
✓ Extracted
Result:
Music/
└── Artist Name/
    └── Album Title (2025)/
        ├── 01 - Track.mp3
        ├── 02 - Track.mp3
        └── cover.jpg
Music files are organized by metadata, not the ZIP structure.

Advanced Workflows

Batch Download Music

Create music.json:
music.json
[
  "https://example.com/artist1-album1.zip",
  "https://example.com/artist2-song.mp3",
  "https://t.me/musicchannel/123",
  "https://example.com/artist3-album2.zip"
]
Run:
./gdrive_ingest.sh --folder "Music" --json music.json
Result:
  • All music organized by artist/album
  • Cover art extracted automatically
  • Duplicates skipped

Upload to Nested Folder

Upload directly to a specific artist folder:
# First, get the folder ID
# Option 1: Use interactive mode once to see folder IDs
./gdrive_ingest.sh https://example.com/test.mp3
# Note the folder ID when you navigate

# Option 2: Use folder ID directly
./gdrive_ingest.sh --folder "1hU4H0PO_ifwGP47UZHwbc2w89Y7V_YPn" \
  https://example.com/song.mp3

Backup Workflow

Backup script integration:
backup.sh
#!/bin/bash

# Daily backup to Google Drive
DATE=$(date +%Y-%m-%d)
BACKUP_URL="https://backup.example.com/daily-$DATE.zip"

./gdrive_ingest.sh --folder "Backups" "$BACKUP_URL"
Run daily via cron:
0 3 * * * /path/to/backup.sh

Download Playlist

Create playlist.json with all track URLs:
playlist.json
[
  "https://example.com/track01.mp3",
  "https://example.com/track02.mp3",
  "https://example.com/track03.mp3",
  "https://example.com/track04.mp3",
  "https://example.com/track05.mp3"
]
Upload:
./gdrive_ingest.sh --json playlist.json
Result:
  • Interactive folder selection (once)
  • All tracks organized by artist/album
  • Shared albums get one cover art
  • Duplicate detection prevents re-uploads

Debug Mode

Test Before Upload

./gdrive_ingest.sh --debug https://example.com/song.mp3
Shows:
Downloading: song.mp3
→ Would download: curl -L -o '/tmp/song.mp3_12345' 'https://...'
Metadata: Don Toliver|Tiramisu|Tiramisu|2025
→ Checking duplicate for: 'song.mp3' in folder: 1hU4H0PO_...
→ No duplicate found
→ Would upload song.mp3 from /tmp/song.mp3_12345
→ Would upload cover.jpg
No actual:
  • Download
  • Upload
  • API modifications
Perfect for:
  • Testing credentials
  • Verifying folder structure
  • Understanding file organization
  • Troubleshooting issues

Verify Metadata Extraction

./gdrive_ingest.sh --debug https://example.com/unknown.mp3
Check output for:
Metadata: Artist|Album|Title|Year
If shows Unknown Artist|Unknown Album|Unknown Title|:
  • File has no metadata
  • Won’t be organized by artist/album
  • Will upload to category folder (Music/)

Special Cases

Upload to Root

Skip all organization, upload to Drive root:
# In interactive mode, don't select any folder
# Press 'q' to quit and it will default to root

# OR use empty folder name (if script allows)
./gdrive_ingest.sh --folder "" https://example.com/file.txt
Files uploaded to root are not organized and may be hard to find later.

Handle Existing Album

When uploading to an album that already exists:
⚠ Album folder "Album Name (2025)" already exists
Upload to existing folder? [Y/n]: 
Options:
  • Press Y or Enter: Upload to existing album
  • Press N: Upload to Music root (un-nested)
Use case:
  • Adding more tracks to an album
  • Replacing tracks
  • Uploading deluxe edition tracks

No Metadata Files

For files without any metadata:
./gdrive_ingest.sh https://example.com/podcast.mp3
Result:
Music/
└── podcast.mp3  (no artist/album folder)
Or manually specify folder:
./gdrive_ingest.sh --folder "Podcasts" https://example.com/podcast.mp3

Error Handling

Duplicate Detection

./gdrive_ingest.sh https://example.com/song.mp3
If file already exists:
🔐 MD5: 6d2300f6a025e07ad87991b31023da6a
⛘ Already exists, skipping
Benefits:
  • Prevents duplicate uploads
  • Saves bandwidth
  • Saves storage space

Failed Download

./gdrive_ingest.sh https://invalid-url.com/file.mp3
Output:
⬇  Downloading file.mp3...
✗ Download failed
Script continues to next URL if multiple URLs provided.

Upload Failure

If upload fails:
⬆  Uploading 8.52MB... ✗ Upload failed
API Error: Quota exceeded
Common causes:
  • Storage quota exceeded
  • Invalid credentials
  • Network issues
  • File permissions
See Troubleshooting for solutions.

Performance Tips

Batch Processing

Process multiple files in one run to reuse folder selection

Use JSON Files

Organize URLs in JSON for easier management

Direct Folder

Use --folder flag to skip interactive mode

Debug First

Test with --debug before large uploads

Automation Examples

Cron Job for Daily Backups

# Add to crontab: crontab -e

# Daily at 3 AM
0 3 * * * /path/to/gdrive_ingest.sh --folder "Backups" "https://backup.server/daily.zip"

# Weekly on Sunday at 2 AM
0 2 * * 0 /path/to/gdrive_ingest.sh --folder "Weekly" "https://backup.server/weekly.tar.gz"

Download Script

download-music.sh
#!/bin/bash

# Read URLs from file (one per line)
while IFS= read -r url; do
  ./gdrive_ingest.sh --folder "Music" "$url"
  sleep 2  # Rate limiting
done < urls.txt

Telegram Channel Scraper

telegram-download.sh
#!/bin/bash

# Download all messages from channel (manually create list)
CHANNEL="musicchannel"

for i in {100..200}; do
  ./gdrive_ingest.sh --folder "Music" "https://t.me/$CHANNEL/$i"
  sleep 3  # Avoid rate limiting
done
Respect Telegram’s rate limits. Add sleep between downloads to avoid bans.

Next Steps

File Organization

Learn how files are organized

Interactive Features

Master keyboard controls

Troubleshooting

Fix common issues

Telegram Integration

Set up Telegram downloads

Build docs developers (and LLMs) love