@@ -13,8 +13,6 @@ namespace MultiFunPlayer.MediaSource.ViewModels;
1313[ DisplayName ( "Emby" ) ]
1414internal sealed class EmbyMediaSource ( IShortcutManager shortcutManager , IEventAggregator eventAggregator ) : AbstractMediaSource ( shortcutManager , eventAggregator )
1515{
16- protected override Logger Logger { get ; } = LogManager . GetCurrentClassLogger ( ) ;
17-
1816 private CancellationTokenSource _refreshCancellationSource = new ( ) ;
1917 private EmbySession _currentSession ;
2018
@@ -125,13 +123,11 @@ private async Task ReadAsync(HttpClient client, CancellationToken token)
125123
126124 var sessionsUri = new Uri ( ServerBaseUri , $ "/Sessions?api_key={ ApiKey } &DeviceId={ SelectedDeviceId } ") ;
127125 var response = await client . GetAsync ( sessionsUri , token ) ;
128- if ( response == null )
129- continue ;
130-
131126 response . EnsureSuccessStatusCode ( ) ;
132- var message = await response . Content . ReadAsStringAsync ( token ) ;
133127
128+ var message = await response . Content . ReadAsStringAsync ( token ) ;
134129 Logger . Trace ( "Received \" {0}\" from \" {1}\" " , message , Name ) ;
130+
135131 try
136132 {
137133 var o = JArray . Parse ( message ) . Children < JObject > ( ) . FirstOrDefault ( ) ;
@@ -368,13 +364,13 @@ protected override void Dispose(bool disposing)
368364 base . Dispose ( disposing ) ;
369365 }
370366
371- internal sealed record EmbyDevice ( string Name , [ JsonProperty ( "ReportedDeviceId" ) ] string Id , string AppName , string AppVersion )
367+ internal sealed record EmbyDevice ( string Name , [ property : JsonProperty ( "ReportedDeviceId" ) ] string Id , string AppName , string AppVersion )
372368 {
373369 public bool Equals ( EmbyDevice other ) => string . Equals ( Id , other ? . Id , StringComparison . Ordinal ) ;
374370 public override int GetHashCode ( ) => Id . GetHashCode ( ) ;
375371 }
376372
377- internal sealed record EmbySession ( string Id , [ JsonProperty ( "PlayState" ) ] PlayState State , [ JsonProperty ( "NowPlayingItem" ) ] PlayItem Item ) ;
378- internal sealed record PlayState ( long PositionTicks , bool IsPaused , double PlaybackRate ) ;
379- internal sealed record PlayItem ( long RunTimeTicks , string Path ) ;
373+ private sealed record EmbySession ( string Id , [ property : JsonProperty ( "PlayState" ) ] PlayState State , [ property : JsonProperty ( "NowPlayingItem" ) ] PlayItem Item ) ;
374+ private sealed record PlayState ( long PositionTicks , bool IsPaused , double PlaybackRate ) ;
375+ private sealed record PlayItem ( long RunTimeTicks , string Path ) ;
380376}
0 commit comments