- Add Book.IsSpatial property and add it to search index - Read audio format of actual output files and store it in UserDefinedItem. Now works with MP3s. - Store last downloaded audio file version - Add IsSpatial, file version, and Audio Format to library exports and to template tags. Updated docs. - Add last downloaded audio file version and format info to the Last Downloaded tab - Migrated the DB - Update AAXClean with some bug fixes - Fixed error converting xHE-AAC audio files to mp3 when splitting by chapter (or trimming the audible branding from the beginning of the file) - Improve mp3 ID# tags support. Chapter titles are now preserved. - Add support for reading EC-3 and AC-4 audio format metadata
51 lines
1.7 KiB
C#
51 lines
1.7 KiB
C#
using DataLayer;
|
|
using System;
|
|
|
|
namespace LibationUiBase.GridView
|
|
{
|
|
public class LastDownloadStatus : IComparable
|
|
{
|
|
public bool IsValid => LastDownloadedVersion is not null && LastDownloaded.HasValue;
|
|
public AudioFormat LastDownloadedFormat { get; }
|
|
public string LastDownloadedFileVersion { get; }
|
|
public Version LastDownloadedVersion { get; }
|
|
public DateTime? LastDownloaded { get; }
|
|
public string ToolTipText => IsValid ? $"Double click to open v{LastDownloadedVersion.ToString(3)} release notes" : "";
|
|
|
|
public LastDownloadStatus() { }
|
|
public LastDownloadStatus(UserDefinedItem udi)
|
|
{
|
|
LastDownloadedVersion = udi.LastDownloadedVersion;
|
|
LastDownloadedFormat = udi.LastDownloadedFormat;
|
|
LastDownloadedFileVersion = udi.LastDownloadedFileVersion;
|
|
LastDownloaded = udi.LastDownloaded;
|
|
}
|
|
|
|
public void OpenReleaseUrl()
|
|
{
|
|
if (IsValid)
|
|
Dinah.Core.Go.To.Url($"{AppScaffolding.LibationScaffolding.RepositoryUrl}/releases/tag/v{LastDownloadedVersion.ToString(3)}");
|
|
}
|
|
|
|
public override string ToString()
|
|
=> IsValid ? $"""
|
|
{dateString()} (File v.{LastDownloadedFileVersion})
|
|
{LastDownloadedFormat}
|
|
Libation v{LastDownloadedVersion.ToString(3)}
|
|
""" : "";
|
|
|
|
|
|
//Call ToShortDateString to use current culture's date format.
|
|
private string dateString() => $"{LastDownloaded.Value.ToShortDateString()} {LastDownloaded.Value:HH:mm}";
|
|
|
|
public int CompareTo(object obj)
|
|
{
|
|
if (obj is not LastDownloadStatus second) return -1;
|
|
else if (IsValid && !second.IsValid) return -1;
|
|
else if (!IsValid && second.IsValid) return 1;
|
|
else if (!IsValid && !second.IsValid) return 0;
|
|
else return LastDownloaded.Value.CompareTo(second.LastDownloaded.Value);
|
|
}
|
|
}
|
|
}
|