mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-05-24 00:52:23 -04:00
* Have language from epubs populate metadata * series detail needs to reload the underlying volumes when scan event comes in, not just metadata. * Added Id to chapter detail modal (for debugging) * Implement IDisposable on applicable Unit Tests * Removed unused using statements * Fixed a bug where images would flash like crazy during a scan because the code to refresh the underlying image wasn't checking the entity type or Id. * When filtering rating, only apply the filter to your account. * Removed Disposable on tests
165 lines
4.5 KiB
C#
165 lines
4.5 KiB
C#
using System;
|
|
using API.DTOs.Update;
|
|
|
|
namespace API.SignalR
|
|
{
|
|
public static class MessageFactory
|
|
{
|
|
public static SignalRMessage ScanSeriesEvent(int seriesId, string seriesName)
|
|
{
|
|
return new SignalRMessage()
|
|
{
|
|
Name = SignalREvents.ScanSeries,
|
|
Body = new
|
|
{
|
|
SeriesId = seriesId,
|
|
SeriesName = seriesName
|
|
}
|
|
};
|
|
}
|
|
|
|
public static SignalRMessage SeriesAddedEvent(int seriesId, string seriesName, int libraryId)
|
|
{
|
|
return new SignalRMessage()
|
|
{
|
|
Name = SignalREvents.SeriesAdded,
|
|
Body = new
|
|
{
|
|
SeriesId = seriesId,
|
|
SeriesName = seriesName,
|
|
LibraryId = libraryId
|
|
}
|
|
};
|
|
}
|
|
|
|
public static SignalRMessage SeriesRemovedEvent(int seriesId, string seriesName, int libraryId)
|
|
{
|
|
return new SignalRMessage()
|
|
{
|
|
Name = SignalREvents.SeriesRemoved,
|
|
Body = new
|
|
{
|
|
SeriesId = seriesId,
|
|
SeriesName = seriesName,
|
|
LibraryId = libraryId
|
|
}
|
|
};
|
|
}
|
|
|
|
public static SignalRMessage ScanLibraryProgressEvent(int libraryId, float progress)
|
|
{
|
|
return new SignalRMessage()
|
|
{
|
|
Name = SignalREvents.ScanLibraryProgress,
|
|
Body = new
|
|
{
|
|
LibraryId = libraryId,
|
|
Progress = progress,
|
|
EventTime = DateTime.Now
|
|
}
|
|
};
|
|
}
|
|
|
|
public static SignalRMessage RefreshMetadataProgressEvent(int libraryId, float progress)
|
|
{
|
|
return new SignalRMessage()
|
|
{
|
|
Name = SignalREvents.RefreshMetadataProgress,
|
|
Body = new
|
|
{
|
|
LibraryId = libraryId,
|
|
Progress = progress,
|
|
EventTime = DateTime.Now
|
|
}
|
|
};
|
|
}
|
|
|
|
|
|
public static SignalRMessage BackupDatabaseProgressEvent(float progress)
|
|
{
|
|
return new SignalRMessage()
|
|
{
|
|
Name = SignalREvents.BackupDatabaseProgress,
|
|
Body = new
|
|
{
|
|
Progress = progress
|
|
}
|
|
};
|
|
}
|
|
public static SignalRMessage CleanupProgressEvent(float progress)
|
|
{
|
|
return new SignalRMessage()
|
|
{
|
|
Name = SignalREvents.CleanupProgress,
|
|
Body = new
|
|
{
|
|
Progress = progress
|
|
}
|
|
};
|
|
}
|
|
|
|
|
|
|
|
public static SignalRMessage UpdateVersionEvent(UpdateNotificationDto update)
|
|
{
|
|
return new SignalRMessage
|
|
{
|
|
Name = SignalREvents.UpdateAvailable,
|
|
Body = update
|
|
};
|
|
}
|
|
|
|
public static SignalRMessage SeriesAddedToCollection(int tagId, int seriesId)
|
|
{
|
|
return new SignalRMessage
|
|
{
|
|
Name = SignalREvents.UpdateAvailable,
|
|
Body = new
|
|
{
|
|
TagId = tagId,
|
|
SeriesId = seriesId
|
|
}
|
|
};
|
|
}
|
|
|
|
public static SignalRMessage ScanLibraryError(int libraryId)
|
|
{
|
|
return new SignalRMessage
|
|
{
|
|
Name = SignalREvents.ScanLibraryError,
|
|
Body = new
|
|
{
|
|
LibraryId = libraryId,
|
|
}
|
|
};
|
|
}
|
|
|
|
public static SignalRMessage DownloadProgressEvent(string username, string downloadName, float progress)
|
|
{
|
|
return new SignalRMessage()
|
|
{
|
|
Name = SignalREvents.DownloadProgress,
|
|
Body = new
|
|
{
|
|
UserName = username,
|
|
DownloadName = downloadName,
|
|
Progress = progress
|
|
}
|
|
};
|
|
}
|
|
|
|
public static SignalRMessage CoverUpdateEvent(int id, string entityType)
|
|
{
|
|
return new SignalRMessage()
|
|
{
|
|
Name = SignalREvents.CoverUpdate,
|
|
Body = new
|
|
{
|
|
Id = id,
|
|
EntityType = entityType,
|
|
}
|
|
};
|
|
}
|
|
}
|
|
}
|