43 lines
2.1 KiB
C#
43 lines
2.1 KiB
C#
|
|
using System.ComponentModel.DataAnnotations;
|
||
|
|
using System.Diagnostics.CodeAnalysis;
|
||
|
|
|
||
|
|
namespace FreeTubeSync.Model;
|
||
|
|
|
||
|
|
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||
|
|
public class History
|
||
|
|
{
|
||
|
|
[Key]
|
||
|
|
public string _id { get; set; } = string.Empty;
|
||
|
|
public string videoId { get; set; } = string.Empty;
|
||
|
|
public string title { get; set; } = string.Empty;
|
||
|
|
public string author { get; set; } = string.Empty;
|
||
|
|
public string authorId { get; set; } = string.Empty;
|
||
|
|
public long published { get; set; }
|
||
|
|
public string description { get; set; } = string.Empty;
|
||
|
|
public long viewCount { get; set; }
|
||
|
|
public long lengthSeconds { get; set; }
|
||
|
|
public float watchProgress { get; set; }
|
||
|
|
public long timeWatched { get; set; }
|
||
|
|
public bool isLive { get; set; }
|
||
|
|
public string type { get; set; } = string.Empty;
|
||
|
|
public string lastViewedPlaylistType { get; set; } = string.Empty;
|
||
|
|
public string? lastViewedPlaylistItemId { get; set; }
|
||
|
|
|
||
|
|
public void Update(History other)
|
||
|
|
{
|
||
|
|
if (other.videoId != videoId) videoId = other.videoId;
|
||
|
|
if (other.title != title) title = other.title;
|
||
|
|
if (other.author != author) author = other.author;
|
||
|
|
if (other.authorId != authorId) authorId = other.authorId;
|
||
|
|
if (other.published != published) published = other.published;
|
||
|
|
if (other.description != description) description = other.description;
|
||
|
|
if (other.viewCount != viewCount) viewCount = other.viewCount;
|
||
|
|
if (other.lengthSeconds != lengthSeconds) lengthSeconds = other.lengthSeconds;
|
||
|
|
if (!other.watchProgress.Equals(watchProgress)) watchProgress = other.watchProgress;
|
||
|
|
if (other.timeWatched != timeWatched) timeWatched = other.timeWatched;
|
||
|
|
if (other.isLive != isLive) isLive = other.isLive;
|
||
|
|
if (other.type != type) type = other.type;
|
||
|
|
if (other.lastViewedPlaylistType != lastViewedPlaylistType) lastViewedPlaylistType = other.lastViewedPlaylistType;
|
||
|
|
if (other.lastViewedPlaylistItemId != lastViewedPlaylistItemId) lastViewedPlaylistItemId = other.lastViewedPlaylistItemId;
|
||
|
|
}
|
||
|
|
}
|