<commit_before>YouTube Upload plugin for Craft CMS [![Build Status](https://travis-ci.org/boboldehampsink/youtube.svg?branch=develop)](https://travis-ci.org/boboldehampsink/youtube) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/boboldehampsink/youtube/badges/quality-score.png?b=develop)](https://scrutinizer-ci.com/g/boboldehampsink/youtube/?branch=develop) [![Code Coverage](https://scrutinizer-ci.com/g/boboldehampsink/youtube/badges/coverage.png?b=develop)](https://scrutinizer-ci.com/g/boboldehampsink/youtube/?branch=develop) [![Latest Stable Version](https://poser.pugx.org/boboldehampsink/youtube/v/stable)](https://packagist.org/packages/boboldehampsink/youtube) [![Total Downloads](https://poser.pugx.org/boboldehampsink/youtube/downloads)](https://packagist.org/packages/boboldehampsink/youtube) [![Latest Unstable Version](https://poser.pugx.org/boboldehampsink/youtube/v/unstable)](https://packagist.org/packages/boboldehampsink/youtube) [![License](https://poser.pugx.org/boboldehampsink/youtube/license)](https://packagist.org/packages/boboldehampsink/youtube)
=================

Plugin/FieldType that uploads video assets to YouTube and is able to output their YouTube URL's in the front-end.

__Important__  
 - The plugin's folder should be named "youtube"  
 - This plugin requires [Dukt's OAuth](https://dukt.net/craft/oauth) plugin to be installed

Usage
=================
This plugin provides an YouTube Upload FieldType that works like the Asset FieldType.  
You can upload a video, and the plugin starts a background task to upload this video to YouTube.  
Once it is done it saves the YouTube video URL to the database.  
It is then able to return a model that contains the YouTube ID and URL's for watching and embedding.

Known issues
=================
There appears to be a problem when uploading the same video more than once in a session.
It looks like it might be a YouTube bug, and I've reported it here: [https://code.google.com/p/gdata-issues/issues/detail?id=7326&thanks=7326&ts=1434712883](https://code.google.com/p/gdata-issues/issues/detail?id=7326&thanks=7326&ts=1434712883)

Roadmap
=================
 - Better OAuth plugin integration and dependency management
 - Better YouTube upload progress indication

Development
=================
Run this from your Craft installation to test your changes to this plugin before submitting a Pull Request
```bash
phpunit --bootstrap craft/app/tests/bootstrap.php --configuration craft/plugins/youtube/phpunit.xml.dist --coverage-text craft/plugins/youtube/tests
```

Changelog
=================
###0.7.0###
 - Added interface for deleting hashes, so you can re-upload video's that you have deleted from YouTube.
 - Updated dependencies

###0.6.5###
 - Updated dependencies and fixed unit tests

###0.6.4###
 - Updated Google API client to 2.0.0

###0.6.3###
 - Updated plugin to work with OAuth Plugin 1.0+
 - Fix search keywords criteria

###0.6.2###
 - Removed the ability to manually set a timeout per step via the config
 - Added user who created the task to the Task Manager plugin table, if installed
 - Updated YouTube API

###0.6.1###
 - Finish task when element doesn't exist anymore
 - Only save element id values

###0.6.0###
 - Verify if element still exists before starting a task
 - Updated YouTube API and implementation
 - Updated OAuth plugin dependency

###0.5.0###
 - Added the ability to manually set a timeout per step via the config<commit_msg>Improved changelog<commit_after>YouTube Upload plugin for Craft CMS [![Build Status](https://travis-ci.org/boboldehampsink/youtube.svg?branch=develop)](https://travis-ci.org/boboldehampsink/youtube) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/boboldehampsink/youtube/badges/quality-score.png?b=develop)](https://scrutinizer-ci.com/g/boboldehampsink/youtube/?branch=develop) [![Code Coverage](https://scrutinizer-ci.com/g/boboldehampsink/youtube/badges/coverage.png?b=develop)](https://scrutinizer-ci.com/g/boboldehampsink/youtube/?branch=develop) [![Latest Stable Version](https://poser.pugx.org/boboldehampsink/youtube/v/stable)](https://packagist.org/packages/boboldehampsink/youtube) [![Total Downloads](https://poser.pugx.org/boboldehampsink/youtube/downloads)](https://packagist.org/packages/boboldehampsink/youtube) [![Latest Unstable Version](https://poser.pugx.org/boboldehampsink/youtube/v/unstable)](https://packagist.org/packages/boboldehampsink/youtube) [![License](https://poser.pugx.org/boboldehampsink/youtube/license)](https://packagist.org/packages/boboldehampsink/youtube)
=================

Plugin/FieldType that uploads video assets to YouTube and is able to output their YouTube URL's in the front-end.

__Important__  
 - The plugin's folder should be named "youtube"  
 - This plugin requires [Dukt's OAuth](https://dukt.net/craft/oauth) plugin to be installed

Usage
=================
This plugin provides an YouTube Upload FieldType that works like the Asset FieldType.  
You can upload a video, and the plugin starts a background task to upload this video to YouTube.  
Once it is done it saves the YouTube video URL to the database.  
It is then able to return a model that contains the YouTube ID and URL's for watching and embedding.

Known issues
=================
There appears to be a problem when uploading the same video more than once in a session.
It looks like it might be a YouTube bug, and I've reported it here: [https://code.google.com/p/gdata-issues/issues/detail?id=7326&thanks=7326&ts=1434712883](https://code.google.com/p/gdata-issues/issues/detail?id=7326&thanks=7326&ts=1434712883)

Roadmap
=================
 - Better OAuth plugin integration and dependency management
 - Better YouTube upload progress indication

Development
=================
Run this from your Craft installation to test your changes to this plugin before submitting a Pull Request
```bash
phpunit --bootstrap craft/app/tests/bootstrap.php --configuration craft/plugins/youtube/phpunit.xml.dist --coverage-text craft/plugins/youtube/tests
```

Changelog
=================
###0.7.0###
 - Added interface for deleting hashes, so you can re-upload video's that you deleted from YouTube.
 - Updated dependencies

###0.6.5###
 - Updated dependencies and fixed unit tests

###0.6.4###
 - Updated Google API client to 2.0.0

###0.6.3###
 - Updated plugin to work with OAuth Plugin 1.0+
 - Fix search keywords criteria

###0.6.2###
 - Removed the ability to manually set a timeout per step via the config
 - Added user who created the task to the Task Manager plugin table, if installed
 - Updated YouTube API

###0.6.1###
 - Finish task when element doesn't exist anymore
 - Only save element id values

###0.6.0###
 - Verify if element still exists before starting a task
 - Updated YouTube API and implementation
 - Updated OAuth plugin dependency

###0.5.0###
 - Added the ability to manually set a timeout per step via the config
{'fraction_non_alphanumeric': 0.1382301908617698, 'fraction_numerical': 0.018796992481203006, 'mean_word_length': 4.947549441100602, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 34, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3119853', 'n_tokens_mistral': 2167, 'n_tokens_neox': 2015, 'n_words': 637}