Skip to content

Commit

Permalink
v1.1.0
Browse files Browse the repository at this point in the history
added card view for tracked anime (you can switch this in settings)
fixed home showing wrong date
covers from tracked anime get saved in covers folder now
added a button in Home top left that shows predicted releases of new episodes
various other fixes/changes
  • Loading branch information
Tensei committed May 11, 2021
1 parent e327d85 commit 97cd4a7
Show file tree
Hide file tree
Showing 54 changed files with 1,942 additions and 484 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -337,4 +337,6 @@ ASALocalRun/
.localhistory/

# BeatPulse healthcheck temp database
healthchecksdb
healthchecksdb

windows/
18 changes: 18 additions & 0 deletions anidow.sln
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,37 @@ EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|ARM = Debug|ARM
Debug|ARM64 = Debug|ARM64
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|ARM = Release|ARM
Release|ARM64 = Release|ARM64
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{16F07616-8043-409D-97F9-D4A0ABF49654}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{16F07616-8043-409D-97F9-D4A0ABF49654}.Debug|Any CPU.Build.0 = Debug|Any CPU
{16F07616-8043-409D-97F9-D4A0ABF49654}.Debug|ARM.ActiveCfg = Debug|Any CPU
{16F07616-8043-409D-97F9-D4A0ABF49654}.Debug|ARM.Build.0 = Debug|Any CPU
{16F07616-8043-409D-97F9-D4A0ABF49654}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{16F07616-8043-409D-97F9-D4A0ABF49654}.Debug|ARM64.Build.0 = Debug|Any CPU
{16F07616-8043-409D-97F9-D4A0ABF49654}.Debug|x64.ActiveCfg = Debug|x64
{16F07616-8043-409D-97F9-D4A0ABF49654}.Debug|x64.Build.0 = Debug|x64
{16F07616-8043-409D-97F9-D4A0ABF49654}.Debug|x86.ActiveCfg = Debug|Any CPU
{16F07616-8043-409D-97F9-D4A0ABF49654}.Debug|x86.Build.0 = Debug|Any CPU
{16F07616-8043-409D-97F9-D4A0ABF49654}.Release|Any CPU.ActiveCfg = Release|Any CPU
{16F07616-8043-409D-97F9-D4A0ABF49654}.Release|Any CPU.Build.0 = Release|Any CPU
{16F07616-8043-409D-97F9-D4A0ABF49654}.Release|ARM.ActiveCfg = Release|Any CPU
{16F07616-8043-409D-97F9-D4A0ABF49654}.Release|ARM.Build.0 = Release|Any CPU
{16F07616-8043-409D-97F9-D4A0ABF49654}.Release|ARM64.ActiveCfg = Release|Any CPU
{16F07616-8043-409D-97F9-D4A0ABF49654}.Release|ARM64.Build.0 = Release|Any CPU
{16F07616-8043-409D-97F9-D4A0ABF49654}.Release|x64.ActiveCfg = Release|x64
{16F07616-8043-409D-97F9-D4A0ABF49654}.Release|x64.Build.0 = Release|x64
{16F07616-8043-409D-97F9-D4A0ABF49654}.Release|x86.ActiveCfg = Release|Any CPU
{16F07616-8043-409D-97F9-D4A0ABF49654}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
1 change: 1 addition & 0 deletions anidow/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
TargetType="{x:Type GridViewColumnHeader}">
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Margin" Value="2" />
</Style>

Expand Down
24 changes: 17 additions & 7 deletions anidow/Bootstrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@
using Serilog.Events;
using Stylet;
using StyletIoC;

#if RELEASE
using MessageBox = AdonisUI.Controls.MessageBox;
using MessageBoxButton = AdonisUI.Controls.MessageBoxButton;
using MessageBoxImage = AdonisUI.Controls.MessageBoxImage;

#endif

