Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions MixItUp.Base/Model/Overlay/OverlayTwitchClipV3Model.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public enum OverlayTwitchClipV3ClipType
[DataContract]
public class OverlayTwitchClipV3Model : OverlayItemV3ModelBase
{
private const string ClipThumbnailURLPreviewSegment = "-preview-";

public static readonly string DefaultHTML = OverlayResources.OverlayTwitchClipVideoDefaultHTML;
public static readonly string DefaultCSS = OverlayResources.OverlayTwitchClipVideoDefaultCSS;
Expand Down Expand Up @@ -115,15 +114,15 @@ public async Task<bool> ProcessClip(CommandParametersModel parameters)
IEnumerable<ClipModel> clips = await ServiceManager.Get<TwitchSession>().StreamerService.GetClips(twitchUser, featured: featured, maxResults: 500);
if (clips != null && clips.Count() > 0)
{
clip = clips.Where(c => c.thumbnail_url.Contains(ClipThumbnailURLPreviewSegment)).Random();
clip = clips.Random();
}

if (clip == null && this.ClipType == OverlayTwitchClipV3ClipType.RandomFeaturedClip)
{
clips = await ServiceManager.Get<TwitchSession>().StreamerService.GetClips(twitchUser, featured: false, maxResults: 500);
if (clips != null && clips.Count() > 0)
{
clip = clips.Where(c => c.thumbnail_url.Contains(ClipThumbnailURLPreviewSegment)).Random();
clip = clips.Random();
}
}
}
Expand All @@ -134,15 +133,15 @@ public async Task<bool> ProcessClip(CommandParametersModel parameters)
IEnumerable<ClipModel> clips = await ServiceManager.Get<TwitchSession>().StreamerService.GetClips(twitchUser, startDate: startDate, endDate: DateTimeOffset.Now, featured: featured, maxResults: 500);
if (clips != null && clips.Count() > 0)
{
clip = clips.Where(c => c.thumbnail_url.Contains(ClipThumbnailURLPreviewSegment)).OrderByDescending(c => c.created_at).FirstOrDefault();
clip = clips.OrderByDescending(c => c.created_at).FirstOrDefault();
}

if (clip == null && this.ClipType == OverlayTwitchClipV3ClipType.LatestFeaturedClip)
{
clips = await ServiceManager.Get<TwitchSession>().StreamerService.GetClips(twitchUser, startDate: startDate, endDate: DateTimeOffset.Now, featured: false, maxResults: 500);
if (clips != null && clips.Count() > 0)
{
clip = clips.Where(c => c.thumbnail_url.Contains(ClipThumbnailURLPreviewSegment)).OrderByDescending(c => c.created_at).FirstOrDefault();
clip = clips.OrderByDescending(c => c.created_at).FirstOrDefault();
}
}
}
Expand Down