public async Task <bool> MarkAsWatched(MediaItem mediaItem) { bool result = false; SetWatched setWatchedAction = new SetWatched(); if (await setWatchedAction.IsAvailableAsync(mediaItem)) { try { var processResult = await setWatchedAction.ProcessAsync(mediaItem); if (processResult.Success && processResult.Result != ContentDirectoryMessaging.MediaItemChangeType.None) { ContentDirectoryMessaging.SendMediaItemChangedMessage(mediaItem, processResult.Result); GetLogger().Info("Marking media item '{0}' as watched", mediaItem.GetType()); result = true; } } catch (Exception ex) { GetLogger().Error("Marking media item '{0}' as watched failed:", mediaItem.GetType(), ex); result = false; } } return(result); }
public async Task <bool> MarkAsWatched(MediaItem mediaItem) { bool result = false; SetWatched setWatchedAction = new SetWatched(); if (await setWatchedAction.IsAvailableAsync(mediaItem)) { try { var processResult = await setWatchedAction.ProcessAsync(mediaItem); if (processResult.Success && processResult.Result != ContentDirectoryMessaging.MediaItemChangeType.None) { ContentDirectoryMessaging.SendMediaItemChangedMessage(mediaItem, processResult.Result); result = true; } else { GetLogger().Error("FlagMover: Marking media item '{0}' as watched failed:", mediaItem.GetType()); } } catch (Exception ex) { GetLogger().Error("FlagMover: Exception occurred while marking media item '{0}' as watched. Message: {1}", mediaItem.GetType(), ex.Message); } } else { GetLogger().Warn("FlagMover: The SetWatched action is not available for '{0}'. Already marked as watched?", mediaItem.GetType()); } return(result); }
public bool MarkAsWatched(MediaItem mediaItem) { bool result = false; SetWatched setWatchedAction = new SetWatched(); if (setWatchedAction.IsAvailable(mediaItem)) { try { ContentDirectoryMessaging.MediaItemChangeType changeType; if (setWatchedAction.Process(mediaItem, out changeType) && changeType != ContentDirectoryMessaging.MediaItemChangeType.None) { ContentDirectoryMessaging.SendMediaItemChangedMessage(mediaItem, changeType); result = true; } else { GetLogger().Error("FlagMover: Marking media item '{0}' as watched failed:", mediaItem.GetType()); } } catch (Exception ex) { GetLogger().Error("FlagMover: Exception occurred while marking media item '{0}' as watched. Message: {1}", mediaItem.GetType(), ex.Message); } } else { GetLogger().Warn("FlagMover: The SetWatched action is not available for '{0}'. Already marked as watched?", mediaItem.GetType()); } return(result); }