Skip to content

Commit 8f8f44b

Browse files
committed
cleanup
1 parent eac3873 commit 8f8f44b

5 files changed

Lines changed: 30 additions & 53 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rust-yt-uploader"
3-
version = "0.2.5"
3+
version = "0.2.6"
44
edition = "2024"
55
authors = ["Your Name <your.email@example.com>"]
66
description = "High-performance YouTube video uploader in Rust with OAuth 2.0, concurrent uploads, and comprehensive validation"

README.md

Lines changed: 20 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ A high-performance, memory-safe Rust library for YouTube video uploading with OA
55
## Features
66

77
- **OAuth 2.0 Authentication**: Secure authentication with YouTube API using OAuth 2.0 flow with PKCE support
8-
- **Dual Configuration Formats**: Support for both legacy and modern YAML configuration formats
8+
- **Dual Configuration Formats**: Support for both legacy and batch YAML configuration formats
99
- **Concurrent Uploads**: Async upload mode with configurable concurrency (default: 3)
1010
- **Resumable Uploads**: Robust upload handling with automatic retry and resumption
1111
- **Progress Tracking**: Real-time upload progress bars for sequential uploads
@@ -22,21 +22,34 @@ Add to your `Cargo.toml`:
2222

2323
```toml
2424
[dependencies]
25-
rust-yt-uploader = "0.2.4"
25+
rust-yt-uploader = "0.2.6"
2626
```
2727

2828
### As a CLI Tool
2929

3030
#### Prerequisites
3131

32-
- Rust 1.70+ (2021 edition)
3332
- A Google Cloud project with YouTube Data API v3 enabled
3433
- OAuth 2.0 client credentials (`client_secret.json`)
3534

35+
1. Go to the [Google Cloud Console](https://console.cloud.google.com/)
36+
2. Create a new project or select an existing one
37+
3. Enable the YouTube Data API v3
38+
4. Create OAuth 2.0 credentials (Desktop application)
39+
5. Download the credentials as `client_secret.json`
40+
6. Place the file in the parent directory of the Rust project
41+
42+
The first time you run the uploader, it will:
43+
44+
1. Display an authorization URL
45+
2. Open your browser for authentication
46+
3. Ask you to paste the authorization code
47+
4. Save the tokens to `youtube-oauth2.json`
48+
3649
#### Build from Source
3750

3851
```bash
39-
git clone https://github.com/yourusername/rust-yt-uploader
52+
git clone https://github.com/leafyoung/rust-yt-uploader
4053
cd rust-yt-uploader
4154
cargo build --release --bin yt-upload
4255
```
@@ -101,29 +114,10 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
101114
}
102115
```
103116

104-
### As a CLI Tool
105117

106-
## OAuth 2.0 Setup
118+
## YAML Configuration Formats
107119

108-
1. Go to the [Google Cloud Console](https://console.cloud.google.com/)
109-
2. Create a new project or select an existing one
110-
3. Enable the YouTube Data API v3
111-
4. Create OAuth 2.0 credentials (Desktop application)
112-
5. Download the credentials as `client_secret.json`
113-
6. Place the file in the parent directory of the Rust project
114-
115-
The first time you run the uploader, it will:
116-
117-
1. Display an authorization URL
118-
2. Open your browser for authentication
119-
3. Ask you to paste the authorization code
120-
4. Save the tokens to `youtube-oauth2.json`
121-
122-
## Configuration
123-
124-
### YAML Configuration Formats
125-
126-
#### Modern Format (Recommended)
120+
#### Batch Format (Recommended)
127121

128122
```yaml
129123
common:
@@ -206,23 +200,6 @@ cargo run --bin yt-upload --file config.yaml --async --concurrent 5
206200

207201
## Performance
208202

