From f2a7965101311bb876a0ff1f8a81790b202341ce Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Tue, 11 Dec 2018 14:55:33 +0100 Subject: [PATCH 1/5] Replace TagLib.Portable.dll with taglib-sharp submodule --- .gitmodules | 3 + Emby.Photos/Emby.Photos.csproj | 4 +- Emby.Photos/PhotoProvider.cs | 167 ++++++++++++++++----------------- 3 files changed, 86 insertions(+), 88 deletions(-) create mode 100644 .gitmodules diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..2ef569c7c --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "ThirdParty/taglib-sharp"] + path = ThirdParty/taglib-sharp + url = git@github.com:mono/taglib-sharp.git diff --git a/Emby.Photos/Emby.Photos.csproj b/Emby.Photos/Emby.Photos.csproj index f16ce6b9c..f8c2156a6 100644 --- a/Emby.Photos/Emby.Photos.csproj +++ b/Emby.Photos/Emby.Photos.csproj @@ -3,9 +3,7 @@ - - ..\ThirdParty\taglib\TagLib.Portable.dll - + diff --git a/Emby.Photos/PhotoProvider.cs b/Emby.Photos/PhotoProvider.cs index f1a05607f..3e998997a 100644 --- a/Emby.Photos/PhotoProvider.cs +++ b/Emby.Photos/PhotoProvider.cs @@ -57,118 +57,115 @@ namespace Emby.Photos { try { - using (var fileStream = _fileSystem.OpenRead(item.Path)) + using (var file = TagLib.File.Create(item.Path)) { - using (var file = TagLib.File.Create(new StreamFileAbstraction(Path.GetFileName(item.Path), fileStream, null))) + var image = file as TagLib.Image.File; + + var tag = file.GetTag(TagTypes.TiffIFD) as IFDTag; + + if (tag != null) { - var image = file as TagLib.Image.File; + var structure = tag.Structure; - var tag = file.GetTag(TagTypes.TiffIFD) as IFDTag; - - if (tag != null) + if (structure != null) { - var structure = tag.Structure; + var exif = structure.GetEntry(0, (ushort)IFDEntryTag.ExifIFD) as SubIFDEntry; - if (structure != null) + if (exif != null) { - var exif = structure.GetEntry(0, (ushort)IFDEntryTag.ExifIFD) as SubIFDEntry; + var exifStructure = exif.Structure; - if (exif != null) + if (exifStructure != null) { - var exifStructure = exif.Structure; + var entry = exifStructure.GetEntry(0, (ushort)ExifEntryTag.ApertureValue) as RationalIFDEntry; - if (exifStructure != null) + if (entry != null) { - var entry = exifStructure.GetEntry(0, (ushort)ExifEntryTag.ApertureValue) as RationalIFDEntry; + double val = entry.Value.Numerator; + val /= entry.Value.Denominator; + item.Aperture = val; + } - if (entry != null) - { - double val = entry.Value.Numerator; - val /= entry.Value.Denominator; - item.Aperture = val; - } + entry = exifStructure.GetEntry(0, (ushort)ExifEntryTag.ShutterSpeedValue) as RationalIFDEntry; - entry = exifStructure.GetEntry(0, (ushort)ExifEntryTag.ShutterSpeedValue) as RationalIFDEntry; - - if (entry != null) - { - double val = entry.Value.Numerator; - val /= entry.Value.Denominator; - item.ShutterSpeed = val; - } + if (entry != null) + { + double val = entry.Value.Numerator; + val /= entry.Value.Denominator; + item.ShutterSpeed = val; } } } } + } - if (image != null) + if (image != null) + { + item.CameraMake = image.ImageTag.Make; + item.CameraModel = image.ImageTag.Model; + + item.Width = image.Properties.PhotoWidth; + item.Height = image.Properties.PhotoHeight; + + var rating = image.ImageTag.Rating; + if (rating.HasValue) { - item.CameraMake = image.ImageTag.Make; - item.CameraModel = image.ImageTag.Model; + item.CommunityRating = rating; + } + else + { + item.CommunityRating = null; + } - item.Width = image.Properties.PhotoWidth; - item.Height = image.Properties.PhotoHeight; + item.Overview = image.ImageTag.Comment; - var rating = image.ImageTag.Rating; - if (rating.HasValue) + if (!string.IsNullOrWhiteSpace(image.ImageTag.Title)) + { + if (!item.LockedFields.Contains(MetadataFields.Name)) { - item.CommunityRating = rating; + item.Name = image.ImageTag.Title; } - else + } + + var dateTaken = image.ImageTag.DateTime; + if (dateTaken.HasValue) + { + item.DateCreated = dateTaken.Value; + item.PremiereDate = dateTaken.Value; + item.ProductionYear = dateTaken.Value.Year; + } + + item.Genres = image.ImageTag.Genres; + item.Tags = image.ImageTag.Keywords; + item.Software = image.ImageTag.Software; + + if (image.ImageTag.Orientation == TagLib.Image.ImageOrientation.None) + { + item.Orientation = null; + } + else + { + MediaBrowser.Model.Drawing.ImageOrientation orientation; + if (Enum.TryParse(image.ImageTag.Orientation.ToString(), true, out orientation)) { - item.CommunityRating = null; + item.Orientation = orientation; } + } - item.Overview = image.ImageTag.Comment; + item.ExposureTime = image.ImageTag.ExposureTime; + item.FocalLength = image.ImageTag.FocalLength; - if (!string.IsNullOrWhiteSpace(image.ImageTag.Title)) - { - if (!item.LockedFields.Contains(MetadataFields.Name)) - { - item.Name = image.ImageTag.Title; - } - } + item.Latitude = image.ImageTag.Latitude; + item.Longitude = image.ImageTag.Longitude; + item.Altitude = image.ImageTag.Altitude; - var dateTaken = image.ImageTag.DateTime; - if (dateTaken.HasValue) - { - item.DateCreated = dateTaken.Value; - item.PremiereDate = dateTaken.Value; - item.ProductionYear = dateTaken.Value.Year; - } - - item.Genres = image.ImageTag.Genres; - item.Tags = image.ImageTag.Keywords; - item.Software = image.ImageTag.Software; - - if (image.ImageTag.Orientation == TagLib.Image.ImageOrientation.None) - { - item.Orientation = null; - } - else - { - MediaBrowser.Model.Drawing.ImageOrientation orientation; - if (Enum.TryParse(image.ImageTag.Orientation.ToString(), true, out orientation)) - { - item.Orientation = orientation; - } - } - - item.ExposureTime = image.ImageTag.ExposureTime; - item.FocalLength = image.ImageTag.FocalLength; - - item.Latitude = image.ImageTag.Latitude; - item.Longitude = image.ImageTag.Longitude; - item.Altitude = image.ImageTag.Altitude; - - if (image.ImageTag.ISOSpeedRatings.HasValue) - { - item.IsoSpeedRating = Convert.ToInt32(image.ImageTag.ISOSpeedRatings.Value); - } - else - { - item.IsoSpeedRating = null; - } + if (image.ImageTag.ISOSpeedRatings.HasValue) + { + item.IsoSpeedRating = Convert.ToInt32(image.ImageTag.ISOSpeedRatings.Value); + } + else + { + item.IsoSpeedRating = null; } } } From 42a0e51de1a3fca6ca2732605dc4d8b85a6fce8a Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Tue, 11 Dec 2018 12:20:30 -0500 Subject: [PATCH 2/5] Add Debian repo instructions and link to AUR --- README.md | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 59b99e4bc..2f8afa712 100644 --- a/README.md +++ b/README.md @@ -13,10 +13,42 @@ While our first priority is a stable build, we will eventually add features that [Feature Requests](http://feathub.com/jellyfin/jellyfin) -## Building Jellyfin packages +## Prebuilt Jellyfin packages + +Prebuild packages are available for Debian/Ubuntu and Arch. + +### Arch + +The Jellyfin package is in the AUR at https://aur.archlinux.org/packages/jellyfin-git/ + +### Debian/Ubuntu + +A package repository is available at https://repo.jellyfin.org. To use it: + +0. Install the `dotnet-runtime-2.1` package via [Microsoft's repositories](https://dotnet.microsoft.com/download/linux-package-manager/debian9/sdk-2.1.500). +0. Import the GPG signing key (signed by Joshua): + ``` + wget -O - https://repo.jellyfin.org/debian/jellyfin-signing-key-joshua.gpg.key | sudo apt-key add - + ``` +0. Add an entry to `/etc/sources.list.d/jellyfin.list`: + ``` + echo "deb https://repo.jellyfin.org/debian $( grep -Ewo -m1 --color=none 'jessie|stretch|buster' /etc/os-release || echo buster ) main" | sudo tee /etc/apt/sources.list.d/jellyfin.list + ``` +0. Update APT repositories: + ``` + sudo apt update + ``` +0. Install Jellyfin: + ``` + sudo apt install jellyfin + ``` + +## Building Jellyfin packages from source Jellyfin seeks to integrate build facilities for any desired packaging format. Instructions for the various formats can be found below. +NOTE: When building from source, it is strongly advised to clone the full Git repository, rather than using a `.zip`/`.tar` archive. + ### Debian/Ubuntu Debian build facilities are integrated into the repo at `debian/`. From 153f9f710812916e62dd59c3423716e865d951c1 Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Tue, 11 Dec 2018 12:48:20 -0500 Subject: [PATCH 3/5] Add docker hub link too --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2f8afa712..1e03c6680 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,11 @@ While our first priority is a stable build, we will eventually add features that ## Prebuilt Jellyfin packages -Prebuild packages are available for Debian/Ubuntu and Arch. +Prebuild packages are available for Debian/Ubuntu and Arch, and via Docker Hub. + +### Docker + +The Jellyfin Docker image is available on Docker Hub at https://hub.docker.com/r/jellyfin/jellyfin/ ### Arch From 5b570aec6bf0c113b3c39a8755b9fa095fb6c456 Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Tue, 11 Dec 2018 12:49:49 -0500 Subject: [PATCH 4/5] Replace dotnet links with generic download page --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1e03c6680..649ef73d7 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ The Jellyfin package is in the AUR at https://aur.archlinux.org/packages/jellyfi A package repository is available at https://repo.jellyfin.org. To use it: -0. Install the `dotnet-runtime-2.1` package via [Microsoft's repositories](https://dotnet.microsoft.com/download/linux-package-manager/debian9/sdk-2.1.500). +0. Install the `dotnet-runtime-2.1` package via [Microsoft's repositories](https://dotnet.microsoft.com/download/dotnet-core/2.1). 0. Import the GPG signing key (signed by Joshua): ``` wget -O - https://repo.jellyfin.org/debian/jellyfin-signing-key-joshua.gpg.key | sudo apt-key add - @@ -57,7 +57,7 @@ NOTE: When building from source, it is strongly advised to clone the full Git re Debian build facilities are integrated into the repo at `debian/`. -1. Install the `dotnet-sdk-2.1` package via [Microsoft's repositories](https://dotnet.microsoft.com/download/linux-package-manager/debian9/sdk-2.1.500). +1. Install the `dotnet-sdk-2.1` package via [Microsoft's repositories](https://dotnet.microsoft.com/download/dotnet-core/2.1). 2. Run `dpkg-buildpackage -us -uc -jX`, where X is your core count. 3. Install the resulting `jellyfin*.deb` file on your system. From 607e23110f540c896656304cd03ac885f62f7484 Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Tue, 11 Dec 2018 15:12:57 -0500 Subject: [PATCH 5/5] Fix a few typos and bugs --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 649ef73d7..e635506a2 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ A package repository is available at https://repo.jellyfin.org. To use it: ``` wget -O - https://repo.jellyfin.org/debian/jellyfin-signing-key-joshua.gpg.key | sudo apt-key add - ``` -0. Add an entry to `/etc/sources.list.d/jellyfin.list`: +0. Add an entry to `/etc/apt/sources.list.d/jellyfin.list` (note that Ubuntu will get `buster` but this should work fine): ``` echo "deb https://repo.jellyfin.org/debian $( grep -Ewo -m1 --color=none 'jessie|stretch|buster' /etc/os-release || echo buster ) main" | sudo tee /etc/apt/sources.list.d/jellyfin.list ``` @@ -51,14 +51,14 @@ A package repository is available at https://repo.jellyfin.org. To use it: Jellyfin seeks to integrate build facilities for any desired packaging format. Instructions for the various formats can be found below. -NOTE: When building from source, it is strongly advised to clone the full Git repository, rather than using a `.zip`/`.tar` archive. +NOTE: When building from source, only cloning the full Git repository is supported, rather than using a `.zip`/`.tar` archive, in order to support submodules. ### Debian/Ubuntu Debian build facilities are integrated into the repo at `debian/`. 1. Install the `dotnet-sdk-2.1` package via [Microsoft's repositories](https://dotnet.microsoft.com/download/dotnet-core/2.1). -2. Run `dpkg-buildpackage -us -uc -jX`, where X is your core count. -3. Install the resulting `jellyfin*.deb` file on your system. +2. Run `dpkg-buildpackage -us -uc`. +3. Install the resulting `jellyfin_*.deb` file on your system. -A huge thanks to Carlos Hernandez who created the Debian build configuration for Emby 3.1.1. +A huge thanks to Carlos Hernandez who created the original Debian build configuration for Emby 3.1.1.