-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Impemented VidoInfo for "video" media entity in ExtendedEntities on a…
… Status.
- Loading branch information
Showing
10 changed files
with
156 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/LinqToTwitter/LinqToTwitter.Shared/Common/Entities/AspectRatio.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using LitJson; | ||
|
||
namespace LinqToTwitter | ||
{ | ||
public class AspectRatio | ||
{ | ||
const int WidthIndex = 0; | ||
const int HeightIndex = 1; | ||
|
||
public AspectRatio() { } | ||
public AspectRatio(JsonData aspectRatio) | ||
{ | ||
if (aspectRatio == null) return; | ||
|
||
Width = (int) aspectRatio[WidthIndex]; | ||
Height = (int) aspectRatio[HeightIndex]; | ||
} | ||
|
||
public int Width { get; set; } | ||
|
||
public int Height { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/LinqToTwitter/LinqToTwitter.Shared/Common/Entities/Variant.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using LinqToTwitter.Common; | ||
using LitJson; | ||
|
||
namespace LinqToTwitter | ||
{ | ||
public class Variant | ||
{ | ||
public Variant() { } | ||
public Variant(JsonData variant) | ||
{ | ||
BitRate = variant.GetValue<int>("bitrate", defaultValue: 0); | ||
ContentType = variant.GetValue<string>("content_type"); | ||
Url = variant.GetValue<string>("url"); | ||
} | ||
|
||
public int BitRate { get; set; } | ||
|
||
public string ContentType { get; set; } | ||
|
||
public string Url { get; set; } | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
src/LinqToTwitter/LinqToTwitter.Shared/Common/Entities/VideoInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using LinqToTwitter.Common; | ||
using LitJson; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace LinqToTwitter | ||
{ | ||
public class VideoInfo | ||
{ | ||
public VideoInfo() { } | ||
public VideoInfo(JsonData videoInfo) | ||
{ | ||
AspectRatio = new AspectRatio(videoInfo.GetValue<JsonData>("aspect_ratio")); | ||
Duration = videoInfo.GetValue<int>("duration_millis"); | ||
JsonData variants = videoInfo.GetValue<JsonData>("variants"); | ||
|
||
if (variants != null && variants.Count > 0) | ||
Variants = | ||
(from JsonData variant in videoInfo.GetValue<JsonData>("variants") | ||
select new Variant(variant)) | ||
.ToList(); | ||
} | ||
|
||
/// <summary> | ||
/// Width and Height | ||
/// </summary> | ||
public AspectRatio AspectRatio { get; set; } | ||
|
||
/// <summary> | ||
/// Duration in milliseconds | ||
/// </summary> | ||
public int Duration { get; set; } | ||
|
||
/// <summary> | ||
/// Available encodings/data streams | ||
/// </summary> | ||
public List<Variant> Variants { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.