209-
## Project Summary
210-
211-
This project is a complete Rust implementation of the Python YouTube uploader, providing the same functionality with improved performance, memory safety, and reliability. The implementation mirrors the Python version's features while leveraging Rust's strengths.
212-
213-
### Completed Features
214-
215-
- ✅ **CLI Interface**: Complete command-line interface using `clap` with same arguments as Python version
216-
- ✅ **Configuration Parsing**: Support for both legacy and modern YAML formats using `serde`
217-
- ✅ **Input Validation**: Comprehensive validation using `validator` crate with custom validators
218-
- ✅ **OAuth 2.0 Authentication**: Full OAuth 2.0 flow with PKCE support for enhanced security
219-
- ✅ **Token Management**: Automatic token refresh and secure storage
220-
- ✅ **Video Upload**: Complete upload functionality with YouTube Data API v3
221-
- ✅ **Playlist Management**: Automatic addition of uploaded videos to playlists
222-
- ✅ **Retry Logic**: Exponential backoff with jitter for handling transient failures
223-
- ✅ **Concurrent Uploads**: Async upload mode with configurable concurrency
224-
- ✅ **MTS File Support**: Special handling for MTS files with correct MIME type
225-
226203
### Key Dependencies
227204

228205
- `tokio`: Async runtime for high-performance I/O
@@ -246,5 +223,5 @@ This project is licensed under the MIT License - see the LICENSE file for detail
246223

247224
## Acknowledgments
248225

249-
- Use yup_oauth2 as an alternative
250226
- Built with the Tokio async runtime for high-performance I/O
227+
- Use yup_oauth2 as an alternative

example-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Example configuration file for Rust YouTube Uploader
2-
# This demonstrates the modern/batch configuration format
2+
# This demonstrates the batch configuration format
33

44
common:
55
# Prefix to add to all video titles

src/bin/yt_upload.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ struct Cli {
5050
/// * `config` - Raw YAML configuration as a string
5151
///
5252
/// # Returns
53-
/// * `ConfigFormat` - Either Legacy or Modern
53+
/// * `ConfigFormat` - Either Legacy or Batch
5454
///
5555
/// # Errors
5656
/// * Returns error if schema cannot be determined
@@ -66,12 +66,12 @@ fn detect_yaml_schema(config: &str) -> Result<ConfigFormat> {
6666
&& mapping.contains_key("titles")
6767
&& mapping.contains_key("files")
6868
{
69-
return Ok(ConfigFormat::Modern);
69+
return Ok(ConfigFormat::Batch);
7070
}
7171
}
7272

7373
anyhow::bail!(
74-
"Unable to determine YAML schema. Expected either 'videos' key (legacy) or 'common', 'titles', and 'files' keys (modern)."
74+
"Unable to determine YAML schema. Expected either 'videos' key (legacy) or 'common', 'titles', and 'files' keys (batch)."
7575
);
7676
}
7777

@@ -111,8 +111,8 @@ async fn main() -> Result<()> {
111111

112112
upload_legacy_sequential(config, cli.progress).await?;
113113
}
114-
ConfigFormat::Modern => {
115-
info!("Detected modern YAML schema format");
114+
ConfigFormat::Batch => {
115+
info!("Detected batch YAML schema format");
116116
let config: BatchConfigRoot = serde_yaml_ng::from_str(&config_content)
117117
.map_err(|e| anyhow::anyhow!("Failed to parse batch config: {}", e))?;
118118

src/models.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Configuration models for YouTube uploader with validation.
22
//!
33
//! This module provides Serde-based models that mirror the Python Pydantic models,
4-
//! supporting both legacy and modern YAML configuration formats.
4+
//! supporting both legacy and batch YAML configuration formats.
55
66
use anyhow::{Result, anyhow};
77
use futures::future::try_join_all;
@@ -15,7 +15,7 @@ use validator::{Validate, ValidationError};
1515
#[derive(Debug, Clone, PartialEq)]
1616
pub enum ConfigFormat {
1717
Legacy,
18-
Modern,
18+
Batch,
1919
}
2020

2121
/// Configuration for retry behavior during uploads.
@@ -283,7 +283,7 @@ pub struct LegacyConfigRoot {
283283
pub videos: Vec<VideoConfig>,
284284
}
285285

286-
/// Root model for batch/modern YAML format with common config.
286+
/// Root model for batch YAML format with common config.
287287
#[derive(Debug, Clone, Serialize, Deserialize, Validate)]
288288
pub struct BatchConfigRoot {
289289
/// Test mode flag - if true, delete videos after upload

0 commit comments

Comments
 (0)