public void SyncMediaToTrakt() { if (!IsSynchronizing) { try { IsSynchronizing = true; IThreadPool threadPool = _mediaPortalServices.GetThreadPool(); threadPool.Add(() => { if (_mediaPortalServices.GetTraktSettingsWatcher().TraktSettings.SyncOnlyMovies || _mediaPortalServices.GetTraktSettingsWatcher().TraktSettings.SyncSeriesAndMovies) { TestStatus = "[Trakt.SyncMovies]"; _librarySynchronization.SyncMovies(); } if (_mediaPortalServices.GetTraktSettingsWatcher().TraktSettings.SyncOnlySeries || _mediaPortalServices.GetTraktSettingsWatcher().TraktSettings.SyncSeriesAndMovies) { TestStatus = "[Trakt.SyncSeries]"; _librarySynchronization.SyncSeries(); } IsSynchronizing = false; TestStatus = "[Trakt.SyncFinished]"; }, ThreadPriority.BelowNormal); } catch (MediaLibraryNotConnectedException ex) { TestStatus = "[Trakt.MediaLibraryNotConnected]"; _mediaPortalServices.GetLogger().Error(ex.Message); } catch (Exception ex) { TestStatus = "[Trakt.SyncingFailed]"; _mediaPortalServices.GetLogger().Error(ex.Message); } } }