public AlbumCacheTask(ILastfmClientFactory lastfmFactory, IS3ClientFactory s3Factory, ICacheProvider cacheProvider, ILogger<AlbumCacheTask> logger) { this.s3Client = s3Factory.CreateS3Client(); this.lastfmClient = lastfmFactory.CreateLastfmClient(); this.cacheProvider = cacheProvider; this.logger = logger; }
public void Quit() { if (sva != null) { sva.Dispose(); sva = null; } }
private void ResetClient() { if (sva != null) { try { sva.Dispose(); } catch (Exception ex) { Logger.Error(ex); } finally { sva = null; } } switch (pref.ScrobbleMethod) { case Preference.ScrobbleMethods.Standalone: if ((pref.Username != null && pref.password != null && pref.Username != "" && pref.password != "") || pref.Username != this.pref.Username) { pref.AuthToken = ""; try { var lastfm = new LuteaLastfm(); var result = lastfm.Auth_getMobileSession(pref.Username, pref.password); if (result) { pref.AuthToken = Lastfm.GenAuthToken(pref.Username, pref.password); } } catch (Exception e) { Logger.Error(e); } } if (pref.ScrobbleEnabled) { sva = new StandaloneLastfmClient(this); } break; case Preference.ScrobbleMethods.ViaLastfmApp: if (pref.ScrobbleEnabled) { sva = new ViaAppLastfmClient(); } break; } }