mirror of
https://github.com/mxpv/podsync.git
synced 2024-05-11 05:55:04 +00:00
Fix exception if no video thumbnail
This commit is contained in:
@@ -109,13 +109,23 @@ namespace Podsync.Services.Videos.Vimeo
|
||||
var uri = v.uri.ToString();
|
||||
var id = uri.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries)[1];
|
||||
|
||||
Uri thumbnailUri = null;
|
||||
if (v.pictures != null)
|
||||
{
|
||||
thumbnailUri = new Uri(v.pictures.sizes[0].link.ToString());
|
||||
}
|
||||
else if (v.user?.pictures != null)
|
||||
{
|
||||
thumbnailUri = new Uri(v.user.pictures.sizes[0].link.ToString());
|
||||
}
|
||||
|
||||
var video = new Video
|
||||
{
|
||||
Id = id,
|
||||
Title = v.name,
|
||||
Description = v.description,
|
||||
Link = new Uri(v.link?.ToString()),
|
||||
Thumbnail = new Uri(v.pictures?.sizes[0]?.link?.ToString()),
|
||||
Thumbnail = thumbnailUri,
|
||||
CreatedAt = DateTime.Parse(v.created_time?.ToString()),
|
||||
Duration = TimeSpan.FromSeconds(v.duration?.ToObject<int>()),
|
||||
Size = size,
|
||||
|
Reference in New Issue
Block a user