예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }