diff --git a/Discord Media Loader.Application/Classes/MediaData.cs b/Discord Media Loader.Application/Classes/MediaData.cs new file mode 100644 index 0000000..da8c160 --- /dev/null +++ b/Discord Media Loader.Application/Classes/MediaData.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using DML.AppCore.Classes; +using static SweetLib.Utils.Logger.Logger; + +namespace DML.Application.Classes +{ + public class MediaData + { + public ulong Id { get; set; } + public string DownloadSource { get; set; } + public ulong GuildId { get; set; } + public ulong ChannelId { get; set;} + public double TimeStamp { get; set; } + public string Filename { get; set; } + + internal void Store() + { + Debug("Storing job to database..."); + Trace("Getting jobs collection..."); + var db = Core.Database.GetCollection("media"); + + Trace("Adding new value..."); + + if (db.Find(x => x.Id == Id).Any()) + { + db.Update(this); + } + else + { + db.Insert(this); + } + } + + internal void Delete() + { + Debug("Deleting job from database..."); + Trace("Getting jobs collection..."); + var db = Core.Database.GetCollection("media"); + + Trace("Deleting value..."); + db.Delete(Id); + } + } +} diff --git a/Discord Media Loader.Application/Classes/Settings.cs b/Discord Media Loader.Application/Classes/Settings.cs index a9544ee..2a82c60 100644 --- a/Discord Media Loader.Application/Classes/Settings.cs +++ b/Discord Media Loader.Application/Classes/Settings.cs @@ -15,6 +15,7 @@ namespace DML.Application.Classes public string FileNameScheme { get; set; } = @"%guild%\%channel%\%id%"; public bool SkipExistingFiles { get; set; } = true; public int ThreadLimit { get; set; } = 50; + public bool RescanRequired { get; set; } = true; public void Store() { diff --git a/Discord Media Loader.Application/DML.Application.csproj b/Discord Media Loader.Application/DML.Application.csproj index 02bf1f5..443fe3e 100644 --- a/Discord Media Loader.Application/DML.Application.csproj +++ b/Discord Media Loader.Application/DML.Application.csproj @@ -161,6 +161,7 @@ + Form