namespace Anidow
{
public class Bootstrapper : Bootstrapper<ShellViewModel>
{
private ILogger _logger;
private HttpClient _httpClient;
private ILogger _logger;

// Configure the IoC container in here
protected override void ConfigureIoC(IStyletIoCBuilder builder)
Expand All @@ -60,7 +60,9 @@ protected override void ConfigureIoC(IStyletIoCBuilder builder)

_httpClient = InitHttpClient();
builder.Bind<HttpClient>().ToInstance(_httpClient);
builder.Bind<TaskbarIcon>().ToSelf().InSingletonScope();
var shell = new ShellView(tracker);
builder.Bind<TaskbarIcon>().ToInstance(shell.TaskbarIcon);
builder.Bind<ShellView>().ToInstance(shell);

//BindViewModels(builder);
}
Expand Down Expand Up @@ -100,7 +102,7 @@ private Tracker InitTracker()
{
var tracker = new Tracker(new JsonFileStore(Environment.SpecialFolder.CommonApplicationData));
tracker.Configure<ShellView>()
.Id(w => $"[Width={SystemParameters.VirtualScreenWidth},Height{SystemParameters.VirtualScreenHeight}]")
.Id(_ => $"[Width={SystemParameters.VirtualScreenWidth},Height{SystemParameters.VirtualScreenHeight}]")
.Properties(w => new { w.Height, w.Width, w.Left, w.Top, w.WindowState })
.PersistOn(nameof(ShellView.Closing))
.StopTrackingOn(nameof(ShellView.Closing));
Expand All @@ -127,12 +129,21 @@ protected override async void Configure()
await using var db = new TrackContext();
await db.Database.MigrateAsync();
}

var selfContained = false;
#if SELF_CONTAINED && RELEASE
selfContained = true;
#endif

#if RELEASE
try
{

var manager = new UpdateManager(
new GithubPackageResolver(_httpClient, "MemeLabs", "Anidow", "anidow*.zip"),
new GithubPackageResolver(
_httpClient,
"MemeLabs",
"Anidow",
selfContained ? "anidow-full.zip" : "anidow.zip"),
new ZipPackageExtractor());

var check = await manager.CheckForUpdatesAsync();
Expand All @@ -155,7 +166,6 @@ protected override async void Configure()
}
#endif
}

