using metarepo
This commit is contained in:
parent
75415b4db4
commit
26b4c3fa64
@ -121,8 +121,8 @@ namespace Selector.CLI.Extensions
|
|||||||
services.AddTransient<IScrobbleRepository, ScrobbleRepository>()
|
services.AddTransient<IScrobbleRepository, ScrobbleRepository>()
|
||||||
.AddTransient<ISpotifyListenRepository, SpotifyListenRepository>();
|
.AddTransient<ISpotifyListenRepository, SpotifyListenRepository>();
|
||||||
|
|
||||||
//services.AddTransient<IListenRepository, MetaListenRepository>();
|
services.AddTransient<IListenRepository, MetaListenRepository>();
|
||||||
services.AddTransient<IListenRepository, SpotifyListenRepository>();
|
//services.AddTransient<IListenRepository, SpotifyListenRepository>();
|
||||||
|
|
||||||
services.AddTransient<IScrobbleMappingRepository, ScrobbleMappingRepository>();
|
services.AddTransient<IScrobbleMappingRepository, ScrobbleMappingRepository>();
|
||||||
|
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
using System;
|
using System.Text.Json;
|
||||||
using System.Text.Json;
|
|
||||||
using Selector.Model;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using System.Diagnostics.Metrics;
|
using Selector.Model;
|
||||||
|
|
||||||
namespace Selector.Data;
|
namespace Selector.Data;
|
||||||
|
|
||||||
@ -60,14 +58,16 @@ public class HistoryPersister
|
|||||||
{
|
{
|
||||||
if (Config.InitialClear)
|
if (Config.InitialClear)
|
||||||
{
|
{
|
||||||
Db.SpotifyListen.RemoveRange(Db.SpotifyListen.Where(x => x.User.UserName == Config.Username));
|
var latestTime = input.OrderBy(x => x.ts).Last().ts;
|
||||||
|
var time = DateTime.Parse(latestTime).ToUniversalTime();
|
||||||
|
Db.SpotifyListen.RemoveRange(Db.SpotifyListen.Where(x => x.User.UserName == Config.Username && x.Timestamp <= time));
|
||||||
}
|
}
|
||||||
|
|
||||||
var user = Db.Users.Single(u => u.UserName == Config.Username);
|
var user = Db.Users.Single(u => u.UserName == Config.Username);
|
||||||
|
|
||||||
var counter = 0;
|
var counter = 0;
|
||||||
|
|
||||||
var filtered = input.Where(x => x.ms_played > 20000)
|
var filtered = input.Where(x => x.ms_played > 30000)
|
||||||
.DistinctBy(x => (x.offline_timestamp, x.ts, x.spotify_track_uri))
|
.DistinctBy(x => (x.offline_timestamp, x.ts, x.spotify_track_uri))
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
|
@ -4,11 +4,6 @@ using System.Linq;
|
|||||||
|
|
||||||
namespace Selector.Model;
|
namespace Selector.Model;
|
||||||
|
|
||||||
public enum PreferenceMode
|
|
||||||
{
|
|
||||||
Greedy, LastFm, Spotify
|
|
||||||
}
|
|
||||||
|
|
||||||
public class MetaListenRepository: IListenRepository
|
public class MetaListenRepository: IListenRepository
|
||||||
{
|
{
|
||||||
private readonly IScrobbleRepository scrobbleRepository;
|
private readonly IScrobbleRepository scrobbleRepository;
|
||||||
@ -27,10 +22,13 @@ public class MetaListenRepository: IListenRepository
|
|||||||
string albumName = null,
|
string albumName = null,
|
||||||
string artistName = null,
|
string artistName = null,
|
||||||
DateTime? from = null,
|
DateTime? from = null,
|
||||||
DateTime? to = null)
|
DateTime? to = null) => GetAll(userId: userId,
|
||||||
{
|
username: username,
|
||||||
throw new NotImplementedException();
|
trackName: trackName,
|
||||||
}
|
albumName: albumName,
|
||||||
|
artistName: artistName,
|
||||||
|
from: from,
|
||||||
|
to:to).Count();
|
||||||
|
|
||||||
public IEnumerable<IListen> GetAll(
|
public IEnumerable<IListen> GetAll(
|
||||||
string includes = null,
|
string includes = null,
|
||||||
@ -62,14 +60,12 @@ public class MetaListenRepository: IListenRepository
|
|||||||
albumName: albumName,
|
albumName: albumName,
|
||||||
artistName: artistName,
|
artistName: artistName,
|
||||||
from: from,
|
from: from,
|
||||||
to: to)
|
to: scrobbles.FirstOrDefault()?.Timestamp)
|
||||||
.OrderBy(x => x.Timestamp)
|
.OrderBy(x => x.Timestamp)
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
|
|
||||||
var scrobbleIter = scrobbles.GetEnumerator();
|
return spotListens.Concat(scrobbles);
|
||||||
var spotIter = spotListens.GetEnumerator();
|
|
||||||
|
|
||||||
return scrobbles;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,8 +67,8 @@ namespace Selector.Web
|
|||||||
services.AddTransient<IScrobbleRepository, ScrobbleRepository>()
|
services.AddTransient<IScrobbleRepository, ScrobbleRepository>()
|
||||||
.AddTransient<ISpotifyListenRepository, SpotifyListenRepository>();
|
.AddTransient<ISpotifyListenRepository, SpotifyListenRepository>();
|
||||||
|
|
||||||
//services.AddTransient<IListenRepository, MetaListenRepository>();
|
services.AddTransient<IListenRepository, MetaListenRepository>();
|
||||||
services.AddTransient<IListenRepository, SpotifyListenRepository>();
|
//services.AddTransient<IListenRepository, SpotifyListenRepository>();
|
||||||
|
|
||||||
services.AddIdentity<ApplicationUser, IdentityRole>()
|
services.AddIdentity<ApplicationUser, IdentityRole>()
|
||||||
.AddEntityFrameworkStores<ApplicationDbContext>()
|
.AddEntityFrameworkStores<ApplicationDbContext>()
|
||||||
|
Loading…
Reference in New Issue
Block a user