Exemplo n.º 1
0
        private void ItemUpdated(BaseItem item)
        {
            lock (_libraryChangedSyncLock)
            {
                if (WriteTimer == null)
                {
                    WriteTimer = new Timer(TimerCallback, null, WriteDelay, Timeout.Infinite);
                }
                else
                {
                    WriteTimer.Change(WriteDelay, Timeout.Infinite);
                }

                var itemRec = new ItemRec
                {
                    Guid = item.Id,
#if EMBY
                    ItemId = item.GetClientId(),
#endif
                    Status = ItemStatus.Updated,
                    Type   = item.GetClientTypeName()
                };

                _logger.LogDebug($"InfuseSync saving updated item {item.Id}");
                _itemsUpdated.Add(itemRec);
            }
        }
Exemplo n.º 2
0
        private void ItemRemoved(BaseItem item)
        {
            lock (_libraryChangedSyncLock)
            {
                if (WriteTimer == null)
                {
                    WriteTimer = new Timer(TimerCallback, null, WriteDelay, Timeout.Infinite);
                }
                else
                {
                    WriteTimer.Change(WriteDelay, Timeout.Infinite);
                }

#if EMBY
                long?seriesId;
#else
                Guid?seriesId;
#endif
                int?seasonNumber;
                if (item is Season season)
                {
                    seriesId     = season.SeriesId;
                    seasonNumber = season.IndexNumber;
                }
                else
                {
                    seriesId     = null;
                    seasonNumber = null;
                }

                var itemRec = new ItemRec
                {
                    Guid = item.Id,
#if EMBY
                    ItemId = item.GetClientId(),
#endif
                    SeriesId = seriesId,
                    Season   = seasonNumber,
                    Status   = ItemStatus.Removed,
                    Type     = item.GetClientTypeName()
                };

                _logger.LogDebug($"InfuseSync saving removed item {item.Id}");
                _itemsRemoved.Add(itemRec);
            }
        }