#if RELEASE
protected override void OnUnhandledException(DispatcherUnhandledExceptionEventArgs e)
{
Expand Down
35 changes: 35 additions & 0 deletions anidow/Converters/AnimeStatusToColorConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using Anidow.Enums;

namespace Anidow.Converters
{
public class AnimeStatusToColorConverter: IValueConverter
{
public static readonly AnimeStatusToColorConverter Instance = new();
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var status = (AnimeStatus)value;

var color = status switch
{
AnimeStatus.Watching => "#43A047",
AnimeStatus.Finished => "#039BE5",
AnimeStatus.Dropped => "#E53935",
_ => "Transparent"
};
return color;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
2 changes: 1 addition & 1 deletion anidow/Converters/DateTimeToStringConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class DateTimeToStringConverter : IValueConverter

public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var s = ((DateTime)value!).ToLocalTime().Humanize();
var s = ((DateTime)value!).Humanize();
return s;
}

Expand Down
24 changes: 24 additions & 0 deletions anidow/Converters/DownloadCoverConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace Anidow.Converters
{
public class DownloadCoverConverter: IMultiValueConverter
{
public static readonly DownloadCoverConverter Instance = new();
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
return (values[0], values[1]);
}

public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
22 changes: 22 additions & 0 deletions anidow/Converters/IsNotNullToVisibilityConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace Anidow.Converters
{
public class IsNotNullToVisibilityConverter : IValueConverter
{
public static readonly IsNotNullToVisibilityConverter Instance = new();

public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value == null ? Visibility.Visible : Visibility.Collapsed;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
12 changes: 8 additions & 4 deletions anidow/Converters/IsNullToVisibilityConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@ namespace Anidow.Converters
{
public class IsNullToVisibilityConverter : IValueConverter
{
public static readonly IsNullToVisibilityConverter Instance = new IsNullToVisibilityConverter();
public static readonly IsNullToVisibilityConverter Instance = new();

public object Convert(object value, Type targetType, object parameter, CultureInfo culture) =>
value == null ? Visibility.Collapsed : Visibility.Visible;
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value == null ? Visibility.Collapsed : Visibility.Visible;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) =>
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
26 changes: 22 additions & 4 deletions anidow/Converters/IsZeroToVisibilityConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,30 @@ namespace Anidow.Converters
{
class IsZeroToVisibilityConverter : IValueConverter
{
public static readonly IsZeroToVisibilityConverter Instance = new IsZeroToVisibilityConverter();
public static readonly IsZeroToVisibilityConverter Instance = new();

public object Convert(object value, Type targetType, object parameter, CultureInfo culture) =>
value != null && (int)value == 0 ? Visibility.Visible : Visibility.Collapsed;
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value != null && (int) value == 0 ? Visibility.Visible : Visibility.Collapsed;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) =>
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
class IsNotZeroToVisibilityConverter : IValueConverter
{
public static readonly IsNotZeroToVisibilityConverter Instance = new();

public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value != null && (int) value == 0 ? Visibility.Collapsed : Visibility.Visible;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
7 changes: 5 additions & 2 deletions anidow/Converters/TorrentClientEnumToIntConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ namespace Anidow.Converters
{
public class TorrentClientEnumToIntConverter : IValueConverter
{
public static readonly TorrentClientEnumToIntConverter Instance = new TorrentClientEnumToIntConverter();
public static readonly TorrentClientEnumToIntConverter Instance = new();

public object Convert(object value, Type targetType, object parameter, CultureInfo culture) => (int) value!;
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return (int) value!;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) =>
(TorrentClient) value!;
Expand Down
7 changes: 7 additions & 0 deletions anidow/Database/Models/Anime.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Runtime.CompilerServices;
using Anidow.Annotations;
using Anidow.Enums;
using Anidow.Model;
using Anidow.Utils;
using Humanizer;

namespace Anidow.Database.Models
Expand All @@ -18,6 +22,7 @@ public class Anime : ObservableObject
public string Resolution { get; set; }
public DateTime Released { get; set; }
public string Cover { get; set; }
public virtual Cover CoverData { get; set; }
public string GroupId { get; set; }
public string GroupUrl { get; set; }
public string Group { get; set; }
Expand All @@ -27,5 +32,7 @@ public class Anime : ObservableObject
[NotMapped] public bool IsAiring => Status == AnimeStatus.Watching;
[NotMapped] public bool IsFinished => Status == AnimeStatus.Finished;
[NotMapped] public int Episodes { get; set; }
[NotMapped] public bool TrackedViewSelected { get; set; }
[NotMapped] public string Notification { get; set; }
}
}
16 changes: 16 additions & 0 deletions anidow/Database/Models/Cover.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.ComponentModel.DataAnnotations.Schema;
using System.IO;
using Anidow.Model;

namespace Anidow.Database.Models
{
public class Cover : ObservableObject
{
public int Id { get; set; }
public DateTime Created { get; set; } = DateTime.UtcNow;
public string File { get; set; }
[NotMapped]
public string FilePath => Path.Combine(Directory.GetCurrentDirectory(), File);
}
}
4 changes: 2 additions & 2 deletions anidow/Database/Models/Episode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ public class Episode : ObservableObject, ITorrentItem, IEpisode
public bool Hide { get; set; }
public DateTime HideDate { get; set; }
public string Cover { get; set; }

public virtual Cover CoverData { get; set; }
public string Link { get; set; }

[NotMapped] public string ReleasedString => Released.Humanize();
[NotMapped] public string WatchedDateString => WatchedDate.Humanize();
[NotMapped] public string WatchedString => WatchedDate == default ? string.Empty : WatchedDate.Humanize();
[NotMapped] public string EpisodeNum => Name.GetEpisode();

public string AnimeId { get; set; }
Expand Down
1 change: 1 addition & 0 deletions anidow/Database/TrackContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public class TrackContext : DbContext
{
public DbSet<Anime> Anime { get; set; }
public DbSet<Episode> Episodes { get; set; }
public DbSet<Cover> Covers { get; set; }

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
Expand Down
18 changes: 18 additions & 0 deletions anidow/Extensions/JsonElementExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

namespace Anidow.Extensions
{
public static class JsonElementExtensions
{
public static T ToObject<T>(this JsonElement element)
{
var json = element.GetRawText();
return JsonSerializer.Deserialize<T>(json);
}
}
}

0 comments on commit 97cd4a7

Please sign in to comment.