public PlaylistItem Create(Photo item, DeviceProfile profile)
        {
            var playlistItem = new PlaylistItem
            {
                ItemId = item.Id.ToString("N"),
                MediaType = DlnaProfileType.Photo
            };

            var directPlay = profile.DirectPlayProfiles
                .FirstOrDefault(i => i.Type == playlistItem.MediaType && IsSupported(i, item));

            if (directPlay != null)
            {
                playlistItem.Transcode = false;
                playlistItem.Container = Path.GetExtension(item.Path);

                return playlistItem;
            }

            var transcodingProfile = profile.TranscodingProfiles
                .FirstOrDefault(i => i.Type == playlistItem.MediaType && IsSupported(profile, i, item));

            if (transcodingProfile != null)
            {
                playlistItem.Transcode = true;
                playlistItem.Container = "." + transcodingProfile.Container.TrimStart('.');
            }

            return playlistItem;
        }
        public PlaylistItem Create(Photo item, DeviceProfile profile)
        {
            var playlistItem = new PlaylistItem
            {
                StreamInfo = new StreamInfo
                {
                    ItemId = item.Id.ToString("N"),
                    MediaType = DlnaProfileType.Photo,
                },

                Profile = profile
            };

            var directPlay = profile.DirectPlayProfiles
                .FirstOrDefault(i => i.Type == DlnaProfileType.Photo && IsSupported(i, item));

            if (directPlay != null)
            {
                playlistItem.StreamInfo.PlayMethod = PlayMethod.DirectStream;
                playlistItem.StreamInfo.Container = Path.GetExtension(item.Path);

                return playlistItem;
            }

            var transcodingProfile = profile.TranscodingProfiles
                .FirstOrDefault(i => i.Type == DlnaProfileType.Photo);

            if (transcodingProfile != null)
            {
                playlistItem.StreamInfo.PlayMethod = PlayMethod.Transcode;
                playlistItem.StreamInfo.Container = "." + transcodingProfile.Container.TrimStart('.');
            }

            return playlistItem;
        }
        private bool IsSupported(DirectPlayProfile profile, Photo item)
        {
            var mediaPath = item.Path;

            if (profile.Container.Length > 0)
            {
                // Check container type
                var mediaContainer = Path.GetExtension(mediaPath);
                if (!profile.GetContainers().Any(i => string.Equals("." + i.TrimStart('.'), mediaContainer, StringComparison.OrdinalIgnoreCase)))
                {
                    return false;
                }
            }

            return true;
        }
Beispiel #4
0
        private static void SetPhotoProperties(BaseItemDto dto, Photo item)
        {
            dto.CameraMake       = item.CameraMake;
            dto.CameraModel      = item.CameraModel;
            dto.Software         = item.Software;
            dto.ExposureTime     = item.ExposureTime;
            dto.FocalLength      = item.FocalLength;
            dto.ImageOrientation = item.Orientation;
            dto.Aperture         = item.Aperture;
            dto.ShutterSpeed     = item.ShutterSpeed;

            dto.Latitude       = item.Latitude;
            dto.Longitude      = item.Longitude;
            dto.Altitude       = item.Altitude;
            dto.IsoSpeedRating = item.IsoSpeedRating;

            var album = item.AlbumEntity;

            if (album != null)
            {
                dto.Album   = album.Name;
                dto.AlbumId = album.Id;
            }
        }
Beispiel #5
0
        private void SetPhotoProperties(BaseItemDto dto, Photo item)
        {
            dto.Width = item.Width;
            dto.Height = item.Height;
            dto.CameraMake = item.CameraMake;
            dto.CameraModel = item.CameraModel;
            dto.Software = item.Software;
            dto.ExposureTime = item.ExposureTime;
            dto.FocalLength = item.FocalLength;
            dto.ImageOrientation = item.Orientation;
            dto.Aperture = item.Aperture;
            dto.ShutterSpeed = item.ShutterSpeed;

            dto.Latitude = item.Latitude;
            dto.Longitude = item.Longitude;
            dto.Altitude = item.Altitude;
            dto.IsoSpeedRating = item.IsoSpeedRating;

            var album = item.Album;

            if (album != null)
            {
                dto.Album = album.Name;
                dto.AlbumId = album.Id.ToString("N");
            }
        }
        private async Task Sync(SyncJobItem jobItem, Photo item, DeviceProfile profile, CancellationToken cancellationToken)
        {
            jobItem.OutputPath = item.Path;

            jobItem.Progress = 50;
            jobItem.Status = SyncJobItemStatus.Transferring;
            await _syncRepo.Update(jobItem).ConfigureAwait(false);
        }
 private bool IsSupported(DeviceProfile profile, TranscodingProfile transcodingProfile, Photo item)
 {
     // Placeholder for future conditions
     return true;
 }
Beispiel #8
0
        private async Task Sync(SyncJobItem jobItem, Photo item, CancellationToken cancellationToken)
        {
            jobItem.OutputPath = item.Path;

            jobItem.Progress = 50;
            jobItem.Status = SyncJobItemStatus.ReadyToTransfer;
            await _syncManager.UpdateSyncJobItemInternal(jobItem).ConfigureAwait(false);
        }
Beispiel #9
0
 private async Task<string> Sync(SyncJobItem jobItem, Photo item, DeviceProfile profile, CancellationToken cancellationToken)
 {
     return item.Path;
 }