Skip to content

Commit

Permalink
Merge branch 'release/2.13.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
SoneeJohn committed Apr 27, 2020
2 parents bbf5ee8 + c029d99 commit 6e8b413
Show file tree
Hide file tree
Showing 10 changed files with 98 additions and 19 deletions.
4 changes: 2 additions & 2 deletions .jazzy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ source_directory: XCDYouTubeKit
framework_root: .
umbrella_header: XCDYouTubeKit/XCDYouTubeKit.h
module: XCDYouTubeKit
module_version: 2.12.0
module_version: 2.13.0

author: Cédric Luthi
author_url: https://twitter.com/0xced

readme: README.md
github_url: https://github.com/0xced/XCDYouTubeKit
github_file_prefix: https://github.com/0xced/XCDYouTubeKit/tree/2.12.0/XCDYouTubeKit
github_file_prefix: https://github.com/0xced/XCDYouTubeKit/tree/2.13.0/XCDYouTubeKit
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
#### Version 2.13.0

* Deprecated `-[XCDYouTubeVideo thumbnailURL]` use `-[XCDYouTubeVideo thumbnailURLs]` (#477)
* Exclude plist files from Swift Package Manager (#478)
* Annotate `languageIdentifier` argument as `nullable` in `XCDYouTubeVideoOperation`
* Add new `author`, `videoDescription` and `channelIdentifier` properties to `XCDYouTubeVideo` (#471)

#### Version 2.12.0

* Add the ability to specify which `streamURLs` to query via `-[XCDYouTubeClient queryVideo:video:streamURLsToQuery:options:cookies:completionHandler:]` & `XCDYouTubeVideoQueryOperation` class.
Expand Down
5 changes: 5 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ let package = Package(
.target(
name: "XCDYouTubeKit",
path: ".",
exclude: [
"XCDYouTubeKit/Info.plist",
"XCDYouTubeKit/Configuration.plist",
"XCDYouTubeKit/AppledocSettings.plist"
],
sources: ["XCDYouTubeKit"],
publicHeadersPath: "XCDYouTubeKit"
)
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ XCDYouTubeKit is available through [CocoaPods](https://cocoapods.org/), [Carthag
CocoaPods:

```ruby
pod "XCDYouTubeKit", "~> 2.12"
pod "XCDYouTubeKit", "~> 2.13"
```

Carthage:

```objc
github "0xced/XCDYouTubeKit" ~> 2.12
github "0xced/XCDYouTubeKit" ~> 2.13
```

Swift Package Manager:
Expand All @@ -48,7 +48,7 @@ Add `XCDYouTubeKit` to the dependencies value of your `Package.swift`

```swift
dependencies: [
.package(url: "https://github.com/0xced/XCDYouTubeKit.git", from: "2.12.0")
.package(url: "https://github.com/0xced/XCDYouTubeKit.git", from: "2.13.0")
]
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 2.12.0;
CURRENT_PROJECT_VERSION = 2.13.0;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
Expand Down Expand Up @@ -804,7 +804,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 2.12.0;
CURRENT_PROJECT_VERSION = 2.13.0;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
Expand Down
2 changes: 1 addition & 1 deletion XCDYouTubeKit.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "XCDYouTubeKit"
s.version = "2.12.0"
s.version = "2.13.0"
s.summary = "YouTube video player for iOS and OS X."
s.homepage = "https://github.com/0xced/XCDYouTubeKit"
s.screenshot = "https://raw.github.com/0xced/XCDYouTubeKit/#{s.version}/Screenshots/XCDYouTubeVideoPlayerViewController.png"
Expand Down
22 changes: 18 additions & 4 deletions XCDYouTubeKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
012718E72457786400123A28 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
017234C023FC223D00196707 /* XCDURLGETOperation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XCDURLGETOperation.h; sourceTree = "<group>"; };
017234C123FC223D00196707 /* XCDURLGETOperation.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XCDURLGETOperation.m; sourceTree = "<group>"; };
0178E76B23F49BBC001C382E /* XCDYouTubeVideoQueryOperation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XCDYouTubeVideoQueryOperation.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -187,6 +188,14 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
012718E62457786300123A28 /* Frameworks */ = {
isa = PBXGroup;
children = (
012718E72457786400123A28 /* AppKit.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
C20F57A118817D5400EDBFB0 /* XCDYouTubeKit Tests */ = {
isa = PBXGroup;
children = (
Expand All @@ -212,6 +221,7 @@
C2A3F2D217F4827800AC1C3B /* XCDYouTubeKit */,
C20F57A118817D5400EDBFB0 /* XCDYouTubeKit Tests */,
C2A3F2CE17F4827800AC1C3B /* Products */,
012718E62457786300123A28 /* Frameworks */,
);
indentWidth = 4;
sourceTree = "<group>";
Expand Down Expand Up @@ -587,6 +597,8 @@
"OTHER_LDFLAGS[sdk=macosx*]" = (
"-framework",
CoreServices,
"-framework",
AppKit,
);
WARNING_CFLAGS = (
"$(inherited)",
Expand Down Expand Up @@ -620,6 +632,8 @@
"OTHER_LDFLAGS[sdk=macosx*]" = (
"-framework",
CoreServices,
"-framework",
AppKit,
);
WARNING_CFLAGS = (
"$(inherited)",
Expand Down Expand Up @@ -649,10 +663,10 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 46;
CURRENT_PROJECT_VERSION = 47;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 2.0.0;
DYLIB_CURRENT_VERSION = 2.12.0;
DYLIB_CURRENT_VERSION = 2.13.0;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
Expand Down Expand Up @@ -727,10 +741,10 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 46;
CURRENT_PROJECT_VERSION = 47;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 2.0.0;
DYLIB_CURRENT_VERSION = 2.12.0;
DYLIB_CURRENT_VERSION = 2.13.0;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
Expand Down
19 changes: 18 additions & 1 deletion XCDYouTubeKit/XCDYouTubeVideo.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,18 @@ extern NSString *const XCDYouTubeVideoQualityHTTPLiveStreaming;
* The title of the video.
*/
@property (nonatomic, readonly) NSString *title;
/**
* The name of author that uploaded this video.
*/
@property (nonatomic, readonly) NSString *author;
/**
* The channel identifier of YouTube channel that this video belongs to.
*/
@property (nonatomic, readonly) NSString *channelIdentifier;
/**
* The description of the video.
*/
@property (nonatomic, readonly) NSString *videoDescription;
/**
* The duration of the video in seconds.
*/
Expand All @@ -77,10 +89,15 @@ extern NSString *const XCDYouTubeVideoQualityHTTPLiveStreaming;
* The views count of the video.
*/
@property (nonatomic, readonly) NSInteger viewCount;
/**
* An array of thumbnail URLs for an images of different sizes. Ordered from smaller to bigger.
*/
@property (nonatomic, readonly, nullable) NSArray<NSURL *> *thumbnailURLs;
/**
* A thumbnail URL for an image of small size, i.e. 120×90. May be nil.
*/
@property (nonatomic, readonly, nullable) NSURL *thumbnailURL;
@property (nonatomic, readonly, nullable) NSURL *thumbnailURL
DEPRECATED_MSG_ATTRIBUTE("Use `thumbnailURLs` instead.");
/**
* A thumbnail URL for an image of small size, i.e. 120×90. May be nil.
*/
Expand Down
46 changes: 41 additions & 5 deletions XCDYouTubeKit/XCDYouTubeVideo.m
Original file line number Diff line number Diff line change
Expand Up @@ -198,20 +198,56 @@ - (instancetype) initWithIdentifier:(NSString *)identifier info:(NSDictionary *)
title = @"";
_title = title;

NSString *author = info[@"author"] == nil? videoDetails[@"author"] : info[@"author"];
if (author == nil)
author = @"";
_author = author;

NSString *channelIdentifier = info[@"ucid"] == nil? videoDetails[@"channelId"] : info[@"ucid"];
if (channelIdentifier == nil)
channelIdentifier = @"";
_channelIdentifier = channelIdentifier;

NSString *description = videoDetails[@"shortDescription"];
if (description == nil)
description = @"";
_videoDescription = description;

_viewCount = info[@"viewCount"] == nil? [(NSString *)videoDetails[@"viewCount"] integerValue] : [(NSString *)info[@"viewCount"] integerValue];

_duration = info[@"length_seconds"] == nil? [(NSString *)videoDetails[@"lengthSeconds"] doubleValue] : [(NSString *)info[@"length_seconds"] doubleValue];

NSString *thumbnail = info[@"thumbnail_url"] ?: info[@"iurl"];
_thumbnailURL = thumbnail ? [NSURL URLWithString:thumbnail] : nil;
NSURL *thumbnailURL = thumbnail ? [NSURL URLWithString:thumbnail] : nil;
_thumbnailURL = thumbnailURL;

if (!_thumbnailURL) {
NSArray <NSDictionary *>*thumnails = XCDThumnailArrayWithString(playerResponse);
if (thumnails.count >= 1) {
NSString *thumbnailURLString = thumnails[0][@"url"];
NSArray<NSDictionary *> *thumbnails = XCDThumnailArrayWithString(playerResponse);
if (thumbnails.count >= 1) {
// Prepare array of thumbnails URLs.
NSMutableArray<NSURL *> *thumbnailURLs = [[NSMutableArray<NSURL *> alloc] initWithCapacity:thumbnails.count];

// Extract URLs.
for (NSDictionary *thumbnailDict in thumbnails) {
NSString *urlStr = thumbnailDict[@"url"];
NSURL *url = [NSURL URLWithString:urlStr];
if (url) {
[thumbnailURLs addObject:url];
}
}

// Set array.
_thumbnailURLs = [thumbnailURLs copy];

// DEPRECATED
NSString *thumbnailURLString = thumbnails[0][@"url"];
_thumbnailURL = thumbnailURLString ? [NSURL URLWithString:thumbnailURLString] : nil;
}
}
else
{
_thumbnailURLs = [NSArray arrayWithObject:thumbnailURL];
}

NSMutableDictionary *streamURLs = [NSMutableDictionary new];

Expand Down Expand Up @@ -455,7 +491,7 @@ - (NSString *) debugDescription
NSDateComponentsFormatter *dateComponentsFormatter = [NSDateComponentsFormatter new];
dateComponentsFormatter.unitsStyle = NSDateComponentsFormatterUnitsStyleAbbreviated;
NSString *duration = [dateComponentsFormatter stringFromTimeInterval:self.duration] ?: [NSString stringWithFormat:@"%@ seconds", @(self.duration)];
NSString *thumbnailDescription = [NSString stringWithFormat:@"Thumbnail: %@", self.thumbnailURL];
NSString *thumbnailDescription = [NSString stringWithFormat:@"Thumbnails: %@", self.thumbnailURLs];
NSString *streamsDescription = SortedDictionaryDescription(self.streamURLs);
return [NSString stringWithFormat:@"<%@: %p> %@\nDuration: %@\nExpiration date: %@\n%@\nStreams: %@", self.class, self, self.description, duration, self.expirationDate, thumbnailDescription, streamsDescription];
}
Expand Down
2 changes: 1 addition & 1 deletion XCDYouTubeKit/XCDYouTubeVideoOperation.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ NS_ASSUME_NONNULL_BEGIN
*
* @return An initialized `XCDYouTubeVideoOperation` object.
*/
- (instancetype) initWithVideoIdentifier:(NSString *)videoIdentifier languageIdentifier:(NSString *)languageIdentifier cookies:(nullable NSArray <NSHTTPCookie *> *)cookies;
- (instancetype) initWithVideoIdentifier:(NSString *)videoIdentifier languageIdentifier:(nullable NSString *)languageIdentifier cookies:(nullable NSArray <NSHTTPCookie *> *)cookies;

/**
* Initializes a video operation with the specified video identifier and language identifier and cookies and additional patterns.
Expand Down

0 comments on commit 6e8b413

Please sign in to comment.