Initial Commit
Inital Commit of Code base, nothing tested.
This commit is contained in:
commit
0144221712
31 changed files with 1304 additions and 0 deletions
43
FreeTubeSync/Model/History.cs
Normal file
43
FreeTubeSync/Model/History.cs
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
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;
|
||||
}
|
||||
}
|
||||
25
FreeTubeSync/Model/Playlist.cs
Normal file
25
FreeTubeSync/Model/Playlist.cs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace FreeTubeSync.Model;
|
||||
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public class Playlist
|
||||
{
|
||||
[Key]
|
||||
public string _id { get; set; } = string.Empty;
|
||||
public string playlistName { get; set; } = string.Empty;
|
||||
public bool @protected { get; set; }
|
||||
public List<Video> videos { get; set; } = [];
|
||||
public int createdAt { get; set; }
|
||||
public int lastUpdatedAt { get; set; }
|
||||
|
||||
public void Update(Playlist other)
|
||||
{
|
||||
if (other.playlistName != playlistName) playlistName = other.playlistName;
|
||||
if (other.@protected != @protected) @protected = other.@protected;
|
||||
if (other.videos.Count != videos.Count) videos = other.videos;
|
||||
if (other.createdAt != createdAt) createdAt = other.createdAt;
|
||||
if (other.lastUpdatedAt != lastUpdatedAt) lastUpdatedAt = other.lastUpdatedAt;
|
||||
}
|
||||
}
|
||||
23
FreeTubeSync/Model/Profile.cs
Normal file
23
FreeTubeSync/Model/Profile.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace FreeTubeSync.Model;
|
||||
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public class Profile
|
||||
{
|
||||
[Key]
|
||||
public string _id { get; set; } = string.Empty;
|
||||
public string name { get; set; } = string.Empty;
|
||||
public string bgColor { get; set; } = string.Empty;
|
||||
public string textColor { get; set; } = string.Empty;
|
||||
public List<Subscription> subscriptions { get; set; } = [];
|
||||
|
||||
public void Update(Profile other)
|
||||
{
|
||||
if (other.name != name) name = other.name;
|
||||
if (other.bgColor != bgColor) bgColor = other.bgColor;
|
||||
if (other.textColor != textColor) textColor = other.textColor;
|
||||
if (other.subscriptions.Count != subscriptions.Count) subscriptions = other.subscriptions;
|
||||
}
|
||||
}
|
||||
17
FreeTubeSync/Model/SearchHistory.cs
Normal file
17
FreeTubeSync/Model/SearchHistory.cs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace FreeTubeSync.Model;
|
||||
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public class SearchHistory
|
||||
{
|
||||
[Key]
|
||||
public string _id { get; set; } = string.Empty;
|
||||
public int lastUpdatedAt { get; set; }
|
||||
|
||||
public void Update(SearchHistory other)
|
||||
{
|
||||
if (other.lastUpdatedAt != lastUpdatedAt) lastUpdatedAt = other.lastUpdatedAt;
|
||||
}
|
||||
}
|
||||
25
FreeTubeSync/Model/Setting.cs
Normal file
25
FreeTubeSync/Model/Setting.cs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace FreeTubeSync.Model;
|
||||
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public class Setting
|
||||
{
|
||||
[Key]
|
||||
#pragma warning disable CS8618
|
||||
public string _id { get; set; } = string.Empty;
|
||||
public string? ValueJson { get; set; }
|
||||
#pragma warning restore CS8618
|
||||
|
||||
[NotMapped]
|
||||
public object Value
|
||||
{
|
||||
#pragma warning disable CS8603
|
||||
get => string.IsNullOrEmpty(ValueJson) ? null : JsonSerializer.Deserialize<object>(ValueJson);
|
||||
#pragma warning restore CS8603
|
||||
set => ValueJson = JsonSerializer.Serialize(value);
|
||||
}
|
||||
}
|
||||
13
FreeTubeSync/Model/Subscription.cs
Normal file
13
FreeTubeSync/Model/Subscription.cs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace FreeTubeSync.Model;
|
||||
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public class Subscription
|
||||
{
|
||||
[Key]
|
||||
public required string id { get; set; }
|
||||
public required string name { get; set; }
|
||||
public string? thumbnail { get; set; }
|
||||
}
|
||||
18
FreeTubeSync/Model/Video.cs
Normal file
18
FreeTubeSync/Model/Video.cs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace FreeTubeSync.Model;
|
||||
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public class Video
|
||||
{
|
||||
[Key] 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 string lengthSeconds { get; set; } = string.Empty;
|
||||
public int pubished { get; set; }
|
||||
public int timeAdded { get; set; }
|
||||
public string playlistItemId { get; set; } = string.Empty;
|
||||
public string type { get; set; } = string.Empty;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue