Compare commits

..

233 Commits

Author SHA1 Message Date
Joshua M. Boniface
55a8d2555e Bump version to 10.7.5 2021-05-04 22:08:44 -04:00
Joshua M. Boniface
b7c3510da1 Revert "Merge pull request #5943 from Maxr1998/device-profile-defaults"
This PR broke direct play in JMP and caused aspect ratio issues in web.

This reverts commit 4c8df4c5bb.
2021-05-04 22:07:32 -04:00
Joshua M. Boniface
fd102abd81 Merge pull request #5973 from crobibero/legacy-ci-apiclient
Kill the CI

(cherry picked from commit d655145867)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-05-04 21:33:52 -04:00
Joshua M. Boniface
f8f7767cc5 Merge pull request #5968 from crobibero/legacy-ci-apiclient
(cherry picked from commit a598a8071b)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-05-04 21:21:44 -04:00
Joshua M. Boniface
e8436814dc Bump version to 10.7.4 2021-05-04 21:21:44 -04:00
Joshua M. Boniface
14f63e8f2f Merge pull request #5970 from crobibero/fix-linux-test
Fix Linux Tests
2021-05-04 21:21:29 -04:00
crobibero
e764de0c80 Fix linux test for backport 2021-05-04 19:19:35 -06:00
Joshua M. Boniface
40147c9bb7 Merge pull request #5969 from crobibero/required-revert
Remove Required attributes

(cherry picked from commit fe0fce26e4)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-05-04 21:14:59 -04:00
Joshua M. Boniface
3566d21ad1 Bump version to 10.7.3 2021-05-04 20:01:50 -04:00
Bond-009
4c8df4c5bb Merge pull request #5943 from Maxr1998/device-profile-defaults
(cherry picked from commit 9d3f614527)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-05-04 19:33:08 -04:00
Bond-009
9798bf29f3 Merge pull request #5937 from Maxr1998/videoscontroller-api-fix
Remove extraneous 'stream' parameter

(cherry picked from commit 266913c5d8)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-05-02 17:02:10 -04:00
Joshua M. Boniface
93ce087fc9 Merge pull request from GHSA-rgjw-4fwc-9v96
Remove /Images/Remote API endpoint

(cherry picked from commit e71cd8274a)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-05-02 17:01:33 -04:00
Bond-009
e39495354b Merge pull request #5904 from cvium/fix-updatepeople-questionmark
add UpdatePeopleAsync and add people to both tables

(cherry picked from commit 5df87b3e0d)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-29 14:56:58 -04:00
Bond-009
ee94fad8f7 Merge pull request #5903 from iwalton3/auto-leave-syncplay
Leave SyncPlay group on session disconnect.

(cherry picked from commit dcc2df75ec)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-29 14:56:58 -04:00
Claus Vium
53239b0529 Merge pull request #5861 from BaronGreenback/ProfileMatch
Change profile matching to match what the web interface says.

(cherry picked from commit 12496677bd)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-29 14:56:57 -04:00
Bond-009
cf0da1de86 Merge pull request #5826 from BaronGreenback/ssdpFix
PlayTo Fix: Use external ip not internal interface

(cherry picked from commit f4a59c92e6)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-29 14:56:30 -04:00
Bond-009
093510ae58 Merge pull request #5881 from cvium/tmdb-episode-externalids
Add tvrage and imdb ids for episodes

(cherry picked from commit e19d89bb4f)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-21 21:25:41 -04:00
Bond-009
c3fafe9289 Merge pull request #5878 from Artiume/patch-2
(cherry picked from commit 95ab603a40)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-21 21:25:41 -04:00
Bond-009
bd914acd16 Merge pull request #5873 from cvium/fix-displaypref-migration
(cherry picked from commit 233900401e)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-21 21:25:41 -04:00
Bond-009
81f9bec101 Merge pull request #5870 from cvium/fix-tmdbpersonprovider
(cherry picked from commit 6b103f7ab2)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-21 21:25:40 -04:00
Bond-009
7db8601fbc Merge pull request #5863 from cvium/fix-index-migration
use IF NOT EXISTS in migration

(cherry picked from commit 5a4cfe11cf)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-21 21:25:40 -04:00
Bond-009
1ec247f5d8 Merge pull request #5860 from cvium/fix-notification-user-list
Fix notification disabled users list

(cherry picked from commit ebe8301404)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-21 21:25:39 -04:00
Bond-009
11e9173fbc Merge pull request #5859 from cvium/fix-streambuilder-permissions
Respect user settings for transcode and remux

(cherry picked from commit 5a6e60b414)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-21 21:24:27 -04:00
Bond-009
34508286a8 Merge pull request #5852 from cvium/fix-person-creation
Add Person to TypedBaseItems if it's new

(cherry picked from commit 4eeb69233d)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-21 21:24:27 -04:00
Claus Vium
a82eded845 Merge pull request #5848 from sgmoore/IndexError
Fix ArgumentOutOfRangeException scanning AudioBooks

(cherry picked from commit 665220c4fb)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-21 21:24:27 -04:00
Bond-009
fcb729ff6b Merge pull request #5808 from cvium/semi-fix-collection-perf
(cherry picked from commit 48ed4b016c)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-21 21:24:27 -04:00
Joshua M. Boniface
69f30bc52c Merge pull request #5782 from cvium/fix-release-10.7.2
Fix 10.7.2 nullable
2021-04-11 16:31:26 -04:00
cvium
3b605b6280 fix 10.7.2 nullable 2021-04-11 22:19:59 +02:00
Joshua M. Boniface
e8a359f97b Bump version 10.7.2 2021-04-11 14:19:21 -04:00
Bond-009
dbfaafc08a Merge pull request #5596 from BaronGreenback/DLNA_Hardening
Implemented DLNA exception handling

(cherry picked from commit 55102973d6)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-11 14:17:47 -04:00
Bond-009
de6747f6c5 Merge pull request #5385 from Bond-009/dlna2
Use XDocument.LoadAsync instead of XDocument.Parse

(cherry picked from commit a1cdc2c63f)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-11 14:17:46 -04:00
Bond-009
100fe40b0a Merge pull request #5769 from cvium/workstation-gc
Enable Workstation GC mode

(cherry picked from commit f0625bb023)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-11 14:13:44 -04:00
Joshua M. Boniface
2197d20783 Merge pull request #5764 from cvium/fix-folders-perms
Do not check permissions for Folders collectiontype

(cherry picked from commit 770c123d12)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-11 14:13:44 -04:00
Claus Vium
f4f9ab777f Merge pull request #5750 from iwalton3/fix-audio-selection-uns
Fix setting audio stream in PlaybackInfo for jellyfin-web.

(cherry picked from commit bf510ca04e)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-11 14:13:44 -04:00
Joshua M. Boniface
9ca7d62709 Merge pull request #5748 from cvium/playlist-audio-type
Set mediatype to Audio for playlists in a music library

(cherry picked from commit cd0daa7985)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-11 14:13:44 -04:00
Bond-009
7aad16b6ec Merge pull request #5747 from cvium/more-convertimage-fixes
Catch IOException and include stack trace when saving images

(cherry picked from commit 240e67d485)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-11 14:13:44 -04:00
Bond-009
f77673438e Merge pull request #5746 from cvium/dangling-symlinks
(cherry picked from commit 62117a6c12)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-11 14:13:44 -04:00
Bond-009
bc2eb9fa79 Merge pull request #5736 from jellyfin/catch-httprequestex-librarymanager
fetching images should not kill the scanner

(cherry picked from commit 6577f1deb2)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-11 14:13:44 -04:00
Claus Vium
df69ce55f7 Merge pull request #5734 from jellyfin/fix-isplayed-itemvalues
move IsPlayed to outerquery

(cherry picked from commit d532e95410)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-11 14:13:44 -04:00
Claus Vium
93cca4d50e Merge pull request #5725 from BrianCArnold/Fix2845_PlaylistDeletion
(cherry picked from commit 9d0467addf)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-11 14:13:44 -04:00
Bond-009
3c64bcffe3 Merge pull request #5717 from cvium/nullable-custompref-value
(cherry picked from commit 47bbe4c146)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-11 14:13:44 -04:00
Claus Vium
6ece01d425 Merge pull request #5712 from BaronGreenback/5700
(cherry picked from commit 1a92d94e92)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-11 14:13:44 -04:00
Bond-009
53f333bd64 Merge pull request #5702 from cvium/ws-auth
add simple auth handling to websocketmanager

(cherry picked from commit 3412120c61)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-11 14:13:44 -04:00
Bond-009
9e459090ed Merge pull request #5693 from Maxr1998/probe-result-tweaks
(cherry picked from commit 7978f30ff7)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-11 14:13:44 -04:00
Claus Vium
95a4fc0f18 Merge pull request #5688 from crobibero/api-docs-sever-discovery
Add SessionDiscoveryInfo to generated api-docs

(cherry picked from commit f718735b4e)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-11 14:13:44 -04:00
Bond-009
62bf3db885 Merge pull request #5672 from jellyfin/skip-bad-images
ensure only valid images are saved in ItemImageProvider

(cherry picked from commit 38913a42b4)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-11 14:13:44 -04:00
Bond-009
42d702c091 Merge pull request #5671 from jellyfin/tmdbmovieprovider-originaltitle
set original title in tmdbmovieprovider

(cherry picked from commit 7c51d0a50e)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-11 14:13:44 -04:00
Bond-009
d07fe14814 Merge pull request #5661 from ferferga/openapi-product-version
Return Major.Minor.Build instead of Major.Minor.Build.Revision for OpenAPI

(cherry picked from commit cb111eb767)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-11 14:13:44 -04:00
Bond-009
970eaf8dfb Merge pull request #5634 from cvium/directoryservice-case-sensitive
make directoryservice cache case sensitive

(cherry picked from commit 1de031a7c3)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-11 14:13:44 -04:00
Claus Vium
bc27c2b7da Merge pull request #5631 from BrianCArnold/FixMessageCommand
(cherry picked from commit a1718e392b)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-11 14:13:44 -04:00
Claus Vium
37b969304a Merge pull request #5629 from lmaonator/fix-cast-stream-selection
(cherry picked from commit 90d9530aed)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-11 14:13:44 -04:00
Claus Vium
c6b5c4dda5 Merge pull request #5624 from crobibero/subtitle-format
(cherry picked from commit 9144d11a9d)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-11 14:13:44 -04:00
Claus Vium
51f5da8015 Merge pull request #5621 from cvium/enable-range-processing-download
enable range processing for download endpoints

(cherry picked from commit 411570e6d4)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-11 14:13:44 -04:00
Claus Vium
6e89ca9a34 Merge pull request #5620 from MrTimscampi/iso-ignore
(cherry picked from commit a76d997a86)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-11 14:13:44 -04:00
Claus Vium
de1896828f Merge pull request #5613 from accek/accek-samsung-dlna-fix
(cherry picked from commit e64f9f2f66)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-11 14:13:44 -04:00
Bond-009
7d1d159b8a Merge pull request #5556 from oddstr13/image-fill-resize
(cherry picked from commit 790f7430aa)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-11 14:13:44 -04:00
Bond-009
c3c98331d9 Merge pull request #5495 from BaronGreenback/RemoteAccessFix
(cherry picked from commit a890a85092)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-11 14:13:44 -04:00
Joshua M. Boniface
e78fa8c3ef Merge pull request #5416 from BaronGreenback/SubnetOverlappFix
(cherry picked from commit 19e7ebb279)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-11 14:13:44 -04:00
Bond-009
d63fb437c6 Merge pull request #5258 from Smith00101010/next-up-specials-fix
(cherry picked from commit 9d548c62ba)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-04-11 14:13:44 -04:00
Claus Vium
25c6388e23 Merge pull request #5600 from cvium/fix-hls-defaults-10.7
Fix hls defaults for 10.7
2021-03-28 00:15:57 +01:00
Claus Vium
8f16e10fc6 Apply suggestions from code review 2021-03-25 08:44:34 +01:00
cvium
1f07586d1c forgot streaminfo 2021-03-22 23:11:25 +01:00
cvium
5e0f480e48 fix build and isdirectstream 2021-03-22 23:08:09 +01:00
cvium
210d10400a change HLS endpoint defaults to false 2021-03-22 23:05:05 +01:00
Joshua M. Boniface
3dda25412c Bump version to 10.7.1 2021-03-21 19:18:08 -04:00
Joshua M. Boniface
0183ef8e89 Merge pull request from GHSA-wg4c-c9g9-rxhx
Fix issues 1 through 5 from GHSL-2021-050

(cherry picked from commit fe8cf29cad)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-03-21 19:13:08 -04:00
Claus Vium
75f39f0f2a Merge pull request #5559 from cvium/fix-tmdb-search-clean
Clean the entity name for non-words before searching

(cherry picked from commit 9360fecb31)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-03-21 19:10:13 -04:00
Bond-009
966217e6a9 Merge pull request #5550 from cvium/revert_underscore_multiversion
(cherry picked from commit f42cee4790)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-03-21 19:10:13 -04:00
Joshua M. Boniface
328bcadabf Merge pull request #5532 from cvium/fix_episode_extras_questionmark
(cherry picked from commit 890a490776)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-03-21 19:10:13 -04:00
Bond-009
0f38b2ffb2 Merge pull request #5518 from crobibero/missing-endpoints
Add missing InstantMix endpoints

(cherry picked from commit 8bb2420a25)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-03-21 19:10:13 -04:00
Bond-009
40f4780825 Merge pull request #5515 from jellyfin/fix-refresh-endpoint
fix refresh endpoint

(cherry picked from commit 260b48ef9d)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-03-21 19:10:13 -04:00
Claus Vium
546ffbe4f7 Merge pull request #5512 from crobibero/api-spec-version
(cherry picked from commit 94820f569b)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-03-21 19:10:13 -04:00
Claus Vium
d00218c370 Merge pull request #5510 from BaronGreenback/DlnaFirstFix
Fix: Streaming crashing due to no deviceProfileId match.
(cherry picked from commit 109f24514f)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-03-21 19:10:13 -04:00
Bond-009
679d3f5873 Merge pull request #5504 from crobibero/json-string-converter
(cherry picked from commit 1a0ce16f4d)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-03-21 19:10:13 -04:00
Bond-009
787ad44323 Merge pull request #5500 from crobibero/api-integration-fix
Fix third party integration

(cherry picked from commit 7a988ef77d)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-03-21 19:10:13 -04:00
Bond-009
2ce6b347f5 Merge pull request #5480 from crobibero/api-session-message-type
Add SessionMessageType to generated openapi spec

(cherry picked from commit e3adc9ab74)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-03-21 19:10:13 -04:00
Bill Thornton
318c1f7f0c Merge pull request #5476 from jellyfin/EraYaN-nuget-ci
Remove BuildPackage dependency for PublishNuget in CI

(cherry picked from commit 9fe3ca7a92)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-03-21 19:10:13 -04:00
Claus Vium
ed15cb1571 Merge pull request #5475 from BaronGreenback/SSDPFix
(cherry picked from commit baa43c6b41)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-03-21 19:10:13 -04:00
Bond-009
c171bac71a Merge pull request #5461 from cvium/fix_multiversion
(cherry picked from commit d967267cef)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-03-21 19:09:59 -04:00
Bond-009
be5f511fc7 Merge pull request #5457 from cvium/fix_double_artist
(cherry picked from commit a037e30b41)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-03-21 19:08:27 -04:00
Claus Vium
a65c97c8f7 Merge pull request #5447 from joshuaboniface/fix-fedora-build
Remove Microsoft repo from install step

(cherry picked from commit 88a8fa7100)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-03-21 19:08:27 -04:00
Claus Vium
3fbe10364b Merge pull request #5444 from Ullmie02/hdhr-fix
(cherry picked from commit 329edd9dbe)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-03-21 19:08:27 -04:00
Claus Vium
88ab008112 Merge pull request #5431 from cvium/fix_tmdb_imdbid
Use imdbid as fallback in movie provider

(cherry picked from commit 84e16a8535)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-03-21 19:08:27 -04:00
Bond-009
1518f6d325 Merge pull request #5428 from cvium/fix_tmdb_year
Default to the searchinfo year, fallback to parsed year

(cherry picked from commit 97fd136a8c)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-03-21 19:08:26 -04:00
Claus Vium
53576fe1b8 Merge pull request #5403 from BaronGreenback/DLNAProfileFix
(cherry picked from commit 5592967497)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-03-21 19:08:26 -04:00
Claus Vium
da3b7bb684 Merge pull request #5324 from danieladov/master
Fix duplicated movies when group movies into collections is enabled

(cherry picked from commit bd70f56218)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-03-21 19:08:26 -04:00
Joshua M. Boniface
4a320b26b5 Bump version to 10.7.0
Also clear out old changelogs since these don't actually make sense
anyways.
2021-03-08 18:11:29 -05:00
Joshua M. Boniface
63868eca40 Merge pull request #5409 from ikomhoog/master
(cherry picked from commit 82d88bdec6)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-03-08 18:08:26 -05:00
Claus Vium
f6e8493d69 Merge pull request #5407 from Bond-009/hack
(cherry picked from commit 90cdd1345d)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-03-08 18:08:26 -05:00
Joshua M. Boniface
3c3b536e81 Merge pull request #5406 from cvium/trycleanstring-dont-die-on-me
(cherry picked from commit 0ef8bea125)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-03-08 18:08:26 -05:00
Joshua M. Boniface
a10eea41ac Merge pull request #5402 from Ullmie02/fix-null-size
Use FileShare.None when creating files

(cherry picked from commit 480dd66428)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-03-08 18:08:25 -05:00
Bond-009
42d0c1ac5f Merge pull request #5381 from cvium/fix-network-substitution
(cherry picked from commit 497ea57fd2)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-03-08 18:08:25 -05:00
Joshua M. Boniface
b01290013e Merge pull request #5315 from BaronGreenback/FixFor5280Part2
(cherry picked from commit 3c46f10e3d)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-03-08 18:08:20 -05:00
Bond-009
132335a747 Merge pull request #5383 from cvium/fix-mergeversions-overflow
do not pick a linked item as primary when merging versions

(cherry picked from commit 3741be51ec)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-03-06 14:30:11 -05:00
Claus Vium
75d3d120d3 Fix UpdateMediaPath model binding (#5378)
(cherry picked from commit d0a2d00b29)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-03-06 14:28:08 -05:00
Bond-009
e8890cc682 Merge pull request #5377 from cvium/fix-tmdb-image-languages
Do not use language or imagelanguages when searching for images with TMDb

(cherry picked from commit 1d87274cc2)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-03-06 14:27:58 -05:00
Bond-009
e4bf57c739 Merge pull request #5375 from crobibero/default-api-value
Specify defaults or set query parameter to nullable

(cherry picked from commit a0f6bc14a2)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-03-06 14:27:58 -05:00
Claus Vium
046dd7fa60 Merge pull request #5356 from cvium/fix_provideridextensions
return false when providerid is null or empty

(cherry picked from commit ddc62a89ba)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-03-06 14:27:58 -05:00
David Ullmer
5e18ab3604 Fix TMDb search name containing year (#5349)
(cherry picked from commit 8f99bdd07c)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-03-06 14:26:54 -05:00
dkanada
7545b1286b Merge pull request #5345 from BaronGreenback/IP6Fix
Dual IP4 / IP6 server fails on non-windows platforms

(cherry picked from commit 8615847a8a)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-03-06 14:26:41 -05:00
Bond-009
b99db64f8f Merge pull request #5342 from BaronGreenback/errorMessageCorrection
Corrected logging message

(cherry picked from commit 1f0bbe266c)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-03-06 14:26:41 -05:00
Claus Vium
20810eedbe Merge pull request #5339 from Bond-009/hasproviderids
Revert breaking change to HasProviderId

(cherry picked from commit e858e5f0b8)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-03-06 14:26:41 -05:00
BaronGreenback
2d88b8346d Remove Content-Length header from DLNA HEAD request (#5335)
(cherry picked from commit d819a1d928)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-03-06 14:26:38 -05:00
Bond-009
eafaccae5d Merge pull request #5004 from jellyfin/camera-upload
remove unused notification type

(cherry picked from commit bffebce909)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-03-06 14:24:50 -05:00
Joshua M. Boniface
d2851979d4 Fix bad spacer in changelog line 2021-02-28 22:30:24 -05:00
Claus Vium
4b6ff7ffa5 Merge pull request #5312 from BaronGreenback/FixFor5280
(cherry picked from commit 9e77fdc70d)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-02-27 22:30:50 -05:00
Claus Vium
153123278b Merge pull request #5278 from BaronGreenback/STRMFix
Fix for #5168

(cherry picked from commit 64730b5661)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-02-27 22:30:49 -05:00
Claus Vium
25c19f79d4 Merge pull request #5274 from BaronGreenback/bindfix
(cherry picked from commit 14605280a0)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-02-27 22:30:49 -05:00
Claus Vium
0f139e8857 Merge pull request #5181 from BaronGreenback/Fix_IPHostIP6Parsing
(cherry picked from commit f8c9c37c29)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-02-27 22:30:49 -05:00
Claus Vium
e6cc8d5015 Merge pull request #5073 from BaronGreenback/ffmpeg
Fix for 4933: Alternative ffmpeg fix

(cherry picked from commit e5f99762e2)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-02-27 22:30:49 -05:00
Bond-009
ef864e24b9 Merge pull request #5301 from Bond-009/validinput
(cherry picked from commit 5860979500)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-02-26 21:01:50 -05:00
Joshua M. Boniface
ab054d6239 Merge pull request #5290 from Bond-009/nullref
Fix possible null ref exception

(cherry picked from commit 1442a63556)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-02-26 21:01:50 -05:00
Bond-009
19ff447e51 Merge pull request #5275 from BaronGreenback/upnpStartupFix
Fixes #5148

(cherry picked from commit 0beda0e32c)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-02-26 21:01:50 -05:00
Joshua M. Boniface
4220808b96 Merge pull request #5270 from Bond-009/imdb
(cherry picked from commit 5ce4df4178)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-02-26 21:01:50 -05:00
dkanada
eb0621a354 Merge pull request #5217 from jellyfin/auto-manifest
handle plugin manifests automatically

(cherry picked from commit c54ca489f1)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-02-26 21:01:50 -05:00
Joshua M. Boniface
621c0b9d15 Bump version to 10.7.0~rc4 2021-02-21 13:42:26 -05:00
Andrew Rabert
fecab1d549 Merge pull request #5263 from Bond-009/tmdb
TMDB: Include year in search
(cherry picked from commit 5379fa0bd0)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-02-21 13:30:32 -05:00
Bond-009
bd89cdf8d2 Merge pull request #5255 from cvium/fix_renameuser
(cherry picked from commit ae30eaf320)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-02-21 13:30:32 -05:00
Bond-009
557a091865 Merge pull request #5251 from crobibero/vpp-null-ref
Fix vpp null reference

(cherry picked from commit 467cd9227e)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-02-21 13:30:32 -05:00
dkanada
a1773ce97b Merge pull request #5250 from barronpm/user-rename-fix
Fix user renaming logic

(cherry picked from commit b4c2086138)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-02-21 13:30:32 -05:00
Bond-009
be7411dc58 Merge pull request #5230 from orryverducci/double-rate-deint-fix
Fix double rate deinterlacing for some TS files

(cherry picked from commit 32934cb33d)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-02-21 13:30:31 -05:00
dkanada
b2a8fd82d8 Merge pull request #5216 from jellyfin/remove-old-settings
remove deprecated settings from server config

(cherry picked from commit 542401c7f4)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-02-21 13:30:31 -05:00
Bond-009
d53120602c Merge pull request #5208 from crobibero/api-post-image
Add image file accept to openapi

(cherry picked from commit 76d66e0dee)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-02-21 13:30:31 -05:00
dkanada
da09257d58 Merge pull request #5207 from matthin/default-language
Default to English metadata during the setup wizard.

(cherry picked from commit 75ec8b0c8c)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-02-21 13:30:31 -05:00
Joshua M. Boniface
706ac0fafd Merge pull request #5200 from crobibero/dotnet-5.0.3
Update to dotnet 5.0.3

(cherry picked from commit 426b55052f)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-02-21 13:30:29 -05:00
Bond-009
ebd4328f02 Merge pull request #5188 from cvium/fix_manifest_bom
Exclude BOM when writing meta.json plugin manifest

(cherry picked from commit fba80cf6f9)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-02-21 13:29:02 -05:00
Bond-009
39b0d69786 Merge pull request #5171 from Ullmie02/reset-fix
(cherry picked from commit 34e10622c6)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-02-21 13:29:02 -05:00
Claus Vium
9f3cebf493 Merge pull request #5154 from crobibero/skip-attributes
(cherry picked from commit 5f63c33557)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-02-21 13:29:02 -05:00
Claus Vium
20e985a0d1 Merge pull request #5117 from jellyfin/fix-framerate-locale
Make FRAME-RATE field culture invariant

(cherry picked from commit 63be326302)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-02-21 13:29:02 -05:00
Claus Vium
5dbd6f076c Merge pull request #5111 from Larvitar/tmdb-season-name-fix
Remove season name from metadata result

(cherry picked from commit 3fd0987ee3)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-02-21 13:29:02 -05:00
Joshua M. Boniface
19a01ccdf3 Merge pull request #5107 from jellyfin/enhanced-nvdec-vpp-tonemap
(cherry picked from commit bd8c269ea2)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-02-21 13:29:02 -05:00
Bond-009
d816995d27 Merge pull request #5106 from BaronGreenback/FileShareTest2
(cherry picked from commit 28ffbf6945)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-02-21 13:29:02 -05:00
Claus Vium
a934477850 Merge pull request #5105 from crobibero/image-null-ref
Add null check for ImageTags

(cherry picked from commit e7e385d7a2)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-02-21 13:29:02 -05:00
Claus Vium
a7f65bd205 Merge pull request #5099 from crobibero/non-required-query-param
(cherry picked from commit e5828cdbf1)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-02-21 13:29:02 -05:00
Claus Vium
8138fc3003 Merge pull request #5095 from Bond-009/sortorder
(cherry picked from commit 98a4e1b840)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-02-21 13:29:02 -05:00
Bond-009
46a6cd8d1f Merge pull request #5091 from crobibero/query-param-array
Use ArrayModelBinder for sortBy and sortOrder

(cherry picked from commit b4d04f9ca5)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-02-21 13:29:02 -05:00
Claus Vium
524df2e45d Merge pull request #5090 from Ullmie02/plugin-startup-fix
(cherry picked from commit f82e6ee8cc)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-02-21 13:29:02 -05:00
dkanada
a486cd27a9 Merge pull request #4935 from ConfusedPolarBear/quickconnect-cleanup
Remove used quick connect tokens

(cherry picked from commit 158e69c6f0)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-02-21 13:29:02 -05:00
Bond-009
34053b7259 Merge pull request #4905 from BaronGreenback/streamingHelper
Null exception fix

(cherry picked from commit 9a10a18db1)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-02-21 13:29:02 -05:00
Joshua M. Boniface
d5a7478600 Bump version to 10.7.0-rc3 2021-01-23 15:51:49 -05:00
Joshua M. Boniface
ed333dec43 Merge pull request #5069 from crobibero/obsolete-param
(cherry picked from commit 4b6b90e0b1)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-01-23 15:39:35 -05:00
Joshua M. Boniface
c17c32f9dc Merge pull request #5064 from BaronGreenback/PluginFix
Plugin bug fixes

(cherry picked from commit 3fda50de6d)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-01-23 15:39:35 -05:00
Joshua M. Boniface
5cc8ed6516 Merge pull request #5062 from crobibero/delete_log_task
(cherry picked from commit 4d13cad7af)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-01-23 15:39:35 -05:00
Joshua M. Boniface
cdba6b3d35 Merge pull request #5031 from crobibero/5.0.2
Update to dotnet 5.0.2

(cherry picked from commit 3bf7e18886)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-01-23 15:39:32 -05:00
Claus Vium
fa7a8752a9 Merge pull request #5027 from crobibero/episode-first-up
(cherry picked from commit 65c09f82c5)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-01-23 15:37:26 -05:00
Claus Vium
d129afa74e Merge pull request #5025 from BaronGreenback/DlnaFix
(cherry picked from commit b9691e8712)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-01-23 15:37:26 -05:00
Claus Vium
bc8a1d2276 Merge pull request #4997 from crobibero/subtitle-upload-auth
Require elevated auth to upload subtitles

(cherry picked from commit 5c00b4175a)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-01-23 15:37:26 -05:00
Bond-009
147f9e1edf Merge pull request #4980 from Ullmie02/chinese
Add additional chinese languages

(cherry picked from commit 0bb0dd646f)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-01-23 15:37:26 -05:00
Claus Vium
7796486511 Merge pull request #4978 from BaronGreenback/MultipeProxies
(cherry picked from commit 14bd4a110f)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-01-23 15:37:25 -05:00
Bond-009
ab5ae34595 Merge pull request #4976 from BaronGreenback/dlnaPortFix
Fixed DLNA Server on RC2

(cherry picked from commit a554423163)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-01-23 15:37:25 -05:00
Joshua M. Boniface
81a17b803d Merge pull request #4970 from BaronGreenback/networkTestCorrection
(cherry picked from commit fe9096be94)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-01-23 15:37:25 -05:00
Bond-009
cc6afb0971 Merge pull request #4968 from ianjazz246/fix-music-album-display
Fix library with music directly under artist folder

(cherry picked from commit 7758c61ea8)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-01-23 15:37:25 -05:00
Bond-009
d9a9a23a3c Merge pull request #4962 from thornbill/fix-playstate-name
Fix capitalization of Playstate message

(cherry picked from commit 07650d91da)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-01-23 15:37:25 -05:00
Bond-009
dd1fddf79c Merge pull request #4961 from crobibero/person-blurhash-null-ref
Fix potential null reference

(cherry picked from commit a8230c07ea)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-01-23 15:37:25 -05:00
Joshua M. Boniface
4df7522629 Merge pull request #4956 from jceresini/master
Fix rpm package dependencies

(cherry picked from commit 3204ce71b3)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-01-23 15:37:25 -05:00
Bond-009
9c83a6cef9 Merge pull request #4936 from crobibero/series-start-item-id
Fix inverted SkipWhile

(cherry picked from commit 841996c642)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-01-23 15:37:25 -05:00
dkanada
910819c71c Merge pull request #4920 from crobibero/person-blurhash
Attach correct Blurhash to BaseItemPerson

(cherry picked from commit c117b12b6b)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-01-23 15:37:25 -05:00
Bond-009
a0e047d560 Change converter log level (#4916)
Change converter log level

(cherry picked from commit 9265dd68a4)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-01-23 15:37:25 -05:00
Joshua M. Boniface
34322ba491 Merge pull request #4911 from Ullmie02/nuget_again
(cherry picked from commit c5e9d56028)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-01-23 15:37:25 -05:00
Bond-009
801dd74ff6 Merge pull request #4906 from Spacetech/library_scan_ignore_inaccessible
Ignore inaccessible files & folders during library scans

(cherry picked from commit 4549c96f6d)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-01-23 15:37:25 -05:00
Joshua M. Boniface
129453214f Merge pull request #4859 from Ullmie02/ci
Don't build unstable Nuget packages on tags

(cherry picked from commit 7227d0d48b)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2021-01-23 15:37:25 -05:00
Joshua M. Boniface
ac82fead82 Bump version to 10.7.0-rc2 2020-12-31 19:23:19 -05:00
dkanada
9a59ff3c87 Merge pull request #4902 from BaronGreenback/NetmaskFix
Fixed loopback subnet

(cherry picked from commit d6db0e4b02)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-31 18:50:02 -05:00
Joshua M. Boniface
a16cf8ec0a Merge pull request #4890 from nielsvanvelzen/4888-fix-search-hints
Fix search hint endpoint error

(cherry picked from commit 7caba04c3c)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-31 18:50:02 -05:00
Joshua M. Boniface
4a2b143028 Merge pull request #4884 from crobibero/json-nullable-guid-converter
Add JsonConverter for Nullable Guids

(cherry picked from commit 0de45d8724)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-31 18:50:02 -05:00
Joshua M. Boniface
d737c2b84a Merge pull request #4729 from BaronGreenback/19.0RC---Fix-networkInterfaceFix
(cherry picked from commit ccc1b8bf92)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-31 18:50:02 -05:00
Joshua M. Boniface
1ad8e54035 Merge pull request #4709 from BaronGreenback/PluginDowngrade
(cherry picked from commit 406ae3e43a)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-31 18:49:53 -05:00
Joshua M. Boniface
83dd3e2201 Merge pull request #4891 from Artiume/patch-1
(cherry picked from commit eb084f9021)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-30 19:13:04 -05:00
Bond-009
d9634b7fc0 Merge pull request #4874 from MrTimscampi/enable-tmdb-omdb
Enable TMDB and OMDB by default

(cherry picked from commit f8681aa518)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-30 18:55:51 -05:00
Bond-009
05b34b2710 Merge pull request #4872 from BaronGreenback/NetworkManagerFix
Removed workaround code as web is now fixed.

(cherry picked from commit 4ed20c75f7)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-30 18:55:51 -05:00
Joshua M. Boniface
2dab55a8f2 Merge pull request #4863 from nyanmisaka/boxes-backdrop
Fix boxes in library name backdrop

(cherry picked from commit f2e05bd183)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-30 18:55:51 -05:00
Joshua M. Boniface
124ab090bc Merge pull request #4861 from crobibero/null-ref
Fix null reference when logging

(cherry picked from commit 93b754c366)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-30 18:55:51 -05:00
dkanada
03c8216946 Merge pull request #4860 from nyanmisaka/3ch-transcode-hls
Avoid transcoding to 3ch audio for HLS streaming

(cherry picked from commit 2913e2604c)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-30 18:55:51 -05:00
Claus Vium
f72f27ff45 Merge pull request #4856 from nyanmisaka/amf-profile
Fix some profiles for H264 AMF encoder

(cherry picked from commit afdc98746b)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-30 18:55:51 -05:00
Bond-009
71188ad27a Merge pull request #4855 from crobibero/cache-json-serializer
Initialize JsonSerializerOptions statically

(cherry picked from commit f42208673f)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-30 18:55:51 -05:00
Claus Vium
0d9e8b4f00 Merge pull request #4852 from ryanpetris/fix-schedulesdirect-refresh
SchedulesDirect no longer refreshes channels properly

(cherry picked from commit e36881f4fd)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-30 18:55:51 -05:00
Joshua M. Boniface
fbfb23abab Merge pull request #4850 from BaronGreenback/NetworkApiFix
Null reference fix

(cherry picked from commit bfdd4727b5)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-30 18:55:51 -05:00
Joshua M. Boniface
622c71ce1c Merge pull request #4847 from crobibero/display-prefs-migration-x251256
Fix another key collision in MigrateDisplayPreferencesDatabase

(cherry picked from commit ca535b2fbe)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-30 18:55:51 -05:00
Claus Vium
dbc9256945 Merge pull request #4842 from crobibero/date-time-formatter
Add JsonDateTimeConverter

(cherry picked from commit c8a89b0fe3)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-30 18:55:51 -05:00
Claus Vium
6b20aaaa6a Merge pull request #4836 from crobibero/dashboard-theme
Return dashboardTheme when requesting DisplayPreferences

(cherry picked from commit 98da2c67a5)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-30 18:55:51 -05:00
Claus Vium
c2097ba5fe Merge pull request #4833 from Ullmie02/similar-fix
Fix similar items endpoint for movies and TV

(cherry picked from commit c90c382e2f)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-30 18:55:51 -05:00
Bond-009
8884f4f288 Merge pull request #4828 from joshuaboniface/linux-alt-arch
(cherry picked from commit 2e8e96874f)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-30 18:55:51 -05:00
Claus Vium
ce741f541c Merge pull request #4824 from crobibero/livestream-post-body
Add request parameters to OpenLiveStreamDto

(cherry picked from commit 53119ed2a1)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-30 18:55:51 -05:00
Joshua M. Boniface
783d6409af Merge pull request #4821 from BaronGreenback/disableDlna
(cherry picked from commit a77788906c)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-30 18:55:51 -05:00
Joshua M. Boniface
5bf25ce2cc Merge pull request #4819 from crobibero/download-name
Set filename when downloading file

(cherry picked from commit 668e168c47)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-30 18:55:50 -05:00
Claus Vium
6c2ddd9758 Merge pull request #4816 from nyanmisaka/profiles
Fix some video profiles for Android client

(cherry picked from commit e9db47cd20)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-30 18:55:50 -05:00
Claus Vium
8760a298b1 Merge pull request #4807 from nyanmisaka/ps4-dlna
Correct DLNA audio codecs for PS3 and PS4

(cherry picked from commit 1f2488d7d9)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-30 18:55:50 -05:00
Claus Vium
c08933c9d9 Merge pull request #4803 from ryanpetris/fix-getuser
Fix Live TV Recording Scheduling

(cherry picked from commit 6274cf8fcc)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-30 18:55:50 -05:00
Bond-009
c86c652006 Merge pull request #4794 from cvium/fix_image_upload
Convert from base64 when saving item images

(cherry picked from commit e84622b4ab)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-30 18:55:50 -05:00
Bond-009
c08ce82a04 Merge pull request #4792 from cvium/fix_missing_seasons
Add missing seasons during AfterMetadataRefresh

(cherry picked from commit 8eeed82523)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-30 18:55:50 -05:00
Claus Vium
b10178bd1e Merge pull request #4789 from crobibero/provider-search
Fix get provider id extension

(cherry picked from commit bc8f1bdcac)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-30 18:55:50 -05:00
Bond-009
00a608dfab Merge pull request #4781 from crobibero/map-xmltv
Use request body for mapping xml channels

(cherry picked from commit 906ee4f962)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-30 18:55:50 -05:00
Claus Vium
480ded0671 Merge pull request #4771 from crobibero/typed-get-preference
Use typed UserManager GetPreference

(cherry picked from commit 21d2e9ff0c)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-30 18:55:50 -05:00
Bond-009
98c081f0ce Merge pull request #4774 from nyanmisaka/finetune-tonemap
Fine tune some tone mapping params

(cherry picked from commit 381341c83b)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-13 20:34:33 -05:00
Joshua M. Boniface
e77d0ab5fd Merge pull request #4773 from Artiume/patch-10
Remove opf extension for book types

(cherry picked from commit e7ae712437)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-13 20:34:33 -05:00
Claus Vium
28ef1bc8b2 Merge pull request #4769 from crobibero/typo
Check correct fetcher list for provider name

(cherry picked from commit 4ecb30ef10)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-13 20:34:33 -05:00
Claus Vium
7ebf7014e0 Merge pull request #4767 from nyanmisaka/fix-ssl-save
(cherry picked from commit f9a78625b7)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-13 20:34:33 -05:00
Claus Vium
89a649cc23 Merge pull request #4762 from crobibero/api-file-return
Fix openapi file schema

(cherry picked from commit b56feac841)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-13 20:34:33 -05:00
Claus Vium
24b2991def Merge pull request #4761 from crobibero/playlist
(cherry picked from commit 13bb5e1ead)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-13 20:34:33 -05:00
Claus Vium
87dde66e92 Merge pull request #4758 from nyanmisaka/fix-landingScreen-options
(cherry picked from commit f8ef38c0ea)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-13 20:34:33 -05:00
Claus Vium
1b82ef905e Merge pull request #4757 from cvium/semi_revert_defer_image_loading
(cherry picked from commit 0cddfbcff5)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-13 20:34:33 -05:00
Claus Vium
02cc83b807 Merge pull request #4756 from crobibero/api-key-inverted-condition
Fix inverted condition when authenticating with an ApiKey

(cherry picked from commit c1bb29532f)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-13 20:34:32 -05:00
Claus Vium
0d8fa795a0 Merge pull request #4753 from crobibero/5.0.1
Update to dotnet 5.0.1

(cherry picked from commit a56ac65449)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-13 20:34:32 -05:00
Bond-009
b32f15ab1e Merge pull request #4751 from nyanmisaka/mpegts-batchsize
(cherry picked from commit 9e601ba731)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-13 20:34:32 -05:00
Joshua M. Boniface
26993e39f7 Merge pull request #4750 from crobibero/skia
Fix blueberry

(cherry picked from commit 7b5319bb07)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-13 20:34:32 -05:00
Bond-009
ddedb2d7f1 Merge pull request #4749 from crobibero/guid-standard
(cherry picked from commit 933e7fa159)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-13 20:34:32 -05:00
Claus Vium
5c0d930dc3 Merge pull request #4743 from crobibero/metadata-options
Actually use library options when filtering metadata providers

(cherry picked from commit e85884ddb9)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-13 20:34:32 -05:00
Claus Vium
13d62c5977 Merge pull request #4741 from jellyfin/tests8
Add tests for HdHomerunHost.GetLineup

(cherry picked from commit 31e8273795)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-13 20:34:32 -05:00
Claus Vium
9799b6ae81 Merge pull request #4738 from jellyfin/tests8
Add tests for HdHomerunHost.GetModelInfo

(cherry picked from commit e6650651b3)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-13 20:34:32 -05:00
Claus Vium
c1dd8f2050 Merge pull request #4737 from crobibero/missing-ensure-success
(cherry picked from commit f322866127)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-13 20:34:32 -05:00
Claus Vium
853c328763 Merge pull request #4736 from nyanmisaka/fix-custom-order
Fix custom library order

(cherry picked from commit b83bc0a589)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-13 20:34:32 -05:00
Anthony Lavado
126753a1fe Merge pull request #4735 from crobibero/json-recursion
Fix JsonConverter recursion

(cherry picked from commit 94d805d03d)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-13 20:34:32 -05:00
Bond-009
24e4fcc3b7 Merge pull request #4733 from crobibero/omdb-null
Fix potential null reference in OMDB

(cherry picked from commit 87e13b858a)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-13 20:34:32 -05:00
Claus Vium
aae90a8480 Merge pull request #4730 from crobibero/base-item-dto-guid-nullable
Don't serialize empty GUID to null

(cherry picked from commit b6ecaccf92)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-13 20:34:32 -05:00
Claus Vium
11a37884f0 Merge pull request #4726 from BaronGreenback/19.0RC--Fix-CertificateLoadError
Fix - Access Denied on using certificates in windows as user.

(cherry picked from commit c5a5f77b9e)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-13 20:34:32 -05:00
Claus Vium
49f3579c1b Merge pull request #4724 from BaronGreenback/17.0RC----DLNA_PlayTo_Fix
(cherry picked from commit e6ea5a776d)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-13 20:34:32 -05:00
Claus Vium
259d811b95 Merge pull request #4722 from crobibero/forbid
Fix API forbidden response

(cherry picked from commit 80ff564143)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-13 20:34:32 -05:00
Joshua M. Boniface
7e01cce884 Merge pull request #4716 from OancaAndrei/syncplay-new-auth-policies
(cherry picked from commit 4f6a585424)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-13 20:34:32 -05:00
Claus Vium
2e5333c1d4 Merge pull request #4715 from crobibero/hdhr-json-bool
Add number to bool json converter

(cherry picked from commit 0aad17554c)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-13 20:34:32 -05:00
Claus Vium
e8e1bbffd9 Merge pull request #4713 from crobibero/robots
(cherry picked from commit a3a7467f49)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-13 20:34:32 -05:00
Claus Vium
723fe43d2e Merge pull request #4711 from barronpm/api-fixes
Add required attributes to parameters

(cherry picked from commit 4c199ac9a5)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-13 20:34:32 -05:00
Claus Vium
e70a6d41f4 Merge pull request #4710 from OancaAndrei/syncplay-fix-session-restore
Restore sessions in SyncPlay groups upon reconnection

(cherry picked from commit a57e465de9)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-13 20:34:32 -05:00
Claus Vium
9d4417eee3 Merge pull request #4706 from cvium/fix_aspectratio_again
Only apply series image aspect ratio if episode/season has no primary image

(cherry picked from commit 0d5f651ae9)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-13 20:34:32 -05:00
Claus Vium
67f41386ba Merge pull request #4701 from crobibero/plugin-version
(cherry picked from commit 7455de1f85)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-13 20:34:32 -05:00
Bond-009
b1af8db423 Merge pull request #4699 from crobibero/display_prefs_index
Fix CustomItemDisplayPreferences unique key collision in the migration

(cherry picked from commit b3caa51173)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-13 20:34:32 -05:00
Claus Vium
91656acabb Merge pull request #4678 from BaronGreenback/network_routing_fix_17.0rc
Change logging level and message in NetworkManager

(cherry picked from commit 885d42cb65)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-13 20:34:32 -05:00
Claus Vium
5fa8c83ba4 Merge pull request #4675 from BaronGreenback/ProxyDNS
(cherry picked from commit 8c00fbea9c)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-13 20:34:32 -05:00
Bond-009
683bc27b27 Merge pull request #4672 from cvium/fix_mergeversions_which_was_unrelated_to_my_bughunt
Fix MergeVersions endpoint

(cherry picked from commit 26919eed26)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-13 20:34:31 -05:00
Bond-009
0b6a05cf82 Merge pull request #4671 from cvium/allow_proxy
Clear KnownNetworks and KnownProxies if none are configured explicitly

(cherry picked from commit 804dd00425)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-13 20:34:31 -05:00
Joshua M. Boniface
2647935b96 Merge pull request #4669 from MrTimscampi/fix-npm-public
Fix NPM command in CI

(cherry picked from commit 8976b22ac4)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-05 01:36:00 -05:00
Joshua M. Boniface
2a4023c6c7 Merge pull request #4667 from joshuaboniface/fix-nuget-ci
Remove obsolete erroring command

(cherry picked from commit f2c2beca0f)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-05 01:35:18 -05:00
Joshua M. Boniface
2a2630098b Merge pull request #4662 from joshuaboniface/fix-bump-version
Fix bad do in bump_version

(cherry picked from commit e3a1991fe9)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
2020-12-05 01:12:47 -05:00
Joshua M. Boniface
79472dce70 Bump version to 10.7.0~rc1 2020-12-04 21:03:57 -05:00
1192 changed files with 16308 additions and 24344 deletions

View File

@@ -7,7 +7,7 @@ parameters:
default: "ubuntu-latest"
- name: DotNetSdkVersion
type: string
default: 5.0.302
default: 5.0.103
jobs:
- job: CompatibilityCheck

View File

@@ -1,7 +1,7 @@
parameters:
LinuxImage: 'ubuntu-latest'
RestoreBuildProjects: 'Jellyfin.Server/Jellyfin.Server.csproj'
DotNetSdkVersion: 5.0.302
DotNetSdkVersion: 5.0.103
jobs:
- job: Build

View File

@@ -10,7 +10,7 @@ parameters:
default: "tests/**/*Tests.csproj"
- name: DotNetSdkVersion
type: string
default: 5.0.302
default: 5.0.103
jobs:
- job: Test
@@ -94,5 +94,5 @@ jobs:
displayName: 'Publish OpenAPI Artifact'
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
inputs:
targetPath: "tests/Jellyfin.Server.Integration.Tests/bin/Release/net5.0/openapi.json"
targetPath: "tests/Jellyfin.Api.Tests/bin/Release/net5.0/openapi.json"
artifactName: 'OpenAPI Spec'

View File

@@ -6,7 +6,7 @@ variables:
- name: RestoreBuildProjects
value: 'Jellyfin.Server/Jellyfin.Server.csproj'
- name: DotNetSdkVersion
value: 5.0.302
value: 5.0.103
pr:
autoCancel: true

30
.drone.yml Normal file
View File

@@ -0,0 +1,30 @@
---
kind: pipeline
name: build-debug
steps:
- name: submodules
image: docker:git
commands:
- git submodule update --init --recursive
- name: build
image: microsoft/dotnet:2-sdk
commands:
- dotnet publish "Jellyfin.Server" --configuration Debug --output "../ci/ci-debug"
---
kind: pipeline
name: build-release
steps:
- name: submodules
image: docker:git
commands:
- git submodule update --init --recursive
- name: build
image: microsoft/dotnet:2-sdk
commands:
- dotnet publish "Jellyfin.Server" --configuration Release --output "../ci/ci-release"

1
.github/CODEOWNERS vendored
View File

@@ -1,4 +1,3 @@
# Joshua must review all changes to deployment and build.sh
.ci/* @joshuaboniface
deployment/* @joshuaboniface
build.sh @joshuaboniface

View File

@@ -17,7 +17,6 @@ assignees: ''
- Browser: [e.g. Firefox 72, Chrome 80, Safari 13]
- Jellyfin Version: [e.g. 10.4.3, nightly 20191231]
- Playback: [Direct Play, Remux, Direct Stream, Transcode]
- Hardware Acceleration: [e.g. none, VAAPI, NVENC, etc.]
- Installed Plugins: [e.g. none, Fanart, Anime, etc.]
- Reverse Proxy: [e.g. none, nginx, apache, etc.]
- Base URL: [e.g. none, yes: /example]
@@ -34,13 +33,7 @@ assignees: ''
**Expected behavior**
<!-- A clear and concise description of what you expected to happen. -->
**Server Logs**
<!-- Please paste any log errors. -->
**FFmpeg Logs**
<!-- Please paste any log errors. -->
**Browser Console Logs**
**Logs**
<!-- Please paste any log errors. -->
**Screenshots**

View File

@@ -6,10 +6,4 @@ updates:
interval: weekly
time: '12:00'
open-pull-requests-limit: 10
- package-ecosystem: github-actions
directory: '/'
schedule:
interval: weekly
time: '12:00'
open-pull-requests-limit: 10

6
.github/stale.yml vendored
View File

@@ -17,13 +17,9 @@ staleLabel: stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has gone 120 days without comment. To avoid abandoned issues, it will be closed in 21 days if there are no new comments.
If you're the original submitter of this issue, please comment confirming if this issue still affects you in the latest release or nightlies, or close the issue if it has been fixed. If you're another user also affected by this bug, please comment confirming so. Either action will remove the stale label.
This bot exists to prevent issues from becoming stale and forgotten. Jellyfin is always moving forward, and bugs are often fixed as side effects of other changes. We therefore ask that bug report authors remain vigilant about their issues to ensure they are closed if fixed, or re-confirmed - perhaps with fresh logs or reproduction examples - regularly. If you have any questions you can reach us on [Matrix or Social Media](https://docs.jellyfin.org/general/getting-help.html).
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
# Disable automatic closing of pull requests
pulls:
daysUntilClose: false

View File

@@ -1,76 +0,0 @@
name: Automation
on:
push:
branches:
- master
pull_request_target:
issue_comment:
jobs:
label:
name: Labeling
runs-on: ubuntu-latest
if: ${{ github.repository == 'jellyfin/jellyfin' }}
steps:
- name: Apply label
uses: eps1lon/actions-label-merge-conflict@v2.0.1
if: ${{ github.event_name == 'push' || github.event_name == 'pull_request_target'}}
with:
dirtyLabel: 'merge conflict'
repoToken: ${{ secrets.JF_BOT_TOKEN }}
project:
name: Project board
runs-on: ubuntu-latest
if: ${{ github.repository == 'jellyfin/jellyfin' }}
steps:
- name: Remove from 'Current Release' project
uses: alex-page/github-project-automation-plus@v0.8.1
if: (github.event.pull_request || github.event.issue.pull_request) && !contains(github.event.*.labels.*.name, 'stable backport')
continue-on-error: true
with:
project: Current Release
action: delete
repo-token: ${{ secrets.JF_BOT_TOKEN }}
- name: Add to 'Release Next' project
uses: alex-page/github-project-automation-plus@v0.8.1
if: (github.event.pull_request || github.event.issue.pull_request) && github.event.action == 'opened'
continue-on-error: true
with:
project: Release Next
column: In progress
repo-token: ${{ secrets.JF_BOT_TOKEN }}
- name: Add to 'Current Release' project
uses: alex-page/github-project-automation-plus@v0.8.1
if: (github.event.pull_request || github.event.issue.pull_request) && !contains(github.event.*.labels.*.name, 'stable backport')
continue-on-error: true
with:
project: Current Release
column: In progress
repo-token: ${{ secrets.JF_BOT_TOKEN }}
- name: Check number of comments from the team member
if: github.event.issue.pull_request == '' && github.event.comment.author_association == 'MEMBER'
id: member_comments
run: echo "::set-output name=number::$(curl -s ${{ github.event.issue.comments_url }} | jq '.[] | select(.author_association == "MEMBER") | .author_association' | wc -l)"
- name: Move issue to needs triage
uses: alex-page/github-project-automation-plus@v0.8.1
if: github.event.issue.pull_request == '' && github.event.comment.author_association == 'MEMBER' && steps.member_comments.outputs.number <= 1
continue-on-error: true
with:
project: Issue Triage for Main Repo
column: Needs triage
repo-token: ${{ secrets.JF_BOT_TOKEN }}
- name: Add issue to triage project
uses: alex-page/github-project-automation-plus@v0.8.1
if: github.event.issue.pull_request == '' && github.event.action == 'opened'
continue-on-error: true
with:
project: Issue Triage for Main Repo
column: Pending response
repo-token: ${{ secrets.JF_BOT_TOKEN }}

View File

@@ -1,119 +0,0 @@
name: Commands
on:
issue_comment:
types:
- created
- edited
pull_request_target:
types:
- labeled
- synchronize
jobs:
rebase:
name: Rebase
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '@jellyfin-bot rebase') && github.event.comment.author_association == 'MEMBER'
runs-on: ubuntu-latest
steps:
- name: Notify as seen
uses: peter-evans/create-or-update-comment@v1.4.5
with:
token: ${{ secrets.JF_BOT_TOKEN }}
comment-id: ${{ github.event.comment.id }}
reactions: '+1'
- name: Checkout the latest code
uses: actions/checkout@v2
with:
token: ${{ secrets.JF_BOT_TOKEN }}
fetch-depth: 0
- name: Automatic Rebase
uses: cirrus-actions/rebase@1.4
env:
GITHUB_TOKEN: ${{ secrets.JF_BOT_TOKEN }}
check-backport:
name: Check Backport
if: ${{ ( github.event.issue.pull_request && contains(github.event.comment.body, '@jellyfin-bot check backport') ) || github.event.label.name == 'stable backport' || contains(github.event.pull_request.labels.*.name, 'stable backport' ) }}
runs-on: ubuntu-latest
steps:
- name: Notify as seen
uses: peter-evans/create-or-update-comment@v1.4.5
if: ${{ github.event.comment != null }}
with:
token: ${{ secrets.JF_BOT_TOKEN }}
comment-id: ${{ github.event.comment.id }}
reactions: eyes
- name: Checkout the latest code
uses: actions/checkout@v2
with:
token: ${{ secrets.JF_BOT_TOKEN }}
fetch-depth: 0
- name: Notify as running
id: comment_running
uses: peter-evans/create-or-update-comment@v1.4.5
if: ${{ github.event.comment != null }}
with:
token: ${{ secrets.JF_BOT_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: |
Running backport tests...
- name: Perform test backport
id: run_tests
run: |
set +o errexit
git config --global user.name "Jellyfin Bot"
git config --global user.email "team@jellyfin.org"
CURRENT_BRANCH="origin/${GITHUB_HEAD_REF}"
git checkout master
git merge --no-ff ${CURRENT_BRANCH}
MERGE_COMMIT_HASH=$( git log -q -1 | head -1 | awk '{ print $2 }' )
git fetch --all
CURRENT_STABLE=$( git branch -r | grep 'origin/release' | sort -rV | head -1 | awk -F '/' '{ print $NF }' )
stable_branch="Current stable release branch: ${CURRENT_STABLE}"
echo ${stable_branch}
echo ::set-output name=branch::${stable_branch}
git checkout -t origin/${CURRENT_STABLE} -b ${CURRENT_STABLE}
git cherry-pick -sx -m1 ${MERGE_COMMIT_HASH} &>output.txt
retcode=$?
cat output.txt | grep -v 'hint:'
output="$( grep -v 'hint:' output.txt )"
output="${output//'%'/'%25'}"
output="${output//$'\n'/'%0A'}"
output="${output//$'\r'/'%0D'}"
echo ::set-output name=output::$output
exit ${retcode}
- name: Notify with result success
uses: peter-evans/create-or-update-comment@v1.4.5
if: ${{ github.event.comment != null && success() }}
with:
token: ${{ secrets.JF_BOT_TOKEN }}
comment-id: ${{ steps.comment_running.outputs.comment-id }}
body: |
${{ steps.run_tests.outputs.branch }}
Output from `git cherry-pick`:
---
${{ steps.run_tests.outputs.output }}
reactions: hooray
- name: Notify with result failure
uses: peter-evans/create-or-update-comment@v1.4.5
if: ${{ github.event.comment != null && failure() }}
with:
token: ${{ secrets.JF_BOT_TOKEN }}
comment-id: ${{ steps.comment_running.outputs.comment-id }}
body: |
${{ steps.run_tests.outputs.branch }}
Output from `git cherry-pick`:
---
${{ steps.run_tests.outputs.output }}
reactions: confused

1
.gitignore vendored
View File

@@ -268,7 +268,6 @@ doc/
# Deployment artifacts
dist
*.exe
*.dll
# BenchmarkDotNet artifacts
BenchmarkDotNet.Artifacts

View File

@@ -17,7 +17,6 @@
- [bugfixin](https://github.com/bugfixin)
- [chaosinnovator](https://github.com/chaosinnovator)
- [ckcr4lyf](https://github.com/ckcr4lyf)
- [cocool97](https://github.com/cocool97)
- [ConfusedPolarBear](https://github.com/ConfusedPolarBear)
- [crankdoofus](https://github.com/crankdoofus)
- [crobibero](https://github.com/crobibero)
@@ -70,7 +69,6 @@
- [marius-luca-87](https://github.com/marius-luca-87)
- [mark-monteiro](https://github.com/mark-monteiro)
- [Matt07211](https://github.com/Matt07211)
- [Maxr1998](https://github.com/Maxr1998)
- [mcarlton00](https://github.com/mcarlton00)
- [mitchfizz05](https://github.com/mitchfizz05)
- [MrTimscampi](https://github.com/MrTimscampi)
@@ -83,7 +81,6 @@
- [nvllsvm](https://github.com/nvllsvm)
- [nyanmisaka](https://github.com/nyanmisaka)
- [OancaAndrei](https://github.com/OancaAndrei)
- [obradovichv](https://github.com/obradovichv)
- [oddstr13](https://github.com/oddstr13)
- [orryverducci](https://github.com/orryverducci)
- [petermcneil](https://github.com/petermcneil)
@@ -111,7 +108,7 @@
- [sorinyo2004](https://github.com/sorinyo2004)
- [sparky8251](https://github.com/sparky8251)
- [spookbits](https://github.com/spookbits)
- [ssenart](https://github.com/ssenart)
- [ssenart] (https://github.com/ssenart)
- [stanionascu](https://github.com/stanionascu)
- [stevehayles](https://github.com/stevehayles)
- [SuperSandro2000](https://github.com/SuperSandro2000)
@@ -147,7 +144,6 @@
- [nielsvanvelzen](https://github.com/nielsvanvelzen)
- [skyfrk](https://github.com/skyfrk)
- [ianjazz246](https://github.com/ianjazz246)
- [peterspenler](https://github.com/peterspenler)
# Emby Contributors
@@ -212,4 +208,3 @@
- [Tim Hobbs](https://github.com/timhobbs)
- [SvenVandenbrande](https://github.com/SvenVandenbrande)
- [olsh](https://github.com/olsh)
- [gnuyent](https://github.com/gnuyent)

View File

@@ -1,14 +0,0 @@
<Project>
<!-- Sets defaults for all projects in the repo -->
<PropertyGroup>
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)/jellyfin.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
</PropertyGroup>
</Project>

View File

@@ -1,14 +1,22 @@
ARG DOTNET_VERSION=5.0
FROM node:lts-alpine as web-builder
FROM node:alpine as web-builder
ARG JELLYFIN_WEB_VERSION=master
RUN apk add curl git zlib zlib-dev autoconf g++ make libpng-dev gifsicle alpine-sdk automake libtool make gcc musl-dev nasm python3 \
RUN apk add curl git zlib zlib-dev autoconf g++ make libpng-dev gifsicle alpine-sdk automake libtool make gcc musl-dev nasm python \
&& curl -L https://github.com/jellyfin/jellyfin-web/archive/${JELLYFIN_WEB_VERSION}.tar.gz | tar zxf - \
&& cd jellyfin-web-* \
&& npm ci --no-audit --unsafe-perm \
&& yarn install \
&& mv dist /dist
FROM debian:buster-slim as app
FROM mcr.microsoft.com/dotnet/sdk:${DOTNET_VERSION}-buster-slim as builder
WORKDIR /repo
COPY . .
ENV DOTNET_CLI_TELEMETRY_OPTOUT=1
# because of changes in docker and systemd we need to not build in parallel at the moment
# see https://success.docker.com/article/how-to-reserve-resource-temporarily-unavailable-errors-due-to-tasksmax-setting
RUN dotnet publish Jellyfin.Server --disable-parallel --configuration Release --output="/jellyfin" --self-contained --runtime linux-x64 "-p:DebugSymbols=false;DebugType=none"
FROM debian:buster-slim
# https://askubuntu.com/questions/972516/debian-frontend-environment-variable
ARG DEBIAN_FRONTEND="noninteractive"
@@ -17,6 +25,9 @@ ARG APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn
# https://github.com/NVIDIA/nvidia-docker/wiki/Installation-(Native-GPU-Support)
ENV NVIDIA_DRIVER_CAPABILITIES="compute,video,utility"
COPY --from=builder /jellyfin /jellyfin
COPY --from=web-builder /dist /jellyfin/jellyfin-web
# https://github.com/intel/compute-runtime/releases
ARG GMMLIB_VERSION=20.3.2
ARG IGC_VERSION=1.0.5435
@@ -62,19 +73,6 @@ ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
FROM mcr.microsoft.com/dotnet/sdk:${DOTNET_VERSION} as builder
WORKDIR /repo
COPY . .
ENV DOTNET_CLI_TELEMETRY_OPTOUT=1
# because of changes in docker and systemd we need to not build in parallel at the moment
# see https://success.docker.com/article/how-to-reserve-resource-temporarily-unavailable-errors-due-to-tasksmax-setting
RUN dotnet publish Jellyfin.Server --disable-parallel --configuration Release --output="/jellyfin" --self-contained --runtime linux-x64 "-p:DebugSymbols=false;DebugType=none"
FROM app
COPY --from=builder /jellyfin /jellyfin
COPY --from=web-builder /dist /jellyfin/jellyfin-web
EXPOSE 8096
VOLUME /cache /config /media
ENTRYPOINT ["./jellyfin/jellyfin", \

View File

@@ -5,16 +5,27 @@
ARG DOTNET_VERSION=5.0
FROM node:lts-alpine as web-builder
FROM node:alpine as web-builder
ARG JELLYFIN_WEB_VERSION=master
RUN apk add curl git zlib zlib-dev autoconf g++ make libpng-dev gifsicle alpine-sdk automake libtool make gcc musl-dev nasm python3 \
RUN apk add curl git zlib zlib-dev autoconf g++ make libpng-dev gifsicle alpine-sdk automake libtool make gcc musl-dev nasm python \
&& curl -L https://github.com/jellyfin/jellyfin-web/archive/${JELLYFIN_WEB_VERSION}.tar.gz | tar zxf - \
&& cd jellyfin-web-* \
&& npm ci --no-audit --unsafe-perm \
&& yarn install \
&& mv dist /dist
FROM mcr.microsoft.com/dotnet/sdk:${DOTNET_VERSION} as builder
WORKDIR /repo
COPY . .
ENV DOTNET_CLI_TELEMETRY_OPTOUT=1
# Discard objs - may cause failures if exists
RUN find . -type d -name obj | xargs -r rm -r
# Build
RUN dotnet publish Jellyfin.Server --configuration Release --output="/jellyfin" --self-contained --runtime linux-arm "-p:DebugSymbols=false;DebugType=none"
FROM multiarch/qemu-user-static:x86_64-arm as qemu
FROM arm32v7/debian:buster-slim as app
FROM arm32v7/debian:buster-slim
# https://askubuntu.com/questions/972516/debian-frontend-environment-variable
ARG DEBIAN_FRONTEND="noninteractive"
@@ -50,25 +61,14 @@ RUN apt-get update \
&& chmod 777 /cache /config /media \
&& sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && locale-gen
COPY --from=builder /jellyfin /jellyfin
COPY --from=web-builder /dist /jellyfin/jellyfin-web
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
FROM mcr.microsoft.com/dotnet/sdk:${DOTNET_VERSION} as builder
WORKDIR /repo
COPY . .
ENV DOTNET_CLI_TELEMETRY_OPTOUT=1
# Discard objs - may cause failures if exists
RUN find . -type d -name obj | xargs -r rm -r
# Build
RUN dotnet publish Jellyfin.Server --configuration Release --output="/jellyfin" --self-contained --runtime linux-arm "-p:DebugSymbols=false;DebugType=none"
FROM app
COPY --from=builder /jellyfin /jellyfin
COPY --from=web-builder /dist /jellyfin/jellyfin-web
EXPOSE 8096
VOLUME /cache /config /media
ENTRYPOINT ["./jellyfin/jellyfin", \

View File

@@ -5,16 +5,26 @@
ARG DOTNET_VERSION=5.0
FROM node:lts-alpine as web-builder
FROM node:alpine as web-builder
ARG JELLYFIN_WEB_VERSION=master
RUN apk add curl git zlib zlib-dev autoconf g++ make libpng-dev gifsicle alpine-sdk automake libtool make gcc musl-dev nasm python3 \
RUN apk add curl git zlib zlib-dev autoconf g++ make libpng-dev gifsicle alpine-sdk automake libtool make gcc musl-dev nasm python \
&& curl -L https://github.com/jellyfin/jellyfin-web/archive/${JELLYFIN_WEB_VERSION}.tar.gz | tar zxf - \
&& cd jellyfin-web-* \
&& npm ci --no-audit --unsafe-perm \
&& yarn install \
&& mv dist /dist
FROM mcr.microsoft.com/dotnet/sdk:${DOTNET_VERSION} as builder
WORKDIR /repo
COPY . .
ENV DOTNET_CLI_TELEMETRY_OPTOUT=1
# Discard objs - may cause failures if exists
RUN find . -type d -name obj | xargs -r rm -r
# Build
RUN dotnet publish Jellyfin.Server --configuration Release --output="/jellyfin" --self-contained --runtime linux-arm64 "-p:DebugSymbols=false;DebugType=none"
FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu
FROM arm64v8/debian:buster-slim as app
FROM arm64v8/debian:buster-slim
# https://askubuntu.com/questions/972516/debian-frontend-environment-variable
ARG DEBIAN_FRONTEND="noninteractive"
@@ -40,25 +50,14 @@ RUN apt-get update && apt-get install --no-install-recommends --no-install-sugge
&& chmod 777 /cache /config /media \
&& sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && locale-gen
COPY --from=builder /jellyfin /jellyfin
COPY --from=web-builder /dist /jellyfin/jellyfin-web
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
FROM mcr.microsoft.com/dotnet/sdk:${DOTNET_VERSION} as builder
WORKDIR /repo
COPY . .
ENV DOTNET_CLI_TELEMETRY_OPTOUT=1
# Discard objs - may cause failures if exists
RUN find . -type d -name obj | xargs -r rm -r
# Build
RUN dotnet publish Jellyfin.Server --configuration Release --output="/jellyfin" --self-contained --runtime linux-arm64 "-p:DebugSymbols=false;DebugType=none"
FROM app
COPY --from=builder /jellyfin /jellyfin
COPY --from=web-builder /dist /jellyfin/jellyfin-web
EXPOSE 8096
VOLUME /cache /config /media
ENTRYPOINT ["./jellyfin/jellyfin", \

View File

@@ -13,8 +13,7 @@
<TargetFramework>net5.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AnalysisMode>AllDisabledByDefault</AnalysisMode>
<Nullable>disable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
</Project>

View File

@@ -72,7 +72,7 @@ namespace Emby.Dlna.Configuration
/// <summary>
/// Gets or sets the default user account that the dlna server uses.
/// </summary>
public string? DefaultUserId { get; set; }
public string DefaultUserId { get; set; }
/// <summary>
/// Gets or sets a value indicating whether playTo device profiles should be created.

View File

@@ -1,3 +1,4 @@
#nullable enable
#pragma warning disable CS1591
using Emby.Dlna.Configuration;

View File

@@ -31,7 +31,7 @@ namespace Emby.Dlna.ConnectionManager
}
/// <inheritdoc />
protected override void WriteResult(string methodName, IReadOnlyDictionary<string, string> methodParams, XmlWriter xmlWriter)
protected override void WriteResult(string methodName, IDictionary<string, string> methodParams, XmlWriter xmlWriter)
{
if (string.Equals(methodName, "GetProtocolInfo", StringComparison.OrdinalIgnoreCase))
{

View File

@@ -138,7 +138,7 @@ namespace Emby.Dlna.ContentDirectory
/// </summary>
/// <param name="profile">The <see cref="DeviceProfile"/>.</param>
/// <returns>The <see cref="User"/>.</returns>
private User? GetUser(DeviceProfile profile)
private User GetUser(DeviceProfile profile)
{
if (!string.IsNullOrEmpty(profile.UserId))
{

View File

@@ -1,6 +1,5 @@
#nullable disable
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
@@ -8,6 +7,7 @@ using System.Linq;
using System.Text;
using System.Threading;
using System.Xml;
using Emby.Dlna.Configuration;
using Emby.Dlna.Didl;
using Emby.Dlna.Service;
using Jellyfin.Data.Entities;
@@ -121,7 +121,7 @@ namespace Emby.Dlna.ContentDirectory
}
/// <inheritdoc />
protected override void WriteResult(string methodName, IReadOnlyDictionary<string, string> methodParams, XmlWriter xmlWriter)
protected override void WriteResult(string methodName, IDictionary<string, string> methodParams, XmlWriter xmlWriter)
{
if (xmlWriter == null)
{
@@ -201,8 +201,8 @@ namespace Emby.Dlna.ContentDirectory
/// <summary>
/// Adds a "XSetBookmark" element to the xml document.
/// </summary>
/// <param name="sparams">The method parameters.</param>
private void HandleXSetBookmark(IReadOnlyDictionary<string, string> sparams)
/// <param name="sparams">The <see cref="IDictionary"/>.</param>
private void HandleXSetBookmark(IDictionary<string, string> sparams)
{
var id = sparams["ObjectID"];
@@ -288,28 +288,52 @@ namespace Emby.Dlna.ContentDirectory
/// <returns>The xml feature list.</returns>
private static string WriteFeatureListXml()
{
return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ "<Features xmlns=\"urn:schemas-upnp-org:av:avs\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"urn:schemas-upnp-org:av:avs http://www.upnp.org/schemas/av/avs.xsd\">"
+ "<Feature name=\"samsung.com_BASICVIEW\" version=\"1\">"
+ "<container id=\"I\" type=\"object.item.imageItem\"/>"
+ "<container id=\"A\" type=\"object.item.audioItem\"/>"
+ "<container id=\"V\" type=\"object.item.videoItem\"/>"
+ "</Feature>"
+ "</Features>";
// TODO: clean this up
var builder = new StringBuilder();
builder.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
builder.Append("<Features xmlns=\"urn:schemas-upnp-org:av:avs\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"urn:schemas-upnp-org:av:avs http://www.upnp.org/schemas/av/avs.xsd\">");
builder.Append("<Feature name=\"samsung.com_BASICVIEW\" version=\"1\">");
builder.Append("<container id=\"I\" type=\"object.item.imageItem\"/>");
builder.Append("<container id=\"A\" type=\"object.item.audioItem\"/>");
builder.Append("<container id=\"V\" type=\"object.item.videoItem\"/>");
builder.Append("</Feature>");
builder.Append("</Features>");
return builder.ToString();
}
/// <summary>
/// Returns the value in the key of the dictionary, or defaultValue if it doesn't exist.
/// </summary>
/// <param name="sparams">The <see cref="IDictionary"/>.</param>
/// <param name="key">The key.</param>
/// <param name="defaultValue">The defaultValue.</param>
/// <returns>The <see cref="string"/>.</returns>
public static string GetValueOrDefault(IDictionary<string, string> sparams, string key, string defaultValue)
{
if (sparams != null && sparams.TryGetValue(key, out string val))
{
return val;
}
return defaultValue;
}
/// <summary>
/// Builds the "Browse" xml response.
/// </summary>
/// <param name="xmlWriter">The <see cref="XmlWriter"/>.</param>
/// <param name="sparams">The method parameters.</param>
/// <param name="sparams">The <see cref="IDictionary"/>.</param>
/// <param name="deviceId">The device Id to use.</param>
private void HandleBrowse(XmlWriter xmlWriter, IReadOnlyDictionary<string, string> sparams, string deviceId)
private void HandleBrowse(XmlWriter xmlWriter, IDictionary<string, string> sparams, string deviceId)
{
var id = sparams["ObjectID"];
var flag = sparams["BrowseFlag"];
var filter = new Filter(sparams.GetValueOrDefault("Filter", "*"));
var sortCriteria = new SortCriteria(sparams.GetValueOrDefault("SortCriteria", string.Empty));
var filter = new Filter(GetValueOrDefault(sparams, "Filter", "*"));
var sortCriteria = new SortCriteria(GetValueOrDefault(sparams, "SortCriteria", string.Empty));
var provided = 0;
@@ -411,9 +435,9 @@ namespace Emby.Dlna.ContentDirectory
/// Builds the response to the "X_BrowseByLetter request.
/// </summary>
/// <param name="xmlWriter">The <see cref="XmlWriter"/>.</param>
/// <param name="sparams">The method parameters.</param>
/// <param name="sparams">The <see cref="IDictionary"/>.</param>
/// <param name="deviceId">The device id.</param>
private void HandleXBrowseByLetter(XmlWriter xmlWriter, IReadOnlyDictionary<string, string> sparams, string deviceId)
private void HandleXBrowseByLetter(XmlWriter xmlWriter, IDictionary<string, string> sparams, string deviceId)
{
// TODO: Implement this method
HandleSearch(xmlWriter, sparams, deviceId);
@@ -423,13 +447,13 @@ namespace Emby.Dlna.ContentDirectory
/// Builds a response to the "Search" request.
/// </summary>
/// <param name="xmlWriter">The xmlWriter<see cref="XmlWriter"/>.</param>
/// <param name="sparams">The method parameters.</param>
/// <param name="sparams">The sparams<see cref="IDictionary"/>.</param>
/// <param name="deviceId">The deviceId<see cref="string"/>.</param>
private void HandleSearch(XmlWriter xmlWriter, IReadOnlyDictionary<string, string> sparams, string deviceId)
private void HandleSearch(XmlWriter xmlWriter, IDictionary<string, string> sparams, string deviceId)
{
var searchCriteria = new SearchCriteria(sparams.GetValueOrDefault("SearchCriteria", string.Empty));
var sortCriteria = new SortCriteria(sparams.GetValueOrDefault("SortCriteria", string.Empty));
var filter = new Filter(sparams.GetValueOrDefault("Filter", "*"));
var searchCriteria = new SearchCriteria(GetValueOrDefault(sparams, "SearchCriteria", string.Empty));
var sortCriteria = new SortCriteria(GetValueOrDefault(sparams, "SortCriteria", string.Empty));
var filter = new Filter(GetValueOrDefault(sparams, "Filter", "*"));
// sort example: dc:title, dc:date

View File

@@ -1,4 +1,5 @@
#pragma warning disable CS1591
#pragma warning disable SA1602
namespace Emby.Dlna.ContentDirectory
{

View File

@@ -1,5 +1,3 @@
#nullable disable
#pragma warning disable CS1591
using System.IO;

View File

@@ -6,11 +6,9 @@ namespace Emby.Dlna
{
public class ControlResponse
{
public ControlResponse(string xml, bool isSuccessful)
public ControlResponse()
{
Headers = new Dictionary<string, string>();
Xml = xml;
IsSuccessful = isSuccessful;
}
public IDictionary<string, string> Headers { get; }

View File

@@ -1,5 +1,3 @@
#nullable disable
#pragma warning disable CS1591
using System;
@@ -210,8 +208,7 @@ namespace Emby.Dlna.Didl
var targetWidth = streamInfo.TargetWidth;
var targetHeight = streamInfo.TargetHeight;
var contentFeatureList = ContentFeatureBuilder.BuildVideoHeader(
_profile,
var contentFeatureList = new ContentFeatureBuilder(_profile).BuildVideoHeader(
streamInfo.Container,
streamInfo.TargetVideoCodec.FirstOrDefault(),
streamInfo.TargetAudioCodec.FirstOrDefault(),
@@ -602,8 +599,7 @@ namespace Emby.Dlna.Didl
? MimeTypes.GetMimeType(filename)
: mediaProfile.MimeType;
var contentFeatures = ContentFeatureBuilder.BuildAudioHeader(
_profile,
var contentFeatures = new ContentFeatureBuilder(_profile).BuildAudioHeader(
streamInfo.Container,
streamInfo.TargetAudioCodec.FirstOrDefault(),
targetAudioBitrate,
@@ -978,28 +974,15 @@ namespace Emby.Dlna.Didl
return;
}
// TODO: Remove these default values
var albumArtUrlInfo = GetImageUrl(
imageInfo,
_profile.MaxAlbumArtWidth ?? 10000,
_profile.MaxAlbumArtHeight ?? 10000,
"jpg");
var albumartUrlInfo = GetImageUrl(imageInfo, _profile.MaxAlbumArtWidth, _profile.MaxAlbumArtHeight, "jpg");
writer.WriteStartElement("upnp", "albumArtURI", NsUpnp);
if (!string.IsNullOrEmpty(_profile.AlbumArtPn))
{
writer.WriteAttributeString("dlna", "profileID", NsDlna, _profile.AlbumArtPn);
}
writer.WriteString(albumArtUrlInfo.url);
writer.WriteAttributeString("dlna", "profileID", NsDlna, _profile.AlbumArtPn);
writer.WriteString(albumartUrlInfo.url);
writer.WriteFullEndElement();
// TODO: Remove these default values
var iconUrlInfo = GetImageUrl(
imageInfo,
_profile.MaxIconWidth ?? 48,
_profile.MaxIconHeight ?? 48,
"jpg");
// TOOD: Remove these default values
var iconUrlInfo = GetImageUrl(imageInfo, _profile.MaxIconWidth ?? 48, _profile.MaxIconHeight ?? 48, "jpg");
writer.WriteElementString("upnp", "icon", NsUpnp, iconUrlInfo.url);
if (!_profile.EnableAlbumArtInDidl)
@@ -1050,7 +1033,8 @@ namespace Emby.Dlna.Didl
var width = albumartUrlInfo.width ?? maxWidth;
var height = albumartUrlInfo.height ?? maxHeight;
var contentFeatures = ContentFeatureBuilder.BuildImageHeader(_profile, format, width, height, imageInfo.IsDirectStream, org_Pn);
var contentFeatures = new ContentFeatureBuilder(_profile)
.BuildImageHeader(format, width, height, imageInfo.IsDirectStream, org_Pn);
writer.WriteAttributeString(
"protocolInfo",
@@ -1222,7 +1206,8 @@ namespace Emby.Dlna.Didl
if (width.HasValue && height.HasValue)
{
var newSize = DrawingUtils.Resize(new ImageDimensions(width.Value, height.Value), 0, 0, maxWidth, maxHeight);
var newSize = DrawingUtils.Resize(
new ImageDimensions(width.Value, height.Value), 0, 0, maxWidth, maxHeight);
width = newSize.Width;
height = newSize.Height;

View File

@@ -9,7 +9,7 @@ namespace Emby.Dlna.Didl
{
public class StringWriterWithEncoding : StringWriter
{
private readonly Encoding? _encoding;
private readonly Encoding _encoding;
public StringWriterWithEncoding()
{

View File

@@ -1,3 +1,4 @@
#nullable enable
#pragma warning disable CS1591
using System.Collections.Generic;

View File

@@ -1,4 +1,5 @@
#pragma warning disable CS1591
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -6,12 +7,10 @@ using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Text.Json;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Emby.Dlna.Profiles;
using Emby.Dlna.Server;
using Jellyfin.Extensions.Json;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller;
@@ -33,9 +32,9 @@ namespace Emby.Dlna
private readonly IXmlSerializer _xmlSerializer;
private readonly IFileSystem _fileSystem;
private readonly ILogger<DlnaManager> _logger;
private readonly IJsonSerializer _jsonSerializer;
private readonly IServerApplicationHost _appHost;
private static readonly Assembly _assembly = typeof(DlnaManager).Assembly;
private readonly JsonSerializerOptions _jsonOptions = JsonDefaults.Options;
private readonly Dictionary<string, Tuple<InternalProfileInfo, DeviceProfile>> _profiles = new Dictionary<string, Tuple<InternalProfileInfo, DeviceProfile>>(StringComparer.Ordinal);
@@ -44,12 +43,14 @@ namespace Emby.Dlna
IFileSystem fileSystem,
IApplicationPaths appPaths,
ILoggerFactory loggerFactory,
IJsonSerializer jsonSerializer,
IServerApplicationHost appHost)
{
_xmlSerializer = xmlSerializer;
_fileSystem = fileSystem;
_appPaths = appPaths;
_logger = loggerFactory.CreateLogger<DlnaManager>();
_jsonSerializer = jsonSerializer;
_appHost = appHost;
}
@@ -93,14 +94,12 @@ namespace Emby.Dlna
}
}
/// <inheritdoc />
public DeviceProfile GetDefaultProfile()
{
return new DefaultProfile();
}
/// <inheritdoc />
public DeviceProfile? GetProfile(DeviceIdentification deviceInfo)
public DeviceProfile GetProfile(DeviceIdentification deviceInfo)
{
if (deviceInfo == null)
{
@@ -110,13 +109,13 @@ namespace Emby.Dlna
var profile = GetProfiles()
.FirstOrDefault(i => i.Identification != null && IsMatch(deviceInfo, i.Identification));
if (profile == null)
if (profile != null)
{
LogUnmatchedProfile(deviceInfo);
_logger.LogDebug("Found matching device profile: {ProfileName}", profile.Name);
}
else
{
_logger.LogDebug("Found matching device profile: {ProfileName}", profile.Name);
LogUnmatchedProfile(deviceInfo);
}
return profile;
@@ -127,14 +126,14 @@ namespace Emby.Dlna
var builder = new StringBuilder();
builder.AppendLine("No matching device profile found. The default will need to be used.");
builder.Append("FriendlyName: ").AppendLine(profile.FriendlyName);
builder.Append("Manufacturer: ").AppendLine(profile.Manufacturer);
builder.Append("ManufacturerUrl: ").AppendLine(profile.ManufacturerUrl);
builder.Append("ModelDescription: ").AppendLine(profile.ModelDescription);
builder.Append("ModelName: ").AppendLine(profile.ModelName);
builder.Append("ModelNumber: ").AppendLine(profile.ModelNumber);
builder.Append("ModelUrl: ").AppendLine(profile.ModelUrl);
builder.Append("SerialNumber: ").AppendLine(profile.SerialNumber);
builder.Append("FriendlyName:").AppendLine(profile.FriendlyName);
builder.Append("Manufacturer:").AppendLine(profile.Manufacturer);
builder.Append("ManufacturerUrl:").AppendLine(profile.ManufacturerUrl);
builder.Append("ModelDescription:").AppendLine(profile.ModelDescription);
builder.Append("ModelName:").AppendLine(profile.ModelName);
builder.Append("ModelNumber:").AppendLine(profile.ModelNumber);
builder.Append("ModelUrl:").AppendLine(profile.ModelUrl);
builder.Append("SerialNumber:").AppendLine(profile.SerialNumber);
_logger.LogInformation(builder.ToString());
}
@@ -186,8 +185,7 @@ namespace Emby.Dlna
}
}
/// <inheritdoc />
public DeviceProfile? GetProfile(IHeaderDictionary headers)
public DeviceProfile GetProfile(IHeaderDictionary headers)
{
if (headers == null)
{
@@ -195,13 +193,15 @@ namespace Emby.Dlna
}
var profile = GetProfiles().FirstOrDefault(i => i.Identification != null && IsMatch(headers, i.Identification));
if (profile == null)
if (profile != null)
{
_logger.LogDebug("No matching device profile found. {@Headers}", headers);
_logger.LogDebug("Found matching device profile: {0}", profile.Name);
}
else
{
_logger.LogDebug("Found matching device profile: {0}", profile.Name);
var headerString = string.Join(", ", headers.Select(i => string.Format(CultureInfo.InvariantCulture, "{0}={1}", i.Key, i.Value)));
_logger.LogDebug("No matching device profile found. {0}", headerString);
}
return profile;
@@ -251,19 +251,19 @@ namespace Emby.Dlna
return xmlFies
.Select(i => ParseProfileFile(i, type))
.Where(i => i != null)
.ToList()!; // We just filtered out all the nulls
.ToList();
}
catch (IOException)
{
return Array.Empty<DeviceProfile>();
return new List<DeviceProfile>();
}
}
private DeviceProfile? ParseProfileFile(string path, DeviceProfileType type)
private DeviceProfile ParseProfileFile(string path, DeviceProfileType type)
{
lock (_profiles)
{
if (_profiles.TryGetValue(path, out Tuple<InternalProfileInfo, DeviceProfile>? profileTuple))
if (_profiles.TryGetValue(path, out Tuple<InternalProfileInfo, DeviceProfile> profileTuple))
{
return profileTuple.Item2;
}
@@ -291,8 +291,7 @@ namespace Emby.Dlna
}
}
/// <inheritdoc />
public DeviceProfile? GetProfile(string id)
public DeviceProfile GetProfile(string id)
{
if (string.IsNullOrEmpty(id))
{
@@ -321,7 +320,6 @@ namespace Emby.Dlna
}
}
/// <inheritdoc />
public IEnumerable<DeviceProfileInfo> GetProfileInfos()
{
return GetProfileInfosInternal().Select(i => i.Info);
@@ -329,14 +327,17 @@ namespace Emby.Dlna
private InternalProfileInfo GetInternalProfileInfo(FileSystemMetadata file, DeviceProfileType type)
{
return new InternalProfileInfo(
new DeviceProfileInfo
return new InternalProfileInfo
{
Path = file.FullName,
Info = new DeviceProfileInfo
{
Id = file.FullName.ToLowerInvariant().GetMD5().ToString("N", CultureInfo.InvariantCulture),
Name = _fileSystem.GetFileNameWithoutExtension(file),
Type = type
},
file.FullName);
}
};
}
private async Task ExtractSystemProfilesAsync()
@@ -356,8 +357,7 @@ namespace Emby.Dlna
systemProfilesPath,
Path.GetFileName(name.AsSpan()).Slice(namespaceName.Length));
// The stream should exist as we just got its name from GetManifestResourceNames
using (var stream = _assembly.GetManifestResourceStream(name)!)
using (var stream = _assembly.GetManifestResourceStream(name))
{
var fileInfo = _fileSystem.GetFileInfo(path);
@@ -378,7 +378,6 @@ namespace Emby.Dlna
Directory.CreateDirectory(UserProfilesPath);
}
/// <inheritdoc />
public void DeleteProfile(string id)
{
var info = GetProfileInfosInternal().First(i => string.Equals(id, i.Info.Id, StringComparison.OrdinalIgnoreCase));
@@ -396,7 +395,6 @@ namespace Emby.Dlna
}
}
/// <inheritdoc />
public void CreateProfile(DeviceProfile profile)
{
profile = ReserializeProfile(profile);
@@ -412,7 +410,6 @@ namespace Emby.Dlna
SaveProfile(profile, path, DeviceProfileType.User);
}
/// <inheritdoc />
public void UpdateProfile(DeviceProfile profile)
{
profile = ReserializeProfile(profile);
@@ -469,13 +466,11 @@ namespace Emby.Dlna
return profile;
}
var json = JsonSerializer.Serialize(profile, _jsonOptions);
var json = _jsonSerializer.SerializeToString(profile);
// Output can't be null if the input isn't null
return JsonSerializer.Deserialize<DeviceProfile>(json, _jsonOptions)!;
return _jsonSerializer.DeserializeFromString<DeviceProfile>(json);
}
/// <inheritdoc />
public string GetServerDescriptionXml(IHeaderDictionary headers, string serverUuId, string serverAddress)
{
var profile = GetDefaultProfile();
@@ -485,7 +480,6 @@ namespace Emby.Dlna
return new DescriptionXmlBuilder(profile, serverUuId, serverAddress, _appHost.FriendlyName, serverId).GetXml();
}
/// <inheritdoc />
public ImageStream GetIcon(string filename)
{
var format = filename.EndsWith(".png", StringComparison.OrdinalIgnoreCase)
@@ -503,15 +497,9 @@ namespace Emby.Dlna
private class InternalProfileInfo
{
internal InternalProfileInfo(DeviceProfileInfo info, string path)
{
Info = info;
Path = path;
}
internal DeviceProfileInfo Info { get; set; }
internal DeviceProfileInfo Info { get; }
internal string Path { get; }
internal string Path { get; set; }
}
}
@@ -536,7 +524,7 @@ namespace Emby.Dlna
private void DumpProfiles()
{
DeviceProfile[] list = new[]
DeviceProfile[] list = new []
{
new SamsungSmartTvProfile(),
new XboxOneProfile(),

View File

@@ -20,16 +20,21 @@
<TargetFramework>net5.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AnalysisMode>AllDisabledByDefault</AnalysisMode>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<!-- Code Analyzers-->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.8" PrivateAssets="All" />
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<CodeAnalysisRuleSet>../jellyfin.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="Images\logo120.jpg" />
<EmbeddedResource Include="Images\logo120.png" />
@@ -73,7 +78,9 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Http" Version="5.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
<PackageReference Include="Microsoft.AspNetCore.WebUtilities" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="3.1.6" />
</ItemGroup>
</Project>

View File

@@ -6,10 +6,8 @@ namespace Emby.Dlna
{
public class EventSubscriptionResponse
{
public EventSubscriptionResponse(string content, string contentType)
public EventSubscriptionResponse()
{
Content = content;
ContentType = contentType;
Headers = new Dictionary<string, string>();
}

View File

@@ -1,5 +1,3 @@
#nullable disable
#pragma warning disable CS1591
using System;
@@ -51,7 +49,11 @@ namespace Emby.Dlna.Eventing
return GetEventSubscriptionResponse(subscriptionId, requestedTimeoutString, timeoutSeconds);
}
return new EventSubscriptionResponse(string.Empty, "text/plain");
return new EventSubscriptionResponse
{
Content = string.Empty,
ContentType = "text/plain"
};
}
public EventSubscriptionResponse CreateEventSubscription(string notificationType, string requestedTimeoutString, string callbackUrl)
@@ -99,12 +101,20 @@ namespace Emby.Dlna.Eventing
_subscriptions.TryRemove(subscriptionId, out _);
return new EventSubscriptionResponse(string.Empty, "text/plain");
return new EventSubscriptionResponse
{
Content = string.Empty,
ContentType = "text/plain"
};
}
private EventSubscriptionResponse GetEventSubscriptionResponse(string subscriptionId, string requestedTimeoutString, int timeoutSeconds)
{
var response = new EventSubscriptionResponse(string.Empty, "text/plain");
var response = new EventSubscriptionResponse
{
Content = string.Empty,
ContentType = "text/plain"
};
response.Headers["SID"] = subscriptionId;
response.Headers["TIMEOUT"] = string.IsNullOrEmpty(requestedTimeoutString) ? ("SECOND-" + timeoutSeconds.ToString(_usCulture)) : requestedTimeoutString;

View File

@@ -1,5 +1,3 @@
#nullable disable
#pragma warning disable CS1591
using System;

View File

@@ -1,5 +1,3 @@
#nullable disable
#pragma warning disable CS1591
using System;
@@ -7,6 +5,7 @@ using System.Globalization;
using System.Linq;
using System.Net.Http;
using System.Net.Sockets;
using System.Threading;
using System.Threading.Tasks;
using Emby.Dlna.PlayTo;
using Emby.Dlna.Ssdp;
@@ -27,9 +26,11 @@ using MediaBrowser.Controller.TV;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.Net;
using MediaBrowser.Model.System;
using Microsoft.Extensions.Logging;
using Rssdp;
using Rssdp.Infrastructure;
using OperatingSystem = MediaBrowser.Common.System.OperatingSystem;
namespace Emby.Dlna.Main
{
@@ -202,8 +203,8 @@ namespace Emby.Dlna.Main
{
if (_communicationsServer == null)
{
var enableMultiSocketBinding = OperatingSystem.IsWindows() ||
OperatingSystem.IsLinux();
var enableMultiSocketBinding = OperatingSystem.Id == OperatingSystemId.Windows ||
OperatingSystem.Id == OperatingSystemId.Linux;
_communicationsServer = new SsdpCommunicationsServer(_socketFactory, _networkManager, _logger, enableMultiSocketBinding)
{
@@ -266,12 +267,7 @@ namespace Emby.Dlna.Main
try
{
_publisher = new SsdpDevicePublisher(
_communicationsServer,
_networkManager,
MediaBrowser.Common.System.OperatingSystem.Name,
Environment.OSVersion.VersionString,
_config.GetDlnaConfiguration().SendOnlyMatchedHost)
_publisher = new SsdpDevicePublisher(_communicationsServer, _networkManager, OperatingSystem.Name, Environment.OSVersion.VersionString, _config.GetDlnaConfiguration().SendOnlyMatchedHost)
{
LogFunction = LogMessage,
SupportPnpRootDevice = false

View File

@@ -24,7 +24,7 @@ namespace Emby.Dlna.MediaReceiverRegistrar
}
/// <inheritdoc />
protected override void WriteResult(string methodName, IReadOnlyDictionary<string, string> methodParams, XmlWriter xmlWriter)
protected override void WriteResult(string methodName, IDictionary<string, string> methodParams, XmlWriter xmlWriter)
{
if (string.Equals(methodName, "IsAuthorized", StringComparison.OrdinalIgnoreCase))
{

View File

@@ -1,6 +1,7 @@
using System.Collections.Generic;
using Emby.Dlna.Common;
using Emby.Dlna.Service;
using MediaBrowser.Model.Dlna;
namespace Emby.Dlna.MediaReceiverRegistrar
{

View File

@@ -1,5 +1,3 @@
#nullable disable
#pragma warning disable CS1591
using System;
@@ -237,13 +235,7 @@ namespace Emby.Dlna.PlayTo
_logger.LogDebug("Setting mute");
var value = mute ? 1 : 0;
await new SsdpHttpClient(_httpClientFactory)
.SendCommandAsync(
Properties.BaseUrl,
service,
command.Name,
rendererCommands.BuildPost(command, service.ServiceType, value),
cancellationToken: cancellationToken)
await new SsdpHttpClient(_httpClientFactory).SendCommandAsync(Properties.BaseUrl, service, command.Name, rendererCommands.BuildPost(command, service.ServiceType, value))
.ConfigureAwait(false);
IsMuted = mute;
@@ -278,13 +270,7 @@ namespace Emby.Dlna.PlayTo
// Remote control will perform better
Volume = value;
await new SsdpHttpClient(_httpClientFactory)
.SendCommandAsync(
Properties.BaseUrl,
service,
command.Name,
rendererCommands.BuildPost(command, service.ServiceType, value),
cancellationToken: cancellationToken)
await new SsdpHttpClient(_httpClientFactory).SendCommandAsync(Properties.BaseUrl, service, command.Name, rendererCommands.BuildPost(command, service.ServiceType, value))
.ConfigureAwait(false);
}
@@ -305,13 +291,7 @@ namespace Emby.Dlna.PlayTo
throw new InvalidOperationException("Unable to find service");
}
await new SsdpHttpClient(_httpClientFactory)
.SendCommandAsync(
Properties.BaseUrl,
service,
command.Name,
avCommands.BuildPost(command, service.ServiceType, string.Format(CultureInfo.InvariantCulture, "{0:hh}:{0:mm}:{0:ss}", value), "REL_TIME"),
cancellationToken: cancellationToken)
await new SsdpHttpClient(_httpClientFactory).SendCommandAsync(Properties.BaseUrl, service, command.Name, avCommands.BuildPost(command, service.ServiceType, string.Format(CultureInfo.InvariantCulture, "{0:hh}:{0:mm}:{0:ss}", value), "REL_TIME"))
.ConfigureAwait(false);
RestartTimer(true);
@@ -345,21 +325,14 @@ namespace Emby.Dlna.PlayTo
}
var post = avCommands.BuildPost(command, service.ServiceType, url, dictionary);
await new SsdpHttpClient(_httpClientFactory)
.SendCommandAsync(
Properties.BaseUrl,
service,
command.Name,
post,
header: header,
cancellationToken: cancellationToken)
await new SsdpHttpClient(_httpClientFactory).SendCommandAsync(Properties.BaseUrl, service, command.Name, post, header: header)
.ConfigureAwait(false);
await Task.Delay(50, cancellationToken).ConfigureAwait(false);
await Task.Delay(50).ConfigureAwait(false);
try
{
await SetPlay(avCommands, cancellationToken).ConfigureAwait(false);
await SetPlay(avCommands, CancellationToken.None).ConfigureAwait(false);
}
catch
{
@@ -370,42 +343,6 @@ namespace Emby.Dlna.PlayTo
RestartTimer(true);
}
/*
* SetNextAvTransport is used to specify to the DLNA device what is the next track to play.
* Without that information, the next track command on the device does not work.
*/
public async Task SetNextAvTransport(string url, string header, string metaData, CancellationToken cancellationToken = default)
{
var avCommands = await GetAVProtocolAsync(cancellationToken).ConfigureAwait(false);
url = url.Replace("&", "&amp;", StringComparison.Ordinal);
_logger.LogDebug("{PropertyName} - SetNextAvTransport Uri: {Url} DlnaHeaders: {Header}", Properties.Name, url, header);
var command = avCommands.ServiceActions.FirstOrDefault(c => string.Equals(c.Name, "SetNextAVTransportURI", StringComparison.OrdinalIgnoreCase));
if (command == null)
{
return;
}
var dictionary = new Dictionary<string, string>
{
{ "NextURI", url },
{ "NextURIMetaData", CreateDidlMeta(metaData) }
};
var service = GetAvTransportService();
if (service == null)
{
throw new InvalidOperationException("Unable to find service");
}
var post = avCommands.BuildPost(command, service.ServiceType, url, dictionary);
await new SsdpHttpClient(_httpClientFactory).SendCommandAsync(Properties.BaseUrl, service, command.Name, post, header: header, cancellationToken)
.ConfigureAwait(false);
}
private static string CreateDidlMeta(string value)
{
if (string.IsNullOrEmpty(value))
@@ -463,13 +400,7 @@ namespace Emby.Dlna.PlayTo
var service = GetAvTransportService();
await new SsdpHttpClient(_httpClientFactory)
.SendCommandAsync(
Properties.BaseUrl,
service,
command.Name,
avCommands.BuildPost(command, service.ServiceType, 1),
cancellationToken: cancellationToken)
await new SsdpHttpClient(_httpClientFactory).SendCommandAsync(Properties.BaseUrl, service, command.Name, avCommands.BuildPost(command, service.ServiceType, 1))
.ConfigureAwait(false);
RestartTimer(true);
@@ -487,13 +418,7 @@ namespace Emby.Dlna.PlayTo
var service = GetAvTransportService();
await new SsdpHttpClient(_httpClientFactory)
.SendCommandAsync(
Properties.BaseUrl,
service,
command.Name,
avCommands.BuildPost(command, service.ServiceType, 1),
cancellationToken: cancellationToken)
await new SsdpHttpClient(_httpClientFactory).SendCommandAsync(Properties.BaseUrl, service, command.Name, avCommands.BuildPost(command, service.ServiceType, 1))
.ConfigureAwait(false);
TransportState = TransportState.Paused;
@@ -1090,7 +1015,7 @@ namespace Emby.Dlna.PlayTo
var deviceProperties = new DeviceInfo()
{
Name = string.Join(' ', friendlyNames),
Name = string.Join(" ", friendlyNames),
BaseUrl = string.Format(CultureInfo.InvariantCulture, "http://{0}:{1}", url.Host, url.Port)
};
@@ -1260,7 +1185,10 @@ namespace Emby.Dlna.PlayTo
return;
}
PlaybackStart?.Invoke(this, new PlaybackStartEventArgs(mediaInfo));
PlaybackStart?.Invoke(this, new PlaybackStartEventArgs
{
MediaInfo = mediaInfo
});
}
private void OnPlaybackProgress(UBaseObject mediaInfo)
@@ -1270,17 +1198,27 @@ namespace Emby.Dlna.PlayTo
return;
}
PlaybackProgress?.Invoke(this, new PlaybackProgressEventArgs(mediaInfo));
PlaybackProgress?.Invoke(this, new PlaybackProgressEventArgs
{
MediaInfo = mediaInfo
});
}
private void OnPlaybackStop(UBaseObject mediaInfo)
{
PlaybackStopped?.Invoke(this, new PlaybackStoppedEventArgs(mediaInfo));
PlaybackStopped?.Invoke(this, new PlaybackStoppedEventArgs
{
MediaInfo = mediaInfo
});
}
private void OnMediaChanged(UBaseObject old, UBaseObject newMedia)
{
MediaChanged?.Invoke(this, new MediaChangedEventArgs(old, newMedia));
MediaChanged?.Invoke(this, new MediaChangedEventArgs
{
OldMediaInfo = old,
NewMediaInfo = newMedia
});
}
/// <inheritdoc />

View File

@@ -1,5 +1,3 @@
#nullable disable
#pragma warning disable CS1591
using System.Collections.Generic;

View File

@@ -1,4 +1,4 @@
#pragma warning disable CS1591
#pragma warning disable CS1591
using System;
@@ -6,12 +6,6 @@ namespace Emby.Dlna.PlayTo
{
public class MediaChangedEventArgs : EventArgs
{
public MediaChangedEventArgs(UBaseObject oldMediaInfo, UBaseObject newMediaInfo)
{
OldMediaInfo = oldMediaInfo;
NewMediaInfo = newMediaInfo;
}
public UBaseObject OldMediaInfo { get; set; }
public UBaseObject NewMediaInfo { get; set; }

View File

@@ -1,5 +1,3 @@
#nullable disable
#pragma warning disable CS1591
using System;
@@ -104,22 +102,6 @@ namespace Emby.Dlna.PlayTo
_deviceDiscovery.DeviceLeft += OnDeviceDiscoveryDeviceLeft;
}
/*
* Send a message to the DLNA device to notify what is the next track in the playlist.
*/
private async Task SendNextTrackMessage(int currentPlayListItemIndex, CancellationToken cancellationToken)
{
if (currentPlayListItemIndex >= 0 && currentPlayListItemIndex < _playlist.Count - 1)
{
// The current playing item is indeed in the play list and we are not yet at the end of the playlist.
var nextItemIndex = currentPlayListItemIndex + 1;
var nextItem = _playlist[nextItemIndex];
// Send the SetNextAvTransport message.
await _device.SetNextAvTransport(nextItem.StreamUrl, GetDlnaHeaders(nextItem), nextItem.Didl, cancellationToken).ConfigureAwait(false);
}
}
private void OnDeviceUnavailable()
{
try
@@ -174,15 +156,6 @@ namespace Emby.Dlna.PlayTo
var newItemProgress = GetProgressInfo(streamInfo);
await _sessionManager.OnPlaybackStart(newItemProgress).ConfigureAwait(false);
// Send a message to the DLNA device to notify what is the next track in the playlist.
var currentItemIndex = _playlist.FindIndex(item => item.StreamInfo.ItemId == streamInfo.ItemId);
if (currentItemIndex >= 0)
{
_currentPlaylistIndex = currentItemIndex;
}
await SendNextTrackMessage(currentItemIndex, CancellationToken.None);
}
catch (Exception ex)
{
@@ -452,11 +425,6 @@ namespace Emby.Dlna.PlayTo
var newItem = CreatePlaylistItem(info.Item, user, newPosition, info.MediaSourceId, info.AudioStreamIndex, info.SubtitleStreamIndex);
await _device.SetAvTransport(newItem.StreamUrl, GetDlnaHeaders(newItem), newItem.Didl, CancellationToken.None).ConfigureAwait(false);
// Send a message to the DLNA device to notify what is the next track in the play list.
var newItemIndex = _playlist.FindIndex(item => item.StreamUrl == newItem.StreamUrl);
await SendNextTrackMessage(newItemIndex, CancellationToken.None);
return;
}
@@ -531,8 +499,8 @@ namespace Emby.Dlna.PlayTo
if (streamInfo.MediaType == DlnaProfileType.Audio)
{
return ContentFeatureBuilder.BuildAudioHeader(
profile,
return new ContentFeatureBuilder(profile)
.BuildAudioHeader(
streamInfo.Container,
streamInfo.TargetAudioCodec.FirstOrDefault(),
streamInfo.TargetAudioBitrate,
@@ -546,8 +514,8 @@ namespace Emby.Dlna.PlayTo
if (streamInfo.MediaType == DlnaProfileType.Video)
{
var list = ContentFeatureBuilder.BuildVideoHeader(
profile,
var list = new ContentFeatureBuilder(profile)
.BuildVideoHeader(
streamInfo.Container,
streamInfo.TargetVideoCodec.FirstOrDefault(),
streamInfo.TargetAudioCodec.FirstOrDefault(),
@@ -655,9 +623,6 @@ namespace Emby.Dlna.PlayTo
await _device.SetAvTransport(currentitem.StreamUrl, GetDlnaHeaders(currentitem), currentitem.Didl, cancellationToken).ConfigureAwait(false);
// Send a message to the DLNA device to notify what is the next track in the play list.
await SendNextTrackMessage(index, cancellationToken);
var streamInfo = currentitem.StreamInfo;
if (streamInfo.StartPositionTicks > 0 && EnableClientSideSeek(streamInfo))
{
@@ -771,10 +736,6 @@ namespace Emby.Dlna.PlayTo
await _device.SetAvTransport(newItem.StreamUrl, GetDlnaHeaders(newItem), newItem.Didl, CancellationToken.None).ConfigureAwait(false);
// Send a message to the DLNA device to notify what is the next track in the play list.
var newItemIndex = _playlist.FindIndex(item => item.StreamUrl == newItem.StreamUrl);
await SendNextTrackMessage(newItemIndex, CancellationToken.None);
if (EnableClientSideSeek(newItem.StreamInfo))
{
await SeekAfterTransportChange(newPosition, CancellationToken.None).ConfigureAwait(false);
@@ -800,10 +761,6 @@ namespace Emby.Dlna.PlayTo
await _device.SetAvTransport(newItem.StreamUrl, GetDlnaHeaders(newItem), newItem.Didl, CancellationToken.None).ConfigureAwait(false);
// Send a message to the DLNA device to notify what is the next track in the play list.
var newItemIndex = _playlist.FindIndex(item => item.StreamUrl == newItem.StreamUrl);
await SendNextTrackMessage(newItemIndex, CancellationToken.None);
if (EnableClientSideSeek(newItem.StreamInfo) && newPosition > 0)
{
await SeekAfterTransportChange(newPosition, CancellationToken.None).ConfigureAwait(false);
@@ -820,7 +777,7 @@ namespace Emby.Dlna.PlayTo
var currentWait = 0;
while (_device.TransportState != TransportState.Playing && currentWait < MaxWait)
{
await Task.Delay(Interval, cancellationToken).ConfigureAwait(false);
await Task.Delay(Interval).ConfigureAwait(false);
currentWait += Interval;
}

View File

@@ -1,5 +1,3 @@
#nullable disable
#pragma warning disable CS1591
using System;

View File

@@ -6,11 +6,6 @@ namespace Emby.Dlna.PlayTo
{
public class PlaybackProgressEventArgs : EventArgs
{
public PlaybackProgressEventArgs(UBaseObject mediaInfo)
{
MediaInfo = mediaInfo;
}
public UBaseObject MediaInfo { get; set; }
}
}

View File

@@ -6,11 +6,6 @@ namespace Emby.Dlna.PlayTo
{
public class PlaybackStartEventArgs : EventArgs
{
public PlaybackStartEventArgs(UBaseObject mediaInfo)
{
MediaInfo = mediaInfo;
}
public UBaseObject MediaInfo { get; set; }
}
}

View File

@@ -6,11 +6,6 @@ namespace Emby.Dlna.PlayTo
{
public class PlaybackStoppedEventArgs : EventArgs
{
public PlaybackStoppedEventArgs(UBaseObject mediaInfo)
{
MediaInfo = mediaInfo;
}
public UBaseObject MediaInfo { get; set; }
}
}

View File

@@ -1,5 +1,3 @@
#nullable disable
#pragma warning disable CS1591
using MediaBrowser.Model.Dlna;

View File

@@ -1,5 +1,3 @@
#nullable disable
#pragma warning disable CS1591
using System.IO;

View File

@@ -1,9 +1,8 @@
#nullable disable
#pragma warning disable CS1591
using System;
using System.Globalization;
using System.IO;
using System.Net.Http;
using System.Net.Mime;
using System.Text;

View File

@@ -46,7 +46,7 @@ namespace Emby.Dlna.PlayTo
{
var serviceAction = new ServiceAction
{
Name = container.GetValue(UPnpNamespaces.Svc + "name") ?? string.Empty,
Name = container.GetValue(UPnpNamespaces.Svc + "name"),
};
var argumentList = serviceAction.ArgumentList;
@@ -68,9 +68,9 @@ namespace Emby.Dlna.PlayTo
return new Argument
{
Name = container.GetValue(UPnpNamespaces.Svc + "name") ?? string.Empty,
Direction = container.GetValue(UPnpNamespaces.Svc + "direction") ?? string.Empty,
RelatedStateVariable = container.GetValue(UPnpNamespaces.Svc + "relatedStateVariable") ?? string.Empty
Name = container.GetValue(UPnpNamespaces.Svc + "name"),
Direction = container.GetValue(UPnpNamespaces.Svc + "direction"),
RelatedStateVariable = container.GetValue(UPnpNamespaces.Svc + "relatedStateVariable")
};
}
@@ -89,8 +89,8 @@ namespace Emby.Dlna.PlayTo
return new StateVariable
{
Name = container.GetValue(UPnpNamespaces.Svc + "name") ?? string.Empty,
DataType = container.GetValue(UPnpNamespaces.Svc + "dataType") ?? string.Empty,
Name = container.GetValue(UPnpNamespaces.Svc + "name"),
DataType = container.GetValue(UPnpNamespaces.Svc + "dataType"),
AllowedValues = allowedValues
};
}
@@ -166,7 +166,7 @@ namespace Emby.Dlna.PlayTo
return string.Format(CultureInfo.InvariantCulture, CommandBase, action.Name, xmlNamesapce, stateString);
}
private string BuildArgumentXml(Argument argument, string? value, string commandParameter = "")
private string BuildArgumentXml(Argument argument, string value, string commandParameter = "")
{
var state = StateVariables.FirstOrDefault(a => string.Equals(a.Name, argument.RelatedStateVariable, StringComparison.OrdinalIgnoreCase));

View File

@@ -1,4 +1,5 @@
#pragma warning disable CS1591
#pragma warning disable SA1602
namespace Emby.Dlna.PlayTo
{

View File

@@ -1,5 +1,3 @@
#nullable disable
#pragma warning disable CS1591
using System;

View File

@@ -13,7 +13,7 @@ namespace Emby.Dlna.Profiles
Identification = new DeviceIdentification
{
FriendlyName = @"KDL-[0-9]{2}[EHLNPB]X[0-9][01][0-9].*",
FriendlyName = @"KDL-\d{2}[EHLNPB]X\d[01]\d.*",
Manufacturer = "Sony",
Headers = new[]
@@ -21,7 +21,7 @@ namespace Emby.Dlna.Profiles
new HttpHeaderInfo
{
Name = "X-AV-Client-Info",
Value = @".*KDL-[0-9]{2}[EHLNPB]X[0-9][01][0-9].*",
Value = @".*KDL-\d{2}[EHLNPB]X\d[01]\d.*",
Match = HeaderMatchType.Regex
}
}

View File

@@ -13,7 +13,7 @@ namespace Emby.Dlna.Profiles
Identification = new DeviceIdentification
{
FriendlyName = @"KDL-[0-9]{2}([A-Z]X[0-9]2[0-9]|CX400).*",
FriendlyName = @"KDL-\d{2}([A-Z]X\d2\d|CX400).*",
Manufacturer = "Sony",
Headers = new[]
@@ -21,7 +21,7 @@ namespace Emby.Dlna.Profiles
new HttpHeaderInfo
{
Name = "X-AV-Client-Info",
Value = @".*KDL-[0-9]{2}([A-Z]X[0-9]2[0-9]|CX400).*",
Value = @".*KDL-\d{2}([A-Z]X\d2\d|CX400).*",
Match = HeaderMatchType.Regex
}
}

View File

@@ -13,7 +13,7 @@ namespace Emby.Dlna.Profiles
Identification = new DeviceIdentification
{
FriendlyName = @"KDL-[0-9]{2}[A-Z]X[0-9]5([0-9]|G).*",
FriendlyName = @"KDL-\d{2}[A-Z]X\d5(\d|G).*",
Manufacturer = "Sony",
Headers = new[]
@@ -21,7 +21,7 @@ namespace Emby.Dlna.Profiles
new HttpHeaderInfo
{
Name = "X-AV-Client-Info",
Value = @".*KDL-[0-9]{2}[A-Z]X[0-9]5([0-9]|G).*",
Value = @".*KDL-\d{2}[A-Z]X\d5(\d|G).*",
Match = HeaderMatchType.Regex
}
}

View File

@@ -13,7 +13,7 @@ namespace Emby.Dlna.Profiles
Identification = new DeviceIdentification
{
FriendlyName = @"KDL-[0-9]{2}[WR][5689][0-9]{2}A.*",
FriendlyName = @"KDL-\d{2}[WR][5689]\d{2}A.*",
Manufacturer = "Sony",
Headers = new[]
@@ -21,7 +21,7 @@ namespace Emby.Dlna.Profiles
new HttpHeaderInfo
{
Name = "X-AV-Client-Info",
Value = @".*KDL-[0-9]{2}[WR][5689][0-9]{2}A.*",
Value = @".*KDL-\d{2}[WR][5689]\d{2}A.*",
Match = HeaderMatchType.Regex
}
}

View File

@@ -13,7 +13,7 @@ namespace Emby.Dlna.Profiles
Identification = new DeviceIdentification
{
FriendlyName = @"(KDL-[0-9]{2}W[5-9][0-9]{2}B|KDL-[0-9]{2}R480|XBR-[0-9]{2}X[89][0-9]{2}B|KD-[0-9]{2}[SX][89][0-9]{3}B).*",
FriendlyName = @"(KDL-\d{2}W[5-9]\d{2}B|KDL-\d{2}R480|XBR-\d{2}X[89]\d{2}B|KD-\d{2}[SX][89]\d{3}B).*",
Manufacturer = "Sony",
Headers = new[]
@@ -21,7 +21,7 @@ namespace Emby.Dlna.Profiles
new HttpHeaderInfo
{
Name = "X-AV-Client-Info",
Value = @".*(KDL-[0-9]{2}W[5-9][0-9]{2}B|KDL-[0-9]{2}R480|XBR-[0-9]{2}X[89][0-9]{2}B|KD-[0-9]{2}[SX][89][0-9]{3}B).*",
Value = @".*(KDL-\d{2}W[5-9]\d{2}B|KDL-\d{2}R480|XBR-\d{2}X[89]\d{2}B|KD-\d{2}[SX][89]\d{3}B).*",
Match = HeaderMatchType.Regex
}
}

View File

@@ -3,10 +3,10 @@
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Name>Sony Bravia (2010)</Name>
<Identification>
<FriendlyName>KDL-[0-9]{2}[EHLNPB]X[0-9][01][0-9].*</FriendlyName>
<FriendlyName>KDL-\d{2}[EHLNPB]X\d[01]\d.*</FriendlyName>
<Manufacturer>Sony</Manufacturer>
<Headers>
<HttpHeaderInfo name="X-AV-Client-Info" value=".*KDL-[0-9]{2}[EHLNPB]X[0-9][01][0-9].*" match="Regex" />
<HttpHeaderInfo name="X-AV-Client-Info" value=".*KDL-\d{2}[EHLNPB]X\d[01]\d.*" match="Regex" />
</Headers>
</Identification>
<Manufacturer>Microsoft Corporation</Manufacturer>

View File

@@ -3,10 +3,10 @@
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Name>Sony Bravia (2011)</Name>
<Identification>
<FriendlyName>KDL-[0-9]{2}([A-Z]X[0-9]2[0-9]|CX400).*</FriendlyName>
<FriendlyName>KDL-\d{2}([A-Z]X\d2\d|CX400).*</FriendlyName>
<Manufacturer>Sony</Manufacturer>
<Headers>
<HttpHeaderInfo name="X-AV-Client-Info" value=".*KDL-[0-9]{2}([A-Z]X[0-9]2[0-9]|CX400).*" match="Regex" />
<HttpHeaderInfo name="X-AV-Client-Info" value=".*KDL-\d{2}([A-Z]X\d2\d|CX400).*" match="Regex" />
</Headers>
</Identification>
<Manufacturer>Microsoft Corporation</Manufacturer>

View File

@@ -3,10 +3,10 @@
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Name>Sony Bravia (2012)</Name>
<Identification>
<FriendlyName>KDL-[0-9]{2}[A-Z]X[0-9]5([0-9]|G).*</FriendlyName>
<FriendlyName>KDL-\d{2}[A-Z]X\d5(\d|G).*</FriendlyName>
<Manufacturer>Sony</Manufacturer>
<Headers>
<HttpHeaderInfo name="X-AV-Client-Info" value=".*KDL-[0-9]{2}[A-Z]X[0-9]5([0-9]|G).*" match="Regex" />
<HttpHeaderInfo name="X-AV-Client-Info" value=".*KDL-\d{2}[A-Z]X\d5(\d|G).*" match="Regex" />
</Headers>
</Identification>
<Manufacturer>Microsoft Corporation</Manufacturer>

View File

@@ -3,10 +3,10 @@
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Name>Sony Bravia (2013)</Name>
<Identification>
<FriendlyName>KDL-[0-9]{2}[WR][5689][0-9]{2}A.*</FriendlyName>
<FriendlyName>KDL-\d{2}[WR][5689]\d{2}A.*</FriendlyName>
<Manufacturer>Sony</Manufacturer>
<Headers>
<HttpHeaderInfo name="X-AV-Client-Info" value=".*KDL-[0-9]{2}[WR][5689][0-9]{2}A.*" match="Regex" />
<HttpHeaderInfo name="X-AV-Client-Info" value=".*KDL-\d{2}[WR][5689]\d{2}A.*" match="Regex" />
</Headers>
</Identification>
<Manufacturer>Microsoft Corporation</Manufacturer>

View File

@@ -3,10 +3,10 @@
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Name>Sony Bravia (2014)</Name>
<Identification>
<FriendlyName>(KDL-[0-9]{2}W[5-9][0-9]{2}B|KDL-[0-9]{2}R480|XBR-[0-9]{2}X[89][0-9]{2}B|KD-[0-9]{2}[SX][89][0-9]{3}B).*</FriendlyName>
<FriendlyName>(KDL-\d{2}W[5-9]\d{2}B|KDL-\d{2}R480|XBR-\d{2}X[89]\d{2}B|KD-\d{2}[SX][89]\d{3}B).*</FriendlyName>
<Manufacturer>Sony</Manufacturer>
<Headers>
<HttpHeaderInfo name="X-AV-Client-Info" value=".*(KDL-[0-9]{2}W[5-9][0-9]{2}B|KDL-[0-9]{2}R480|XBR-[0-9]{2}X[89][0-9]{2}B|KD-[0-9]{2}[SX][89][0-9]{3}B).*" match="Regex" />
<HttpHeaderInfo name="X-AV-Client-Info" value=".*(KDL-\d{2}W[5-9]\d{2}B|KDL-\d{2}R480|XBR-\d{2}X[89]\d{2}B|KD-\d{2}[SX][89]\d{3}B).*" match="Regex" />
</Headers>
</Identification>
<Manufacturer>Microsoft Corporation</Manufacturer>

View File

@@ -250,8 +250,7 @@ namespace Emby.Dlna.Server
url = _serverAddress.TrimEnd('/') + "/dlna/" + _serverUdn + "/" + url.TrimStart('/');
// TODO: @bond remove null-coalescing operator when https://github.com/dotnet/runtime/pull/52442 is merged/released
return SecurityElement.Escape(url) ?? string.Empty;
return SecurityElement.Escape(url);
}
private IEnumerable<DeviceIcon> GetIcons()

View File

@@ -6,9 +6,9 @@ using System.IO;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using Diacritics.Extensions;
using Emby.Dlna.Didl;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Extensions;
using Microsoft.Extensions.Logging;
namespace Emby.Dlna.Service
@@ -47,9 +47,9 @@ namespace Emby.Dlna.Service
private async Task<ControlResponse> ProcessControlRequestInternalAsync(ControlRequest request)
{
ControlRequestInfo? requestInfo = null;
ControlRequestInfo requestInfo = null;
using (var streamReader = new StreamReader(request.InputXml, Encoding.UTF8))
using (var streamReader = new StreamReader(request.InputXml))
{
var readerSettings = new XmlReaderSettings()
{
@@ -95,7 +95,11 @@ namespace Emby.Dlna.Service
var xml = builder.ToString().Replace("xmlns:m=", "xmlns:u=", StringComparison.Ordinal);
var controlResponse = new ControlResponse(xml, true);
var controlResponse = new ControlResponse
{
Xml = xml,
IsSuccessful = true
};
controlResponse.Headers.Add("EXT", string.Empty);
@@ -147,7 +151,7 @@ namespace Emby.Dlna.Service
private async Task<ControlRequestInfo> ParseBodyTagAsync(XmlReader reader)
{
string? namespaceURI = null, localName = null;
string namespaceURI = null, localName = null;
await reader.MoveToContentAsync().ConfigureAwait(false);
await reader.ReadAsync().ConfigureAwait(false);
@@ -206,7 +210,7 @@ namespace Emby.Dlna.Service
}
}
protected abstract void WriteResult(string methodName, IReadOnlyDictionary<string, string> methodParams, XmlWriter xmlWriter);
protected abstract void WriteResult(string methodName, IDictionary<string, string> methodParams, XmlWriter xmlWriter);
private void LogRequest(ControlRequest request)
{

View File

@@ -46,7 +46,11 @@ namespace Emby.Dlna.Service
writer.WriteEndDocument();
}
return new ControlResponse(builder.ToString(), false);
return new ControlResponse
{
Xml = builder.ToString(),
IsSuccessful = false
};
}
}
}

View File

@@ -1,5 +1,3 @@
#nullable disable
#pragma warning disable CS1591
using System;

View File

@@ -7,21 +7,21 @@ namespace Emby.Dlna.Ssdp
{
public static class SsdpExtensions
{
public static string? GetValue(this XElement container, XName name)
public static string GetValue(this XElement container, XName name)
{
var node = container.Element(name);
return node?.Value;
}
public static string? GetAttributeValue(this XElement container, XName name)
public static string GetAttributeValue(this XElement container, XName name)
{
var node = container.Attribute(name);
return node?.Value;
}
public static string? GetDescendantValue(this XElement container, XName name)
public static string GetDescendantValue(this XElement container, XName name)
=> container.Descendants(name).FirstOrDefault()?.Value;
}
}

View File

@@ -9,7 +9,8 @@
<TargetFramework>net5.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AnalysisMode>AllDisabledByDefault</AnalysisMode>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
@@ -24,9 +25,14 @@
<!-- Code analysers-->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.8" PrivateAssets="All" />
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<CodeAnalysisRuleSet>../jellyfin.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
</Project>

View File

@@ -197,6 +197,11 @@ namespace Emby.Drawing
{
if (!File.Exists(cacheFilePath))
{
if (options.CropWhiteSpace && !SupportsTransparency(originalImagePath))
{
options.CropWhiteSpace = false;
}
string resultPath = _imageEncoder.EncodeImage(originalImagePath, dateModified, cacheFilePath, autoOrient, orientation, quality, options, outputFormat);
if (string.Equals(resultPath, originalImagePath, StringComparison.OrdinalIgnoreCase))
@@ -426,13 +431,8 @@ namespace Emby.Drawing
}
/// <inheritdoc />
public string? GetImageCacheTag(User user)
public string GetImageCacheTag(User user)
{
if (user.ProfileImage == null)
{
return null;
}
return (user.ProfileImage.Path + user.ProfileImage.LastModified.Ticks).GetMD5()
.ToString("N", CultureInfo.InvariantCulture);
}

View File

@@ -32,7 +32,7 @@ namespace Emby.Drawing
=> throw new NotImplementedException();
/// <inheritdoc />
public string EncodeImage(string inputPath, DateTime dateModified, string outputPath, bool autoOrient, ImageOrientation? orientation, int quality, ImageProcessingOptions options, ImageFormat outputFormat)
public string EncodeImage(string inputPath, DateTime dateModified, string outputPath, bool autoOrient, ImageOrientation? orientation, int quality, ImageProcessingOptions options, ImageFormat selectedOutputFormat)
{
throw new NotImplementedException();
}

View File

@@ -1,7 +1,7 @@
using System;
using System.IO;
using System.Linq;
using Emby.Naming.Common;
using Jellyfin.Extensions;
namespace Emby.Naming.Audio
{
@@ -18,8 +18,8 @@ namespace Emby.Naming.Audio
/// <returns>True if file at path is audio file.</returns>
public static bool IsAudioFile(string path, NamingOptions options)
{
var extension = Path.GetExtension(path.AsSpan());
return options.AudioFileExtensions.Contains(extension, StringComparison.OrdinalIgnoreCase);
var extension = Path.GetExtension(path);
return options.AudioFileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase);
}
}
}

View File

@@ -15,13 +15,13 @@ namespace Emby.Naming.AudioBook
/// <param name="files">List of files composing the actual audiobook.</param>
/// <param name="extras">List of extra files.</param>
/// <param name="alternateVersions">Alternative version of files.</param>
public AudioBookInfo(string name, int? year, IReadOnlyList<AudioBookFileInfo> files, IReadOnlyList<AudioBookFileInfo> extras, IReadOnlyList<AudioBookFileInfo> alternateVersions)
public AudioBookInfo(string name, int? year, List<AudioBookFileInfo>? files, List<AudioBookFileInfo>? extras, List<AudioBookFileInfo>? alternateVersions)
{
Name = name;
Year = year;
Files = files;
Extras = extras;
AlternateVersions = alternateVersions;
Files = files ?? new List<AudioBookFileInfo>();
Extras = extras ?? new List<AudioBookFileInfo>();
AlternateVersions = alternateVersions ?? new List<AudioBookFileInfo>();
}
/// <summary>
@@ -39,18 +39,18 @@ namespace Emby.Naming.AudioBook
/// Gets or sets the files.
/// </summary>
/// <value>The files.</value>
public IReadOnlyList<AudioBookFileInfo> Files { get; set; }
public List<AudioBookFileInfo> Files { get; set; }
/// <summary>
/// Gets or sets the extras.
/// </summary>
/// <value>The extras.</value>
public IReadOnlyList<AudioBookFileInfo> Extras { get; set; }
public List<AudioBookFileInfo> Extras { get; set; }
/// <summary>
/// Gets or sets the alternate versions.
/// </summary>
/// <value>The alternate versions.</value>
public IReadOnlyList<AudioBookFileInfo> AlternateVersions { get; set; }
public List<AudioBookFileInfo> AlternateVersions { get; set; }
}
}

View File

@@ -73,7 +73,7 @@ namespace Emby.Naming.AudioBook
var haveChaptersOrPages = stackFiles.Any(x => x.ChapterNumber != null || x.PartNumber != null);
var groupedBy = stackFiles.GroupBy(file => new { file.ChapterNumber, file.PartNumber });
var nameWithReplacedDots = nameParserResult.Name.Replace(' ', '.');
var nameWithReplacedDots = nameParserResult.Name.Replace(" ", ".");
foreach (var group in groupedBy)
{
@@ -87,7 +87,7 @@ namespace Emby.Naming.AudioBook
foreach (var audioFile in group)
{
var name = Path.GetFileNameWithoutExtension(audioFile.Path);
if (name.Equals("audiobook", StringComparison.OrdinalIgnoreCase) ||
if (name.Equals("audiobook") ||
name.Contains(nameParserResult.Name, StringComparison.OrdinalIgnoreCase) ||
name.Contains(nameWithReplacedDots, StringComparison.OrdinalIgnoreCase))
{

View File

@@ -137,7 +137,7 @@ namespace Emby.Naming.Common
CleanStrings = new[]
{
@"[ _\,\.\(\)\[\]\-](3d|sbs|tab|hsbs|htab|mvc|HDR|HDC|UHD|UltraHD|4k|ac3|dts|custom|dc|divx|divx5|dsr|dsrip|dutch|dvd|dvdrip|dvdscr|dvdscreener|screener|dvdivx|cam|fragment|fs|hdtv|hdrip|hdtvrip|internal|limited|multisubs|ntsc|ogg|ogm|pal|pdtv|proper|repack|rerip|retail|cd[1-9]|r3|r5|bd5|bd|se|svcd|swedish|german|read.nfo|nfofix|unrated|ws|telesync|ts|telecine|tc|brrip|bdrip|480p|480i|576p|576i|720p|720i|1080p|1080i|2160p|hrhd|hrhdtv|hddvd|bluray|blu-ray|x264|x265|h264|h265|xvid|xvidvd|xxx|www.www|AAC|DTS|\[.*\])([ _\,\.\(\)\[\]\-]|$)",
@"[ _\,\.\(\)\[\]\-](3d|sbs|tab|hsbs|htab|mvc|HDR|HDC|UHD|UltraHD|4k|ac3|dts|custom|dc|divx|divx5|dsr|dsrip|dutch|dvd|dvdrip|dvdscr|dvdscreener|screener|dvdivx|cam|fragment|fs|hdtv|hdrip|hdtvrip|internal|limited|multisubs|ntsc|ogg|ogm|pal|pdtv|proper|repack|rerip|retail|cd[1-9]|r3|r5|bd5|bd|se|svcd|swedish|german|read.nfo|nfofix|unrated|ws|telesync|ts|telecine|tc|brrip|bdrip|480p|480i|576p|576i|720p|720i|1080p|1080i|2160p|hrhd|hrhdtv|hddvd|bluray|blu-ray|x264|x265|h264|xvid|xvidvd|xxx|www.www|AAC|DTS|\[.*\])([ _\,\.\(\)\[\]\-]|$)",
@"(\[.*\])"
};
@@ -277,18 +277,12 @@ namespace Emby.Naming.Common
IsNamed = true
},
new EpisodeExpression(@"[\\\/\._ \[\(-]([0-9]+)x([0-9]+(?:(?:[a-i]|\.[1-9])(?![0-9]))?)([^\\\/]*)$")
new EpisodeExpression("[\\\\/\\._ \\[\\(-]([0-9]+)x([0-9]+(?:(?:[a-i]|\\.[1-9])(?![0-9]))?)([^\\\\/]*)$")
{
SupportsAbsoluteEpisodeNumbers = true
},
// Not a Kodi rule as well, but below rule also causes false positives for triple-digit episode names
// [bar] Foo - 1 [baz] special case of below expression to prevent false positives with digits in the series name
new EpisodeExpression(@".*[\\\/]?.*?(\[.*?\])+.*?(?<seriesname>[-\w\s]+?)[\s_]*-[\s_]*(?<epnumber>[0-9]+).*$")
{
IsNamed = true
},
// Case Closed (1996-2007)/Case Closed - 317.mkv
// /server/anything_102.mp4
// /server/james.corden.2017.04.20.anne.hathaway.720p.hdtv.x264-crooks.mkv
// /server/anything_1996.11.14.mp4
@@ -305,12 +299,11 @@ namespace Emby.Naming.Common
// *** End Kodi Standard Naming
// "Episode 16", "Episode 16 - Title"
new EpisodeExpression(@"[Ee]pisode (?<epnumber>[0-9]+)(-(?<endingepnumber>[0-9]+))?[^\\\/]*$")
// [bar] Foo - 1 [baz]
new EpisodeExpression(@".*?(\[.*?\])+.*?(?<seriesname>[\w\s]+?)[-\s_]+(?<epnumber>[0-9]+).*$")
{
IsNamed = true
},
new EpisodeExpression(@".*(\\|\/)[sS]?(?<seasonnumber>[0-9]+)[xX](?<epnumber>[0-9]+)[^\\\/]*$")
{
IsNamed = true
@@ -368,6 +361,12 @@ namespace Emby.Naming.Common
IsOptimistic = true,
IsNamed = true
},
// "Episode 16", "Episode 16 - Title"
new EpisodeExpression(@".*[\\\/][^\\\/]* (?<epnumber>[0-9]{1,3})(-(?<endingepnumber>[0-9]{2,3}))*[^\\\/]*$")
{
IsOptimistic = true,
IsNamed = true
}
};
EpisodeWithoutSeasonExpressions = new[]
@@ -588,7 +587,7 @@ namespace Emby.Naming.Common
AudioBookNamesExpressions = new[]
{
// Detect year usually in brackets after name Batman (2020)
@"^(?<name>.+?)\s*\(\s*(?<year>[0-9]{4})\s*\)\s*$",
@"^(?<name>.+?)\s*\(\s*(?<year>\d{4})\s*\)\s*$",
@"^\s*(?<name>[^ ].*?)\s*$"
};

View File

@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<!-- ProjectGuid is only included as a requirement for SonarQube analysis -->
<PropertyGroup>
@@ -9,11 +9,12 @@
<TargetFramework>net5.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<AnalysisMode>AllDisabledByDefault</AnalysisMode>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup Condition=" '$(Stability)'=='Unstable'">
@@ -22,18 +23,17 @@
</PropertyGroup>
<ItemGroup>
<Compile Include="../SharedVersion.cs" />
<Compile Include="..\SharedVersion.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="../MediaBrowser.Common/MediaBrowser.Common.csproj" />
<ProjectReference Include="../MediaBrowser.Model/MediaBrowser.Model.csproj" />
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj" />
</ItemGroup>
<PropertyGroup>
<Authors>Jellyfin Contributors</Authors>
<PackageId>Jellyfin.Naming</PackageId>
<VersionPrefix>10.8.0</VersionPrefix>
<VersionPrefix>10.7.5</VersionPrefix>
<RepositoryUrl>https://github.com/jellyfin/jellyfin</RepositoryUrl>
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
</PropertyGroup>
@@ -44,9 +44,14 @@
<!-- Code Analyzers-->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<!-- TODO: <PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.8" PrivateAssets="All" /> -->
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<CodeAnalysisRuleSet>../jellyfin.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
</Project>

View File

@@ -16,7 +16,7 @@ namespace Emby.Naming.TV
/// <summary>
/// Initializes a new instance of the <see cref="EpisodeResolver"/> class.
/// </summary>
/// <param name="options"><see cref="NamingOptions"/> object containing VideoFileExtensions and passed to <see cref="StubResolver"/>, <see cref="Format3DParser"/> and <see cref="EpisodePathParser"/>.</param>
/// <param name="options"><see cref="NamingOptions"/> object containing VideoFileExtensions and passed to <see cref="StubResolver"/>, <see cref="FlagParser"/>, <see cref="Format3DParser"/> and <see cref="EpisodePathParser"/>.</param>
public EpisodeResolver(NamingOptions options)
{
_options = options;
@@ -62,16 +62,12 @@ namespace Emby.Naming.TV
container = extension.TrimStart('.');
}
var format3DResult = Format3DParser.Parse(path, _options);
var flags = new FlagParser(_options).GetFlags(path);
var format3DResult = new Format3DParser(_options).Parse(flags);
var parsingResult = new EpisodePathParser(_options)
.Parse(path, isDirectory, isNamed, isOptimistic, supportsAbsoluteNumbers, fillExtendedInfo);
if (!parsingResult.Success && !isStub)
{
return null;
}
return new EpisodeInfo(path)
{
Container = container,

View File

@@ -60,7 +60,7 @@ namespace Emby.Naming.TV
bool supportSpecialAliases,
bool supportNumericSeasonFolders)
{
string filename = Path.GetFileName(path);
var filename = Path.GetFileName(path) ?? string.Empty;
if (supportSpecialAliases)
{

View File

@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Text.RegularExpressions;
namespace Emby.Naming.Video
@@ -17,14 +16,8 @@ namespace Emby.Naming.Video
/// <param name="expressions">List of regex to parse name and year from.</param>
/// <param name="newName">Parsing result string.</param>
/// <returns>True if parsing was successful.</returns>
public static bool TryClean([NotNullWhen(true)] string? name, IReadOnlyList<Regex> expressions, out ReadOnlySpan<char> newName)
public static bool TryClean(string name, IReadOnlyList<Regex> expressions, out ReadOnlySpan<char> newName)
{
if (string.IsNullOrEmpty(name))
{
newName = ReadOnlySpan<char>.Empty;
return false;
}
var len = expressions.Count;
for (int i = 0; i < len; i++)
{
@@ -40,6 +33,12 @@ namespace Emby.Naming.Video
private static bool TryClean(string name, Regex expression, out ReadOnlySpan<char> newName)
{
if (string.IsNullOrEmpty(name))
{
newName = ReadOnlySpan<char>.Empty;
return false;
}
var match = expression.Match(name);
int index = match.Index;
if (match.Success && index != 0)

View File

@@ -1,5 +1,6 @@
using System;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using Emby.Naming.Audio;
using Emby.Naming.Common;
@@ -28,75 +29,72 @@ namespace Emby.Naming.Video
/// <param name="path">Path to file.</param>
/// <returns>Returns <see cref="ExtraResult"/> object.</returns>
public ExtraResult GetExtraInfo(string path)
{
return _options.VideoExtraRules
.Select(i => GetExtraInfo(path, i))
.FirstOrDefault(i => i.ExtraType != null) ?? new ExtraResult();
}
private ExtraResult GetExtraInfo(string path, ExtraRule rule)
{
var result = new ExtraResult();
for (var i = 0; i < _options.VideoExtraRules.Length; i++)
if (rule.MediaType == MediaType.Audio)
{
var rule = _options.VideoExtraRules[i];
if (rule.MediaType == MediaType.Audio)
{
if (!AudioFileParser.IsAudioFile(path, _options))
{
continue;
}
}
else if (rule.MediaType == MediaType.Video)
{
if (!VideoResolver.IsVideoFile(path, _options))
{
continue;
}
}
var pathSpan = path.AsSpan();
if (rule.RuleType == ExtraRuleType.Filename)
{
var filename = Path.GetFileNameWithoutExtension(pathSpan);
if (filename.Equals(rule.Token, StringComparison.OrdinalIgnoreCase))
{
result.ExtraType = rule.ExtraType;
result.Rule = rule;
}
}
else if (rule.RuleType == ExtraRuleType.Suffix)
{
var filename = Path.GetFileNameWithoutExtension(pathSpan);
if (filename.Contains(rule.Token, StringComparison.OrdinalIgnoreCase))
{
result.ExtraType = rule.ExtraType;
result.Rule = rule;
}
}
else if (rule.RuleType == ExtraRuleType.Regex)
{
var filename = Path.GetFileName(path);
var regex = new Regex(rule.Token, RegexOptions.IgnoreCase);
if (regex.IsMatch(filename))
{
result.ExtraType = rule.ExtraType;
result.Rule = rule;
}
}
else if (rule.RuleType == ExtraRuleType.DirectoryName)
{
var directoryName = Path.GetFileName(Path.GetDirectoryName(pathSpan));
if (directoryName.Equals(rule.Token, StringComparison.OrdinalIgnoreCase))
{
result.ExtraType = rule.ExtraType;
result.Rule = rule;
}
}
if (result.ExtraType != null)
if (!AudioFileParser.IsAudioFile(path, _options))
{
return result;
}
}
else if (rule.MediaType == MediaType.Video)
{
if (!new VideoResolver(_options).IsVideoFile(path))
{
return result;
}
}
if (rule.RuleType == ExtraRuleType.Filename)
{
var filename = Path.GetFileNameWithoutExtension(path);
if (string.Equals(filename, rule.Token, StringComparison.OrdinalIgnoreCase))
{
result.ExtraType = rule.ExtraType;
result.Rule = rule;
}
}
else if (rule.RuleType == ExtraRuleType.Suffix)
{
var filename = Path.GetFileNameWithoutExtension(path);
if (filename.IndexOf(rule.Token, StringComparison.OrdinalIgnoreCase) > 0)
{
result.ExtraType = rule.ExtraType;
result.Rule = rule;
}
}
else if (rule.RuleType == ExtraRuleType.Regex)
{
var filename = Path.GetFileName(path);
var regex = new Regex(rule.Token, RegexOptions.IgnoreCase);
if (regex.IsMatch(filename))
{
result.ExtraType = rule.ExtraType;
result.Rule = rule;
}
}
else if (rule.RuleType == ExtraRuleType.DirectoryName)
{
var directoryName = Path.GetFileName(Path.GetDirectoryName(path));
if (string.Equals(directoryName, rule.Token, StringComparison.OrdinalIgnoreCase))
{
result.ExtraType = rule.ExtraType;
result.Rule = rule;
}
}
return result;
}

View File

@@ -0,0 +1,53 @@
using System;
using System.IO;
using Emby.Naming.Common;
namespace Emby.Naming.Video
{
/// <summary>
/// Parses list of flags from filename based on delimiters.
/// </summary>
public class FlagParser
{
private readonly NamingOptions _options;
/// <summary>
/// Initializes a new instance of the <see cref="FlagParser"/> class.
/// </summary>
/// <param name="options"><see cref="NamingOptions"/> object containing VideoFlagDelimiters.</param>
public FlagParser(NamingOptions options)
{
_options = options;
}
/// <summary>
/// Calls GetFlags function with _options.VideoFlagDelimiters parameter.
/// </summary>
/// <param name="path">Path to file.</param>
/// <returns>List of found flags.</returns>
public string[] GetFlags(string path)
{
return GetFlags(path, _options.VideoFlagDelimiters);
}
/// <summary>
/// Parses flags from filename based on delimiters.
/// </summary>
/// <param name="path">Path to file.</param>
/// <param name="delimiters">Delimiters used to extract flags.</param>
/// <returns>List of found flags.</returns>
public string[] GetFlags(string path, char[] delimiters)
{
if (string.IsNullOrEmpty(path))
{
return Array.Empty<string>();
}
// Note: the tags need be be surrounded be either a space ( ), hyphen -, dot . or underscore _.
var file = Path.GetFileName(path);
return file.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);
}
}
}

View File

@@ -1,37 +1,45 @@
using System;
using System.Linq;
using Emby.Naming.Common;
namespace Emby.Naming.Video
{
/// <summary>
/// Parse 3D format related flags.
/// Parste 3D format related flags.
/// </summary>
public static class Format3DParser
public class Format3DParser
{
// Static default result to save on allocation costs.
private static readonly Format3DResult _defaultResult = new (false, null);
private readonly NamingOptions _options;
/// <summary>
/// Initializes a new instance of the <see cref="Format3DParser"/> class.
/// </summary>
/// <param name="options"><see cref="NamingOptions"/> object containing VideoFlagDelimiters and passes options to <see cref="FlagParser"/>.</param>
public Format3DParser(NamingOptions options)
{
_options = options;
}
/// <summary>
/// Parse 3D format related flags.
/// </summary>
/// <param name="path">Path to file.</param>
/// <param name="namingOptions">The naming options.</param>
/// <returns>Returns <see cref="Format3DResult"/> object.</returns>
public static Format3DResult Parse(ReadOnlySpan<char> path, NamingOptions namingOptions)
public Format3DResult Parse(string path)
{
int oldLen = namingOptions.VideoFlagDelimiters.Length;
Span<char> delimiters = stackalloc char[oldLen + 1];
namingOptions.VideoFlagDelimiters.AsSpan().CopyTo(delimiters);
int oldLen = _options.VideoFlagDelimiters.Length;
var delimiters = new char[oldLen + 1];
_options.VideoFlagDelimiters.CopyTo(delimiters, 0);
delimiters[oldLen] = ' ';
return Parse(path, delimiters, namingOptions);
return Parse(new FlagParser(_options).GetFlags(path, delimiters));
}
private static Format3DResult Parse(ReadOnlySpan<char> path, ReadOnlySpan<char> delimiters, NamingOptions namingOptions)
internal Format3DResult Parse(string[] videoFlags)
{
foreach (var rule in namingOptions.Format3DRules)
foreach (var rule in _options.Format3DRules)
{
var result = Parse(path, rule, delimiters);
var result = Parse(videoFlags, rule);
if (result.Is3D)
{
@@ -39,43 +47,51 @@ namespace Emby.Naming.Video
}
}
return _defaultResult;
return new Format3DResult();
}
private static Format3DResult Parse(ReadOnlySpan<char> path, Format3DRule rule, ReadOnlySpan<char> delimiters)
private static Format3DResult Parse(string[] videoFlags, Format3DRule rule)
{
bool is3D = false;
string? format3D = null;
var result = new Format3DResult();
// If there's no preceding token we just consider it found
var foundPrefix = string.IsNullOrEmpty(rule.PrecedingToken);
while (path.Length > 0)
if (string.IsNullOrEmpty(rule.PrecedingToken))
{
var index = path.IndexOfAny(delimiters);
if (index == -1)
result.Format3D = new[] { rule.Token }.FirstOrDefault(i => videoFlags.Contains(i, StringComparer.OrdinalIgnoreCase));
result.Is3D = !string.IsNullOrEmpty(result.Format3D);
if (result.Is3D)
{
index = path.Length - 1;
}
var currentSlice = path[..index];
path = path[(index + 1)..];
if (!foundPrefix)
{
foundPrefix = currentSlice.Equals(rule.PrecedingToken, StringComparison.OrdinalIgnoreCase);
continue;
}
is3D = foundPrefix && currentSlice.Equals(rule.Token, StringComparison.OrdinalIgnoreCase);
if (is3D)
{
format3D = rule.Token;
break;
result.Tokens.Add(rule.Token);
}
}
else
{
var foundPrefix = false;
string? format = null;
return is3D ? new Format3DResult(true, format3D) : _defaultResult;
foreach (var flag in videoFlags)
{
if (foundPrefix)
{
result.Tokens.Add(rule.PrecedingToken);
if (string.Equals(rule.Token, flag, StringComparison.OrdinalIgnoreCase))
{
format = flag;
result.Tokens.Add(rule.Token);
}
break;
}
foundPrefix = string.Equals(flag, rule.PrecedingToken, StringComparison.OrdinalIgnoreCase);
}
result.Is3D = foundPrefix && !string.IsNullOrEmpty(format);
result.Format3D = format;
}
return result;
}
}
}

View File

@@ -1,3 +1,5 @@
using System.Collections.Generic;
namespace Emby.Naming.Video
{
/// <summary>
@@ -8,24 +10,27 @@ namespace Emby.Naming.Video
/// <summary>
/// Initializes a new instance of the <see cref="Format3DResult"/> class.
/// </summary>
/// <param name="is3D">A value indicating whether the parsed string contains 3D tokens.</param>
/// <param name="format3D">The 3D format. Value might be null if [is3D] is <c>false</c>.</param>
public Format3DResult(bool is3D, string? format3D)
public Format3DResult()
{
Is3D = is3D;
Format3D = format3D;
Tokens = new List<string>();
}
/// <summary>
/// Gets a value indicating whether [is3 d].
/// Gets or sets a value indicating whether [is3 d].
/// </summary>
/// <value><c>true</c> if [is3 d]; otherwise, <c>false</c>.</value>
public bool Is3D { get; }
public bool Is3D { get; set; }
/// <summary>
/// Gets the format3 d.
/// Gets or sets the format3 d.
/// </summary>
/// <value>The format3 d.</value>
public string? Format3D { get; }
public string? Format3D { get; set; }
/// <summary>
/// Gets or sets the tokens.
/// </summary>
/// <value>The tokens.</value>
public List<string> Tokens { get; set; }
}
}

View File

@@ -85,8 +85,10 @@ namespace Emby.Naming.Video
/// <returns>Enumerable <see cref="FileStack"/> of videos.</returns>
public IEnumerable<FileStack> Resolve(IEnumerable<FileSystemMetadata> files)
{
var resolver = new VideoResolver(_options);
var list = files
.Where(i => i.IsDirectory || VideoResolver.IsVideoFile(i.FullName, _options) || VideoResolver.IsStubFile(i.FullName, _options))
.Where(i => i.IsDirectory || resolver.IsVideoFile(i.FullName) || resolver.IsStubFile(i.FullName))
.OrderBy(i => i.FullName)
.ToList();

View File

@@ -1,4 +1,3 @@
using System;
using MediaBrowser.Model.Entities;
namespace Emby.Naming.Video
@@ -107,9 +106,9 @@ namespace Emby.Naming.Video
/// Gets the file name without extension.
/// </summary>
/// <value>The file name without extension.</value>
public ReadOnlySpan<char> FileNameWithoutExtension => !IsDirectory
? System.IO.Path.GetFileNameWithoutExtension(Path.AsSpan())
: System.IO.Path.GetFileName(Path.AsSpan());
public string FileNameWithoutExtension => !IsDirectory
? System.IO.Path.GetFileNameWithoutExtension(Path)
: System.IO.Path.GetFileName(Path);
/// <inheritdoc />
public override string ToString()

View File

@@ -12,19 +12,31 @@ namespace Emby.Naming.Video
/// <summary>
/// Resolves alternative versions and extras from list of video files.
/// </summary>
public static class VideoListResolver
public class VideoListResolver
{
private readonly NamingOptions _options;
/// <summary>
/// Initializes a new instance of the <see cref="VideoListResolver"/> class.
/// </summary>
/// <param name="options"><see cref="NamingOptions"/> object containing CleanStringRegexes and VideoFlagDelimiters and passes options to <see cref="StackResolver"/> and <see cref="VideoResolver"/>.</param>
public VideoListResolver(NamingOptions options)
{
_options = options;
}
/// <summary>
/// Resolves alternative versions and extras from list of video files.
/// </summary>
/// <param name="files">List of related video files.</param>
/// <param name="namingOptions">The naming options.</param>
/// <param name="supportMultiVersion">Indication we should consider multi-versions of content.</param>
/// <returns>Returns enumerable of <see cref="VideoInfo"/> which groups files together when related.</returns>
public static IEnumerable<VideoInfo> Resolve(IEnumerable<FileSystemMetadata> files, NamingOptions namingOptions, bool supportMultiVersion = true)
public IEnumerable<VideoInfo> Resolve(List<FileSystemMetadata> files, bool supportMultiVersion = true)
{
var videoResolver = new VideoResolver(_options);
var videoInfos = files
.Select(i => VideoResolver.Resolve(i.FullName, i.IsDirectory, namingOptions))
.Select(i => videoResolver.Resolve(i.FullName, i.IsDirectory))
.OfType<VideoFileInfo>()
.ToList();
@@ -34,7 +46,7 @@ namespace Emby.Naming.Video
.Where(i => i.ExtraType == null)
.Select(i => new FileSystemMetadata { FullName = i.Path, IsDirectory = i.IsDirectory });
var stackResult = new StackResolver(namingOptions)
var stackResult = new StackResolver(_options)
.Resolve(nonExtras).ToList();
var remainingFiles = videoInfos
@@ -47,17 +59,23 @@ namespace Emby.Naming.Video
{
var info = new VideoInfo(stack.Name)
{
Files = stack.Files.Select(i => VideoResolver.Resolve(i, stack.IsDirectoryStack, namingOptions))
Files = stack.Files.Select(i => videoResolver.Resolve(i, stack.IsDirectoryStack))
.OfType<VideoFileInfo>()
.ToList()
};
info.Year = info.Files[0].Year;
var extras = ExtractExtras(remainingFiles, stack.Name, Path.GetFileNameWithoutExtension(stack.Files[0].AsSpan()), namingOptions.VideoFlagDelimiters);
var extraBaseNames = new List<string> { stack.Name, Path.GetFileNameWithoutExtension(stack.Files[0]) };
var extras = GetExtras(remainingFiles, extraBaseNames);
if (extras.Count > 0)
{
remainingFiles = remainingFiles
.Except(extras)
.ToList();
info.Extras = extras;
}
@@ -70,12 +88,15 @@ namespace Emby.Naming.Video
foreach (var media in standaloneMedia)
{
var info = new VideoInfo(media.Name) { Files = new[] { media } };
var info = new VideoInfo(media.Name) { Files = new List<VideoFileInfo> { media } };
info.Year = info.Files[0].Year;
remainingFiles.Remove(media);
var extras = ExtractExtras(remainingFiles, media.FileNameWithoutExtension, namingOptions.VideoFlagDelimiters);
var extras = GetExtras(remainingFiles, new List<string> { media.FileNameWithoutExtension });
remainingFiles = remainingFiles
.Except(extras.Concat(new[] { media }))
.ToList();
info.Extras = extras;
@@ -84,7 +105,8 @@ namespace Emby.Naming.Video
if (supportMultiVersion)
{
list = GetVideosGroupedByVersion(list, namingOptions);
list = GetVideosGroupedByVersion(list)
.ToList();
}
// If there's only one resolved video, use the folder name as well to find extras
@@ -92,14 +114,19 @@ namespace Emby.Naming.Video
{
var info = list[0];
var videoPath = list[0].Files[0].Path;
var parentPath = Path.GetDirectoryName(videoPath.AsSpan());
var parentPath = Path.GetDirectoryName(videoPath);
if (!parentPath.IsEmpty)
if (!string.IsNullOrEmpty(parentPath))
{
var folderName = Path.GetFileName(parentPath);
if (!folderName.IsEmpty)
if (!string.IsNullOrEmpty(folderName))
{
var extras = ExtractExtras(remainingFiles, folderName, namingOptions.VideoFlagDelimiters);
var extras = GetExtras(remainingFiles, new List<string> { folderName });
remainingFiles = remainingFiles
.Except(extras)
.ToList();
extras.AddRange(info.Extras);
info.Extras = extras;
}
@@ -137,168 +164,97 @@ namespace Emby.Naming.Video
// Whatever files are left, just add them
list.AddRange(remainingFiles.Select(i => new VideoInfo(i.Name)
{
Files = new[] { i },
Files = new List<VideoFileInfo> { i },
Year = i.Year
}));
return list;
}
private static List<VideoInfo> GetVideosGroupedByVersion(List<VideoInfo> videos, NamingOptions namingOptions)
private IEnumerable<VideoInfo> GetVideosGroupedByVersion(List<VideoInfo> videos)
{
if (videos.Count == 0)
{
return videos;
}
var folderName = Path.GetFileName(Path.GetDirectoryName(videos[0].Files[0].Path.AsSpan()));
var list = new List<VideoInfo>();
if (folderName.Length <= 1 || !HaveSameYear(videos))
{
return videos;
}
var folderName = Path.GetFileName(Path.GetDirectoryName(videos[0].Files[0].Path));
// Cannot use Span inside local functions and delegates thus we cannot use LINQ here nor merge with the above [if]
for (var i = 0; i < videos.Count; i++)
if (!string.IsNullOrEmpty(folderName)
&& folderName.Length > 1
&& videos.All(i => i.Files.Count == 1
&& IsEligibleForMultiVersion(folderName, i.Files[0].Path))
&& HaveSameYear(videos))
{
var video = videos[i];
if (!IsEligibleForMultiVersion(folderName, video.Files[0].Path, namingOptions))
var ordered = videos.OrderBy(i => i.Name).ToList();
list.Add(ordered[0]);
var alternateVersionsLen = ordered.Count - 1;
var alternateVersions = new VideoFileInfo[alternateVersionsLen];
for (int i = 0; i < alternateVersionsLen; i++)
{
return videos;
}
}
// The list is created and overwritten in the caller, so we are allowed to do in-place sorting
videos.Sort((x, y) => string.Compare(x.Name, y.Name, StringComparison.Ordinal));
var list = new List<VideoInfo>
{
videos[0]
};
var alternateVersionsLen = videos.Count - 1;
var alternateVersions = new VideoFileInfo[alternateVersionsLen];
var extras = new List<VideoFileInfo>(list[0].Extras);
for (int i = 0; i < alternateVersionsLen; i++)
{
var video = videos[i + 1];
alternateVersions[i] = video.Files[0];
extras.AddRange(video.Extras);
}
list[0].AlternateVersions = alternateVersions;
list[0].Name = folderName.ToString();
list[0].Extras = extras;
return list;
}
private static bool HaveSameYear(IReadOnlyList<VideoInfo> videos)
{
if (videos.Count == 1)
{
return true;
}
var firstYear = videos[0].Year ?? -1;
for (var i = 1; i < videos.Count; i++)
{
if ((videos[i].Year ?? -1) != firstYear)
{
return false;
}
}
return true;
}
private static bool IsEligibleForMultiVersion(ReadOnlySpan<char> folderName, string testFilePath, NamingOptions namingOptions)
{
var testFilename = Path.GetFileNameWithoutExtension(testFilePath.AsSpan());
if (!testFilename.StartsWith(folderName, StringComparison.OrdinalIgnoreCase))
{
return false;
}
// Remove the folder name before cleaning as we don't care about cleaning that part
if (folderName.Length <= testFilename.Length)
{
testFilename = testFilename[folderName.Length..].Trim();
}
// There are no span overloads for regex unfortunately
var tmpTestFilename = testFilename.ToString();
if (CleanStringParser.TryClean(tmpTestFilename, namingOptions.CleanStringRegexes, out var cleanName))
{
tmpTestFilename = cleanName.Trim().ToString();
}
// The CleanStringParser should have removed common keywords etc.
return string.IsNullOrEmpty(tmpTestFilename)
|| testFilename[0] == '-'
|| Regex.IsMatch(tmpTestFilename, @"^\[([^]]*)\]", RegexOptions.Compiled);
}
private static ReadOnlySpan<char> TrimFilenameDelimiters(ReadOnlySpan<char> name, ReadOnlySpan<char> videoFlagDelimiters)
{
return name.IsEmpty ? name : name.TrimEnd().TrimEnd(videoFlagDelimiters).TrimEnd();
}
private static bool StartsWith(ReadOnlySpan<char> fileName, ReadOnlySpan<char> baseName, ReadOnlySpan<char> trimmedBaseName)
{
if (baseName.IsEmpty)
{
return false;
}
return fileName.StartsWith(baseName, StringComparison.OrdinalIgnoreCase)
|| (!trimmedBaseName.IsEmpty && fileName.StartsWith(trimmedBaseName, StringComparison.OrdinalIgnoreCase));
}
/// <summary>
/// Finds similar filenames to that of [baseName] and removes any matches from [remainingFiles].
/// </summary>
/// <param name="remainingFiles">The list of remaining filenames.</param>
/// <param name="baseName">The base name to use for the comparison.</param>
/// <param name="videoFlagDelimiters">The video flag delimiters.</param>
/// <returns>A list of video extras for [baseName].</returns>
private static List<VideoFileInfo> ExtractExtras(IList<VideoFileInfo> remainingFiles, ReadOnlySpan<char> baseName, ReadOnlySpan<char> videoFlagDelimiters)
{
return ExtractExtras(remainingFiles, baseName, ReadOnlySpan<char>.Empty, videoFlagDelimiters);
}
/// <summary>
/// Finds similar filenames to that of [firstBaseName] and [secondBaseName] and removes any matches from [remainingFiles].
/// </summary>
/// <param name="remainingFiles">The list of remaining filenames.</param>
/// <param name="firstBaseName">The first base name to use for the comparison.</param>
/// <param name="secondBaseName">The second base name to use for the comparison.</param>
/// <param name="videoFlagDelimiters">The video flag delimiters.</param>
/// <returns>A list of video extras for [firstBaseName] and [secondBaseName].</returns>
private static List<VideoFileInfo> ExtractExtras(IList<VideoFileInfo> remainingFiles, ReadOnlySpan<char> firstBaseName, ReadOnlySpan<char> secondBaseName, ReadOnlySpan<char> videoFlagDelimiters)
{
var trimmedFirstBaseName = TrimFilenameDelimiters(firstBaseName, videoFlagDelimiters);
var trimmedSecondBaseName = TrimFilenameDelimiters(secondBaseName, videoFlagDelimiters);
var result = new List<VideoFileInfo>();
for (var pos = remainingFiles.Count - 1; pos >= 0; pos--)
{
var file = remainingFiles[pos];
if (file.ExtraType == null)
{
continue;
alternateVersions[i] = ordered[i + 1].Files[0];
}
var filename = file.FileNameWithoutExtension;
if (StartsWith(filename, firstBaseName, trimmedFirstBaseName)
|| StartsWith(filename, secondBaseName, trimmedSecondBaseName))
{
result.Add(file);
remainingFiles.RemoveAt(pos);
}
list[0].AlternateVersions = alternateVersions;
list[0].Name = folderName;
var extras = ordered.Skip(1).SelectMany(i => i.Extras).ToList();
extras.AddRange(list[0].Extras);
list[0].Extras = extras;
return list;
}
return result;
return videos;
}
private bool HaveSameYear(List<VideoInfo> videos)
{
return videos.Select(i => i.Year ?? -1).Distinct().Count() < 2;
}
private bool IsEligibleForMultiVersion(string folderName, string? testFilename)
{
testFilename = Path.GetFileNameWithoutExtension(testFilename) ?? string.Empty;
if (testFilename.StartsWith(folderName, StringComparison.OrdinalIgnoreCase))
{
// Remove the folder name before cleaning as we don't care about cleaning that part
if (folderName.Length <= testFilename.Length)
{
testFilename = testFilename.Substring(folderName.Length).Trim();
}
if (CleanStringParser.TryClean(testFilename, _options.CleanStringRegexes, out var cleanName))
{
testFilename = cleanName.Trim().ToString();
}
// The CleanStringParser should have removed common keywords etc.
return string.IsNullOrEmpty(testFilename)
|| testFilename[0] == '-'
|| Regex.IsMatch(testFilename, @"^\[([^]]*)\]");
}
return false;
}
private List<VideoFileInfo> GetExtras(IEnumerable<VideoFileInfo> remainingFiles, List<string> baseNames)
{
foreach (var name in baseNames.ToList())
{
var trimmedName = name.TrimEnd().TrimEnd(_options.VideoFlagDelimiters).TrimEnd();
baseNames.Add(trimmedName);
}
return remainingFiles
.Where(i => i.ExtraType != null)
.Where(i => baseNames.Any(b =>
i.FileNameWithoutExtension.StartsWith(b, StringComparison.OrdinalIgnoreCase)))
.ToList();
}
}
}

View File

@@ -1,36 +1,45 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using Emby.Naming.Common;
using Jellyfin.Extensions;
namespace Emby.Naming.Video
{
/// <summary>
/// Resolves <see cref="VideoFileInfo"/> from file path.
/// </summary>
public static class VideoResolver
public class VideoResolver
{
private readonly NamingOptions _options;
/// <summary>
/// Initializes a new instance of the <see cref="VideoResolver"/> class.
/// </summary>
/// <param name="options"><see cref="NamingOptions"/> object containing VideoFileExtensions, StubFileExtensions, CleanStringRegexes and CleanDateTimeRegexes
/// and passes options in <see cref="StubResolver"/>, <see cref="FlagParser"/>, <see cref="Format3DParser"/> and <see cref="ExtraResolver"/>.</param>
public VideoResolver(NamingOptions options)
{
_options = options;
}
/// <summary>
/// Resolves the directory.
/// </summary>
/// <param name="path">The path.</param>
/// <param name="namingOptions">The naming options.</param>
/// <returns>VideoFileInfo.</returns>
public static VideoFileInfo? ResolveDirectory(string? path, NamingOptions namingOptions)
public VideoFileInfo? ResolveDirectory(string? path)
{
return Resolve(path, true, namingOptions);
return Resolve(path, true);
}
/// <summary>
/// Resolves the file.
/// </summary>
/// <param name="path">The path.</param>
/// <param name="namingOptions">The naming options.</param>
/// <returns>VideoFileInfo.</returns>
public static VideoFileInfo? ResolveFile(string? path, NamingOptions namingOptions)
public VideoFileInfo? ResolveFile(string? path)
{
return Resolve(path, false, namingOptions);
return Resolve(path, false);
}
/// <summary>
@@ -38,11 +47,10 @@ namespace Emby.Naming.Video
/// </summary>
/// <param name="path">The path.</param>
/// <param name="isDirectory">if set to <c>true</c> [is folder].</param>
/// <param name="namingOptions">The naming options.</param>
/// <param name="parseName">Whether or not the name should be parsed for info.</param>
/// <returns>VideoFileInfo.</returns>
/// <exception cref="ArgumentNullException"><c>path</c> is <c>null</c>.</exception>
public static VideoFileInfo? Resolve(string? path, bool isDirectory, NamingOptions namingOptions, bool parseName = true)
public VideoFileInfo? Resolve(string? path, bool isDirectory, bool parseName = true)
{
if (string.IsNullOrEmpty(path))
{
@@ -50,18 +58,18 @@ namespace Emby.Naming.Video
}
bool isStub = false;
ReadOnlySpan<char> container = ReadOnlySpan<char>.Empty;
string? container = null;
string? stubType = null;
if (!isDirectory)
{
var extension = Path.GetExtension(path.AsSpan());
var extension = Path.GetExtension(path);
// Check supported extensions
if (!namingOptions.VideoFileExtensions.Contains(extension, StringComparison.OrdinalIgnoreCase))
if (!_options.VideoFileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase))
{
// It's not supported. Check stub extensions
if (!StubResolver.TryResolveFile(path, namingOptions, out stubType))
if (!StubResolver.TryResolveFile(path, _options, out stubType))
{
return null;
}
@@ -72,22 +80,25 @@ namespace Emby.Naming.Video
container = extension.TrimStart('.');
}
var format3DResult = Format3DParser.Parse(path, namingOptions);
var flags = new FlagParser(_options).GetFlags(path);
var format3DResult = new Format3DParser(_options).Parse(flags);
var extraResult = new ExtraResolver(namingOptions).GetExtraInfo(path);
var extraResult = new ExtraResolver(_options).GetExtraInfo(path);
var name = Path.GetFileNameWithoutExtension(path);
var name = isDirectory
? Path.GetFileName(path)
: Path.GetFileNameWithoutExtension(path);
int? year = null;
if (parseName)
{
var cleanDateTimeResult = CleanDateTime(name, namingOptions);
var cleanDateTimeResult = CleanDateTime(name);
name = cleanDateTimeResult.Name;
year = cleanDateTimeResult.Year;
if (extraResult.ExtraType == null
&& TryCleanString(name, namingOptions, out ReadOnlySpan<char> newName))
&& TryCleanString(name, out ReadOnlySpan<char> newName))
{
name = newName.ToString();
}
@@ -95,7 +106,7 @@ namespace Emby.Naming.Video
return new VideoFileInfo(
path: path,
container: container.IsEmpty ? null : container.ToString(),
container: container,
isStub: isStub,
name: name,
year: year,
@@ -111,47 +122,43 @@ namespace Emby.Naming.Video
/// Determines if path is video file based on extension.
/// </summary>
/// <param name="path">Path to file.</param>
/// <param name="namingOptions">The naming options.</param>
/// <returns>True if is video file.</returns>
public static bool IsVideoFile(string path, NamingOptions namingOptions)
public bool IsVideoFile(string path)
{
var extension = Path.GetExtension(path.AsSpan());
return namingOptions.VideoFileExtensions.Contains(extension, StringComparison.OrdinalIgnoreCase);
var extension = Path.GetExtension(path) ?? string.Empty;
return _options.VideoFileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase);
}
/// <summary>
/// Determines if path is video file stub based on extension.
/// </summary>
/// <param name="path">Path to file.</param>
/// <param name="namingOptions">The naming options.</param>
/// <returns>True if is video file stub.</returns>
public static bool IsStubFile(string path, NamingOptions namingOptions)
public bool IsStubFile(string path)
{
var extension = Path.GetExtension(path.AsSpan());
return namingOptions.StubFileExtensions.Contains(extension, StringComparison.OrdinalIgnoreCase);
var extension = Path.GetExtension(path) ?? string.Empty;
return _options.StubFileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase);
}
/// <summary>
/// Tries to clean name of clutter.
/// </summary>
/// <param name="name">Raw name.</param>
/// <param name="namingOptions">The naming options.</param>
/// <param name="newName">Clean name.</param>
/// <returns>True if cleaning of name was successful.</returns>
public static bool TryCleanString([NotNullWhen(true)] string? name, NamingOptions namingOptions, out ReadOnlySpan<char> newName)
public bool TryCleanString(string name, out ReadOnlySpan<char> newName)
{
return CleanStringParser.TryClean(name, namingOptions.CleanStringRegexes, out newName);
return CleanStringParser.TryClean(name, _options.CleanStringRegexes, out newName);
}
/// <summary>
/// Tries to get name and year from raw name.
/// </summary>
/// <param name="name">Raw name.</param>
/// <param name="namingOptions">The naming options.</param>
/// <returns>Returns <see cref="CleanDateTimeResult"/> with name and optional year.</returns>
public static CleanDateTimeResult CleanDateTime(string name, NamingOptions namingOptions)
public CleanDateTimeResult CleanDateTime(string name)
{
return CleanDateTimeParser.Clean(name, namingOptions.CleanDateTimeRegexes);
return CleanDateTimeParser.Clean(name, _options.CleanDateTimeRegexes);
}
}
}

View File

@@ -9,6 +9,8 @@
<TargetFramework>net5.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
@@ -23,9 +25,14 @@
<!-- Code analyzers-->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.8" PrivateAssets="All" />
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<CodeAnalysisRuleSet>../jellyfin.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
</Project>

View File

@@ -77,6 +77,7 @@ namespace Emby.Notifications
{
_libraryManager.ItemAdded += OnLibraryManagerItemAdded;
_appHost.HasPendingRestartChanged += OnAppHostHasPendingRestartChanged;
_appHost.HasUpdateAvailableChanged += OnAppHostHasUpdateAvailableChanged;
_activityManager.EntryCreated += OnActivityManagerEntryCreated;
return Task.CompletedTask;
@@ -131,6 +132,25 @@ namespace Emby.Notifications
return _config.GetConfiguration<NotificationOptions>("notifications");
}
private async void OnAppHostHasUpdateAvailableChanged(object? sender, EventArgs e)
{
if (!_appHost.HasUpdateAvailable)
{
return;
}
var type = NotificationType.ApplicationUpdateAvailable.ToString();
var notification = new NotificationRequest
{
Description = "Please see jellyfin.org for details.",
NotificationType = type,
Name = _localization.GetLocalizedString("NewVersionIsAvailable")
};
await SendNotification(notification, null).ConfigureAwait(false);
}
private void OnLibraryManagerItemAdded(object? sender, ItemChangeEventArgs e)
{
if (!FilterItem(e.Item))
@@ -305,6 +325,7 @@ namespace Emby.Notifications
_libraryManager.ItemAdded -= OnLibraryManagerItemAdded;
_appHost.HasPendingRestartChanged -= OnAppHostHasPendingRestartChanged;
_appHost.HasUpdateAvailableChanged -= OnAppHostHasUpdateAvailableChanged;
_activityManager.EntryCreated -= OnActivityManagerEntryCreated;
_disposed = true;

View File

@@ -22,13 +22,20 @@
<TargetFramework>net5.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Nullable>enable</Nullable>
</PropertyGroup>
<!-- Code Analyzers-->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.8" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" />
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<CodeAnalysisRuleSet>../jellyfin.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
</Project>

View File

@@ -33,7 +33,7 @@ namespace Emby.Server.Implementations.AppBase
CachePath = cacheDirectoryPath;
WebPath = webDirectoryPath;
_dataPath = Directory.CreateDirectory(Path.Combine(ProgramDataPath, "data")).FullName;
DataPath = Path.Combine(ProgramDataPath, "data");
}
/// <summary>
@@ -55,7 +55,11 @@ namespace Emby.Server.Implementations.AppBase
/// Gets the folder path to the data directory.
/// </summary>
/// <value>The data directory.</value>
public string DataPath => _dataPath;
public string DataPath
{
get => _dataPath;
private set => _dataPath = Directory.CreateDirectory(value).FullName;
}
/// <inheritdoc />
public string VirtualDataPath => "%AppDataPath%";

View File

@@ -1,5 +1,3 @@
#nullable disable
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
@@ -25,11 +23,6 @@ namespace Emby.Server.Implementations.AppBase
private readonly ConcurrentDictionary<string, object> _configurations = new ConcurrentDictionary<string, object>();
/// <summary>
/// The _configuration sync lock.
/// </summary>
private readonly object _configurationSyncLock = new object();
private ConfigurationStore[] _configurationStores = Array.Empty<ConfigurationStore>();
private IConfigurationFactory[] _configurationFactories = Array.Empty<IConfigurationFactory>();
@@ -38,6 +31,11 @@ namespace Emby.Server.Implementations.AppBase
/// </summary>
private bool _configurationLoaded;
/// <summary>
/// The _configuration sync lock.
/// </summary>
private readonly object _configurationSyncLock = new object();
/// <summary>
/// The _configuration.
/// </summary>
@@ -299,29 +297,25 @@ namespace Emby.Server.Implementations.AppBase
/// <inheritdoc />
public object GetConfiguration(string key)
{
return _configurations.GetOrAdd(
key,
(k, configurationManager) =>
return _configurations.GetOrAdd(key, k =>
{
var file = GetConfigurationFile(key);
var configurationInfo = _configurationStores
.FirstOrDefault(i => string.Equals(i.Key, key, StringComparison.OrdinalIgnoreCase));
if (configurationInfo == null)
{
var file = configurationManager.GetConfigurationFile(k);
throw new ResourceNotFoundException("Configuration with key " + key + " not found.");
}
var configurationInfo = Array.Find(
configurationManager._configurationStores,
i => string.Equals(i.Key, k, StringComparison.OrdinalIgnoreCase));
var configurationType = configurationInfo.ConfigurationType;
if (configurationInfo == null)
{
throw new ResourceNotFoundException("Configuration with key " + k + " not found.");
}
var configurationType = configurationInfo.ConfigurationType;
lock (configurationManager._configurationSyncLock)
{
return configurationManager.LoadConfiguration(file, configurationType);
}
},
this);
lock (_configurationSyncLock)
{
return LoadConfiguration(file, configurationType);
}
});
}
private object LoadConfiguration(string path, Type configurationType)

View File

@@ -1,6 +1,9 @@
#nullable enable
using System;
using System.IO;
using System.Linq;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Model.Serialization;
namespace Emby.Server.Implementations.AppBase
@@ -33,8 +36,7 @@ namespace Emby.Server.Implementations.AppBase
}
catch (Exception)
{
// Note: CreateInstance returns null for Nullable<T>, e.g. CreateInstance(typeof(int?)) returns null.
configuration = Activator.CreateInstance(type)!;
configuration = Activator.CreateInstance(type) ?? throw new ArgumentException($"Provided path ({type}) is not valid.", nameof(type));
}
using var stream = new MemoryStream(buffer?.Length ?? 0);

View File

@@ -1,5 +1,3 @@
#nullable disable
#pragma warning disable CS1591
using System;
@@ -9,9 +7,11 @@ using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Emby.Dlna;
@@ -103,6 +103,7 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Prometheus.DotNetRuntime;
using OperatingSystem = MediaBrowser.Common.System.OperatingSystem;
using WebSocketManager = Emby.Server.Implementations.HttpServer.WebSocketManager;
namespace Emby.Server.Implementations
@@ -120,6 +121,7 @@ namespace Emby.Server.Implementations
private readonly IFileSystem _fileSystemManager;
private readonly IConfiguration _startupConfig;
private readonly IXmlSerializer _xmlSerializer;
private readonly IJsonSerializer _jsonSerializer;
private readonly IStartupOptions _startupOptions;
private readonly IPluginManager _pluginManager;
@@ -149,7 +151,13 @@ namespace Emby.Server.Implementations
return false;
}
return OperatingSystem.IsWindows() || OperatingSystem.IsMacOS();
if (OperatingSystem.Id == OperatingSystemId.Windows
|| OperatingSystem.Id == OperatingSystemId.Darwin)
{
return true;
}
return false;
}
}
@@ -205,7 +213,7 @@ namespace Emby.Server.Implementations
/// Gets or sets the configuration manager.
/// </summary>
/// <value>The configuration manager.</value>
public ServerConfigurationManager ConfigurationManager { get; set; }
protected IConfigurationManager ConfigurationManager { get; set; }
/// <summary>
/// Gets or sets the service provider.
@@ -227,6 +235,12 @@ namespace Emby.Server.Implementations
/// </summary>
public string PublishedServerUrl => _startupOptions.PublishedServerUrl ?? _startupConfig[UdpServer.AddressOverrideConfigKey];
/// <summary>
/// Gets the server configuration manager.
/// </summary>
/// <value>The server configuration manager.</value>
public IServerConfigurationManager ServerConfigurationManager => (IServerConfigurationManager)ConfigurationManager;
/// <summary>
/// Initializes a new instance of the <see cref="ApplicationHost"/> class.
/// </summary>
@@ -244,26 +258,44 @@ namespace Emby.Server.Implementations
IFileSystem fileSystem,
IServiceCollection serviceCollection)
{
ApplicationPaths = applicationPaths;
LoggerFactory = loggerFactory;
_startupOptions = options;
_startupConfig = startupConfig;
_fileSystemManager = fileSystem;
_xmlSerializer = new MyXmlSerializer();
_jsonSerializer = new JsonSerializer();
ServiceCollection = serviceCollection;
ApplicationPaths = applicationPaths;
LoggerFactory = loggerFactory;
_fileSystemManager = fileSystem;
ConfigurationManager = new ServerConfigurationManager(ApplicationPaths, LoggerFactory, _xmlSerializer, _fileSystemManager);
// Have to migrate settings here as migration subsystem not yet initialised.
MigrateNetworkConfiguration();
// Have to pre-register the NetworkConfigurationFactory, as the configuration sub-system is not yet initialised.
ConfigurationManager.RegisterConfiguration<NetworkConfigurationFactory>();
NetManager = new NetworkManager((IServerConfigurationManager)ConfigurationManager, LoggerFactory.CreateLogger<NetworkManager>());
Logger = LoggerFactory.CreateLogger<ApplicationHost>();
_startupOptions = options;
_startupConfig = startupConfig;
// Initialize runtime stat collection
if (ServerConfigurationManager.Configuration.EnableMetrics)
{
DotNetRuntimeStatsBuilder.Default().StartCollecting();
}
fileSystem.AddShortcutHandler(new MbLinkShortcutHandler(fileSystem));
ApplicationVersion = typeof(ApplicationHost).Assembly.GetName().Version;
ApplicationVersionString = ApplicationVersion.ToString(3);
ApplicationUserAgent = Name.Replace(' ', '-') + "/" + ApplicationVersionString;
_xmlSerializer = new MyXmlSerializer();
ConfigurationManager = new ServerConfigurationManager(ApplicationPaths, LoggerFactory, _xmlSerializer, _fileSystemManager);
_pluginManager = new PluginManager(
LoggerFactory.CreateLogger<PluginManager>(),
this,
ConfigurationManager.Configuration,
ServerConfigurationManager.Configuration,
ApplicationPaths.PluginsPath,
ApplicationVersion);
}
@@ -278,9 +310,9 @@ namespace Emby.Server.Implementations
if (!File.Exists(path))
{
var networkSettings = new NetworkConfiguration();
ClassMigrationHelper.CopyProperties(ConfigurationManager.Configuration, networkSettings);
ClassMigrationHelper.CopyProperties(ServerConfigurationManager.Configuration, networkSettings);
_xmlSerializer.SerializeToFile(networkSettings, path);
Logger.LogDebug("Successfully migrated network settings.");
Logger?.LogDebug("Successfully migrated network settings.");
}
}
@@ -330,7 +362,10 @@ namespace Emby.Server.Implementations
{
get
{
_deviceId ??= new DeviceId(ApplicationPaths, LoggerFactory);
if (_deviceId == null)
{
_deviceId = new DeviceId(ApplicationPaths, LoggerFactory);
}
return _deviceId.Value;
}
@@ -350,7 +385,7 @@ namespace Emby.Server.Implementations
/// <summary>
/// Creates an instance of type and resolves all constructor dependencies.
/// </summary>
/// <typeparam name="T">The type.</typeparam>
/// /// <typeparam name="T">The type.</typeparam>
/// <returns>T.</returns>
public T CreateInstance<T>()
=> ActivatorUtilities.CreateInstance<T>(ServiceProvider);
@@ -362,7 +397,10 @@ namespace Emby.Server.Implementations
/// <returns>System.Object.</returns>
protected object CreateInstanceSafe(Type type)
{
_creatingInstances ??= new List<Type>();
if (_creatingInstances == null)
{
_creatingInstances = new List<Type>();
}
if (_creatingInstances.IndexOf(type) != -1)
{
@@ -433,7 +471,7 @@ namespace Emby.Server.Implementations
}
/// <inheritdoc />
public IReadOnlyCollection<T> GetExports<T>(CreationDelegateFactory defaultFunc, bool manageLifetime = true)
public IReadOnlyCollection<T> GetExports<T>(CreationDelegate defaultFunc, bool manageLifetime = true)
{
// Convert to list so this isn't executed for each iteration
var parts = GetExportTypes<T>()
@@ -457,9 +495,8 @@ namespace Emby.Server.Implementations
/// Runs the startup tasks.
/// </summary>
/// <returns><see cref="Task" />.</returns>
public async Task RunStartupTasksAsync(CancellationToken cancellationToken)
public async Task RunStartupTasksAsync()
{
cancellationToken.ThrowIfCancellationRequested();
Logger.LogInformation("Running startup tasks");
Resolve<ITaskManager>().AddTasks(GetExports<IScheduledTask>(false));
@@ -473,21 +510,14 @@ namespace Emby.Server.Implementations
var entryPoints = GetExports<IServerEntryPoint>();
cancellationToken.ThrowIfCancellationRequested();
var stopWatch = new Stopwatch();
stopWatch.Start();
await Task.WhenAll(StartEntryPoints(entryPoints, true)).ConfigureAwait(false);
Logger.LogInformation("Executed all pre-startup entry points in {Elapsed:g}", stopWatch.Elapsed);
Logger.LogInformation("Core startup complete");
CoreStartupHasCompleted = true;
cancellationToken.ThrowIfCancellationRequested();
stopWatch.Restart();
await Task.WhenAll(StartEntryPoints(entryPoints, false)).ConfigureAwait(false);
Logger.LogInformation("Executed all post-startup entry points in {Elapsed:g}", stopWatch.Elapsed);
stopWatch.Stop();
@@ -511,21 +541,7 @@ namespace Emby.Server.Implementations
/// <inheritdoc/>
public void Init()
{
DiscoverTypes();
ConfigurationManager.AddParts(GetExports<IConfigurationFactory>());
// Have to migrate settings here as migration subsystem not yet initialised.
MigrateNetworkConfiguration();
NetManager = new NetworkManager(ConfigurationManager, LoggerFactory.CreateLogger<NetworkManager>());
// Initialize runtime stat collection
if (ConfigurationManager.Configuration.EnableMetrics)
{
DotNetRuntimeStatsBuilder.Default().StartCollecting();
}
var networkConfiguration = ConfigurationManager.GetNetworkConfiguration();
var networkConfiguration = ServerConfigurationManager.GetNetworkConfiguration();
HttpPort = networkConfiguration.HttpServerPortNumber;
HttpsPort = networkConfiguration.HttpsPortNumber;
@@ -543,6 +559,8 @@ namespace Emby.Server.Implementations
};
Certificate = GetCertificate(CertificateInfo);
DiscoverTypes();
RegisterServices();
_pluginManager.RegisterServices(ServiceCollection);
@@ -557,12 +575,13 @@ namespace Emby.Server.Implementations
ServiceCollection.AddMemoryCache();
ServiceCollection.AddSingleton<IServerConfigurationManager>(ConfigurationManager);
ServiceCollection.AddSingleton<IConfigurationManager>(ConfigurationManager);
ServiceCollection.AddSingleton(ConfigurationManager);
ServiceCollection.AddSingleton<IApplicationHost>(this);
ServiceCollection.AddSingleton<IPluginManager>(_pluginManager);
ServiceCollection.AddSingleton<IApplicationPaths>(ApplicationPaths);
ServiceCollection.AddSingleton<IJsonSerializer, JsonSerializer>();
ServiceCollection.AddSingleton(_fileSystemManager);
ServiceCollection.AddSingleton<TmdbClientManager>();
@@ -585,6 +604,8 @@ namespace Emby.Server.Implementations
ServiceCollection.AddSingleton<IServerApplicationHost>(this);
ServiceCollection.AddSingleton<IServerApplicationPaths>(ApplicationPaths);
ServiceCollection.AddSingleton(ServerConfigurationManager);
ServiceCollection.AddSingleton<ILocalizationManager, LocalizationManager>();
ServiceCollection.AddSingleton<IBlurayExaminer, BdInfoExaminer>();
@@ -596,8 +617,12 @@ namespace Emby.Server.Implementations
ServiceCollection.AddSingleton<IAuthenticationRepository, AuthenticationRepository>();
// TODO: Refactor to eliminate the circular dependency here so that Lazy<T> isn't required
ServiceCollection.AddTransient(provider => new Lazy<IDtoService>(provider.GetRequiredService<IDtoService>));
// TODO: Refactor to eliminate the circular dependency here so that Lazy<T> isn't required
ServiceCollection.AddTransient(provider => new Lazy<EncodingHelper>(provider.GetRequiredService<EncodingHelper>));
ServiceCollection.AddSingleton<IMediaEncoder, MediaBrowser.MediaEncoding.Encoder.MediaEncoder>();
ServiceCollection.AddSingleton<EncodingHelper>();
// TODO: Refactor to eliminate the circular dependencies here so that Lazy<T> isn't required
ServiceCollection.AddTransient(provider => new Lazy<ILibraryMonitor>(provider.GetRequiredService<ILibraryMonitor>));
@@ -662,14 +687,14 @@ namespace Emby.Server.Implementations
ServiceCollection.AddSingleton<ISubtitleEncoder, MediaBrowser.MediaEncoding.Subtitles.SubtitleEncoder>();
ServiceCollection.AddSingleton<EncodingHelper>();
ServiceCollection.AddSingleton<IAttachmentExtractor, MediaBrowser.MediaEncoding.Attachments.AttachmentExtractor>();
ServiceCollection.AddSingleton<TranscodingJobHelper>();
ServiceCollection.AddScoped<MediaInfoHelper>();
ServiceCollection.AddScoped<AudioHelper>();
ServiceCollection.AddScoped<DynamicHlsHelper>();
ServiceCollection.AddSingleton<IDirectoryService, DirectoryService>();
}
/// <summary>
@@ -714,7 +739,7 @@ namespace Emby.Server.Implementations
logger.LogInformation("Environment Variables: {EnvVars}", relevantEnvVars);
logger.LogInformation("Arguments: {Args}", commandLineArgs);
logger.LogInformation("Operating system: {OS}", MediaBrowser.Common.System.OperatingSystem.Name);
logger.LogInformation("Operating system: {OS}", OperatingSystem.Name);
logger.LogInformation("Architecture: {Architecture}", RuntimeInformation.OSArchitecture);
logger.LogInformation("64-Bit Process: {Is64Bit}", Environment.Is64BitProcess);
logger.LogInformation("User Interactive: {IsUserInteractive}", Environment.UserInteractive);
@@ -767,7 +792,7 @@ namespace Emby.Server.Implementations
{
// For now there's no real way to inject these properly
BaseItem.Logger = Resolve<ILogger<BaseItem>>();
BaseItem.ConfigurationManager = ConfigurationManager;
BaseItem.ConfigurationManager = ServerConfigurationManager;
BaseItem.LibraryManager = Resolve<ILibraryManager>();
BaseItem.ProviderManager = Resolve<IProviderManager>();
BaseItem.LocalizationManager = Resolve<ILocalizationManager>();
@@ -781,6 +806,7 @@ namespace Emby.Server.Implementations
UserView.CollectionManager = Resolve<ICollectionManager>();
BaseItem.MediaSourceManager = Resolve<IMediaSourceManager>();
CollectionFolder.XmlSerializer = _xmlSerializer;
CollectionFolder.JsonSerializer = Resolve<IJsonSerializer>();
CollectionFolder.ApplicationHost = this;
}
@@ -789,12 +815,13 @@ namespace Emby.Server.Implementations
/// </summary>
private void FindParts()
{
if (!ConfigurationManager.Configuration.IsPortAuthorized)
if (!ServerConfigurationManager.Configuration.IsPortAuthorized)
{
ConfigurationManager.Configuration.IsPortAuthorized = true;
ServerConfigurationManager.Configuration.IsPortAuthorized = true;
ConfigurationManager.SaveConfiguration();
}
ConfigurationManager.AddParts(GetExports<IConfigurationFactory>());
_pluginManager.CreatePlugins();
_urlPrefixes = GetUrlPrefixes().ToArray();
@@ -898,7 +925,7 @@ namespace Emby.Server.Implementations
protected void OnConfigurationUpdated(object sender, EventArgs e)
{
var requiresRestart = false;
var networkConfiguration = ConfigurationManager.GetNetworkConfiguration();
var networkConfiguration = ServerConfigurationManager.GetNetworkConfiguration();
// Don't do anything if these haven't been set yet
if (HttpPort != 0 && HttpsPort != 0)
@@ -907,10 +934,10 @@ namespace Emby.Server.Implementations
if (networkConfiguration.HttpServerPortNumber != HttpPort ||
networkConfiguration.HttpsPortNumber != HttpsPort)
{
if (ConfigurationManager.Configuration.IsPortAuthorized)
if (ServerConfigurationManager.Configuration.IsPortAuthorized)
{
ConfigurationManager.Configuration.IsPortAuthorized = false;
ConfigurationManager.SaveConfiguration();
ServerConfigurationManager.Configuration.IsPortAuthorized = false;
ServerConfigurationManager.SaveConfiguration();
requiresRestart = true;
}
@@ -951,7 +978,7 @@ namespace Emby.Server.Implementations
{
return true;
}
throw new FileNotFoundException(
string.Format(
CultureInfo.InvariantCulture,
@@ -1091,10 +1118,11 @@ namespace Emby.Server.Implementations
ItemsByNamePath = ApplicationPaths.InternalMetadataPath,
InternalMetadataPath = ApplicationPaths.InternalMetadataPath,
CachePath = ApplicationPaths.CachePath,
OperatingSystem = MediaBrowser.Common.System.OperatingSystem.Id.ToString(),
OperatingSystemDisplayName = MediaBrowser.Common.System.OperatingSystem.Name,
OperatingSystem = OperatingSystem.Id.ToString(),
OperatingSystemDisplayName = OperatingSystem.Name,
CanSelfRestart = CanSelfRestart,
CanLaunchWebBrowser = CanLaunchWebBrowser,
HasUpdateAvailable = HasUpdateAvailable,
TranscodingTempPath = ConfigurationManager.GetTranscodePath(),
ServerName = FriendlyName,
LocalAddress = GetSmartApiUrl(source),
@@ -1110,25 +1138,25 @@ namespace Emby.Server.Implementations
.Select(i => new WakeOnLanInfo(i))
.ToList();
public PublicSystemInfo GetPublicSystemInfo(IPAddress address)
public PublicSystemInfo GetPublicSystemInfo(IPAddress source)
{
return new PublicSystemInfo
{
Version = ApplicationVersionString,
ProductName = ApplicationProductName,
Id = SystemId,
OperatingSystem = MediaBrowser.Common.System.OperatingSystem.Id.ToString(),
OperatingSystem = OperatingSystem.Id.ToString(),
ServerName = FriendlyName,
LocalAddress = GetSmartApiUrl(address),
LocalAddress = GetSmartApiUrl(source),
StartupWizardCompleted = ConfigurationManager.CommonConfiguration.IsStartupWizardCompleted
};
}
/// <inheritdoc/>
public bool ListenWithHttps => Certificate != null && ConfigurationManager.GetNetworkConfiguration().EnableHttps;
public bool ListenWithHttps => Certificate != null && ServerConfigurationManager.GetNetworkConfiguration().EnableHttps;
/// <inheritdoc/>
public string GetSmartApiUrl(IPAddress remoteAddr, int? port = null)
public string GetSmartApiUrl(IPAddress ipAddress, int? port = null)
{
// Published server ends with a /
if (!string.IsNullOrEmpty(PublishedServerUrl))
@@ -1137,7 +1165,7 @@ namespace Emby.Server.Implementations
return PublishedServerUrl.Trim('/');
}
string smart = NetManager.GetBindInterface(remoteAddr, out port);
string smart = NetManager.GetBindInterface(ipAddress, out port);
// If the smartAPI doesn't start with http then treat it as a host or ip.
if (smart.StartsWith("http", StringComparison.OrdinalIgnoreCase))
{
@@ -1200,23 +1228,23 @@ namespace Emby.Server.Implementations
}
/// <inheritdoc/>
public string GetLocalApiUrl(string hostname, string scheme = null, int? port = null)
public string GetLocalApiUrl(string host, string scheme = null, int? port = null)
{
// NOTE: If no BaseUrl is set then UriBuilder appends a trailing slash, but if there is no BaseUrl it does
// not. For consistency, always trim the trailing slash.
return new UriBuilder
{
Scheme = scheme ?? (ListenWithHttps ? Uri.UriSchemeHttps : Uri.UriSchemeHttp),
Host = hostname,
Host = host,
Port = port ?? (ListenWithHttps ? HttpsPort : HttpPort),
Path = ConfigurationManager.GetNetworkConfiguration().BaseUrl
Path = ServerConfigurationManager.GetNetworkConfiguration().BaseUrl
}.ToString().TrimEnd('/');
}
public string FriendlyName =>
string.IsNullOrEmpty(ConfigurationManager.Configuration.ServerName)
string.IsNullOrEmpty(ServerConfigurationManager.Configuration.ServerName)
? Environment.MachineName
: ConfigurationManager.Configuration.ServerName;
: ServerConfigurationManager.Configuration.ServerName;
/// <summary>
/// Shuts down.
@@ -1244,6 +1272,26 @@ namespace Emby.Server.Implementations
protected abstract void ShutdownInternal();
public event EventHandler HasUpdateAvailableChanged;
private bool _hasUpdateAvailable;
public bool HasUpdateAvailable
{
get => _hasUpdateAvailable;
set
{
var fireEvent = value && !_hasUpdateAvailable;
_hasUpdateAvailable = value;
if (fireEvent)
{
HasUpdateAvailableChanged?.Invoke(this, EventArgs.Empty);
}
}
}
public IEnumerable<Assembly> GetApiPluginAssemblies()
{
var assemblies = _allConcreteTypes

View File

@@ -1,17 +1,13 @@
#nullable disable
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
using Jellyfin.Data.Entities;
using Jellyfin.Data.Enums;
using MediaBrowser.Common.Extensions;
using Jellyfin.Extensions.Json;
using MediaBrowser.Common.Progress;
using MediaBrowser.Controller.Channels;
using MediaBrowser.Controller.Configuration;
@@ -25,6 +21,7 @@ using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Serialization;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Logging;
using Episode = MediaBrowser.Controller.Entities.TV.Episode;
@@ -47,10 +44,10 @@ namespace Emby.Server.Implementations.Channels
private readonly ILogger<ChannelManager> _logger;
private readonly IServerConfigurationManager _config;
private readonly IFileSystem _fileSystem;
private readonly IJsonSerializer _jsonSerializer;
private readonly IProviderManager _providerManager;
private readonly IMemoryCache _memoryCache;
private readonly SemaphoreSlim _resourcePool = new SemaphoreSlim(1, 1);
private readonly JsonSerializerOptions _jsonOptions = JsonDefaults.Options;
/// <summary>
/// Initializes a new instance of the <see cref="ChannelManager"/> class.
@@ -62,6 +59,7 @@ namespace Emby.Server.Implementations.Channels
/// <param name="config">The server configuration manager.</param>
/// <param name="fileSystem">The filesystem.</param>
/// <param name="userDataManager">The user data manager.</param>
/// <param name="jsonSerializer">The JSON serializer.</param>
/// <param name="providerManager">The provider manager.</param>
/// <param name="memoryCache">The memory cache.</param>
public ChannelManager(
@@ -72,6 +70,7 @@ namespace Emby.Server.Implementations.Channels
IServerConfigurationManager config,
IFileSystem fileSystem,
IUserDataManager userDataManager,
IJsonSerializer jsonSerializer,
IProviderManager providerManager,
IMemoryCache memoryCache)
{
@@ -82,6 +81,7 @@ namespace Emby.Server.Implementations.Channels
_config = config;
_fileSystem = fileSystem;
_userDataManager = userDataManager;
_jsonSerializer = jsonSerializer;
_providerManager = providerManager;
_memoryCache = memoryCache;
}
@@ -337,23 +337,21 @@ namespace Emby.Server.Implementations.Channels
return GetChannel(GetInternalChannelId(channel.Name)) ?? GetChannel(channel, CancellationToken.None).Result;
}
private MediaSourceInfo[] GetSavedMediaSources(BaseItem item)
private List<MediaSourceInfo> GetSavedMediaSources(BaseItem item)
{
var path = Path.Combine(item.GetInternalMetadataPath(), "channelmediasourceinfos.json");
try
{
var bytes = File.ReadAllBytes(path);
return JsonSerializer.Deserialize<MediaSourceInfo[]>(bytes, _jsonOptions)
?? Array.Empty<MediaSourceInfo>();
return _jsonSerializer.DeserializeFromFile<List<MediaSourceInfo>>(path) ?? new List<MediaSourceInfo>();
}
catch
{
return Array.Empty<MediaSourceInfo>();
return new List<MediaSourceInfo>();
}
}
private async Task SaveMediaSources(BaseItem item, List<MediaSourceInfo> mediaSources)
private void SaveMediaSources(BaseItem item, List<MediaSourceInfo> mediaSources)
{
var path = Path.Combine(item.GetInternalMetadataPath(), "channelmediasourceinfos.json");
@@ -372,8 +370,7 @@ namespace Emby.Server.Implementations.Channels
Directory.CreateDirectory(Path.GetDirectoryName(path));
await using FileStream createStream = File.Create(path);
await JsonSerializer.SerializeAsync(createStream, mediaSources, _jsonOptions).ConfigureAwait(false);
_jsonSerializer.SerializeToFile(mediaSources, path);
}
/// <inheritdoc />
@@ -815,8 +812,7 @@ namespace Emby.Server.Implementations.Channels
{
if (_fileSystem.GetLastWriteTimeUtc(cachePath).Add(cacheLength) > DateTime.UtcNow)
{
await using FileStream jsonStream = File.OpenRead(cachePath);
var cachedResult = await JsonSerializer.DeserializeAsync<ChannelItemResult>(jsonStream, _jsonOptions, cancellationToken).ConfigureAwait(false);
var cachedResult = _jsonSerializer.DeserializeFromFile<ChannelItemResult>(cachePath);
if (cachedResult != null)
{
return null;
@@ -838,8 +834,7 @@ namespace Emby.Server.Implementations.Channels
{
if (_fileSystem.GetLastWriteTimeUtc(cachePath).Add(cacheLength) > DateTime.UtcNow)
{
await using FileStream jsonStream = File.OpenRead(cachePath);
var cachedResult = await JsonSerializer.DeserializeAsync<ChannelItemResult>(jsonStream, _jsonOptions, cancellationToken).ConfigureAwait(false);
var cachedResult = _jsonSerializer.DeserializeFromFile<ChannelItemResult>(cachePath);
if (cachedResult != null)
{
return null;
@@ -870,7 +865,7 @@ namespace Emby.Server.Implementations.Channels
throw new InvalidOperationException("Channel returned a null result from GetChannelItems");
}
await CacheResponse(result, cachePath);
CacheResponse(result, cachePath);
return result;
}
@@ -880,14 +875,13 @@ namespace Emby.Server.Implementations.Channels
}
}
private async Task CacheResponse(ChannelItemResult result, string path)
private void CacheResponse(object result, string path)
{
try
{
Directory.CreateDirectory(Path.GetDirectoryName(path));
await using FileStream createStream = File.Create(path);
await JsonSerializer.SerializeAsync(createStream, result, _jsonOptions).ConfigureAwait(false);
_jsonSerializer.SerializeToFile(result, path);
}
catch (Exception ex)
{
@@ -1182,11 +1176,11 @@ namespace Emby.Server.Implementations.Channels
{
if (enableMediaProbe && !info.IsLiveStream && item.HasPathProtocol)
{
await SaveMediaSources(item, new List<MediaSourceInfo>()).ConfigureAwait(false);
SaveMediaSources(item, new List<MediaSourceInfo>());
}
else
{
await SaveMediaSources(item, info.MediaSources).ConfigureAwait(false);
SaveMediaSources(item, info.MediaSources);
}
}

View File

@@ -82,9 +82,9 @@ namespace Emby.Server.Implementations.Collections
return null;
})
.Where(i => i != null)
.GroupBy(x => x!.Id) // We removed the null values
.GroupBy(x => x.Id)
.Select(x => x.First())
.ToList()!; // Again... the list doesn't contain any null values
.ToList();
}
/// <inheritdoc />

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Threading;
@@ -7,9 +8,11 @@ using System.Threading.Tasks;
using Jellyfin.Data.Entities;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Collections;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Plugins;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
@@ -61,13 +64,13 @@ namespace Emby.Server.Implementations.Collections
}
/// <inheritdoc />
public event EventHandler<CollectionCreatedEventArgs>? CollectionCreated;
public event EventHandler<CollectionCreatedEventArgs> CollectionCreated;
/// <inheritdoc />
public event EventHandler<CollectionModifiedEventArgs>? ItemsAddedToCollection;
public event EventHandler<CollectionModifiedEventArgs> ItemsAddedToCollection;
/// <inheritdoc />
public event EventHandler<CollectionModifiedEventArgs>? ItemsRemovedFromCollection;
public event EventHandler<CollectionModifiedEventArgs> ItemsRemovedFromCollection;
private IEnumerable<Folder> FindFolders(string path)
{
@@ -78,12 +81,14 @@ namespace Emby.Server.Implementations.Collections
.Where(i => _fileSystem.AreEqual(path, i.Path) || _fileSystem.ContainsSubPath(i.Path, path));
}
internal async Task<Folder?> EnsureLibraryFolder(string path, bool createIfNeeded)
internal async Task<Folder> EnsureLibraryFolder(string path, bool createIfNeeded)
{
var existingFolder = FindFolders(path).FirstOrDefault();
if (existingFolder != null)
var existingFolders = FindFolders(path)
.ToList();
if (existingFolders.Count > 0)
{
return existingFolder;
return existingFolders[0];
}
if (!createIfNeeded)
@@ -112,7 +117,7 @@ namespace Emby.Server.Implementations.Collections
return Path.Combine(_appPaths.DataPath, "collections");
}
private Task<Folder?> GetCollectionsFolder(bool createIfNeeded)
private Task<Folder> GetCollectionsFolder(bool createIfNeeded)
{
return EnsureLibraryFolder(GetCollectionsFolderPath(), createIfNeeded);
}
@@ -160,9 +165,9 @@ namespace Emby.Server.Implementations.Collections
DateCreated = DateTime.UtcNow
};
parentFolder.AddChild(collection);
parentFolder.AddChild(collection, CancellationToken.None);
if (options.ItemIdList.Count > 0)
if (options.ItemIdList.Length > 0)
{
await AddToCollectionAsync(
collection.Id,
@@ -201,7 +206,8 @@ namespace Emby.Server.Implementations.Collections
private async Task AddToCollectionAsync(Guid collectionId, IEnumerable<Guid> ids, bool fireEvent, MetadataRefreshOptions refreshOptions)
{
if (_libraryManager.GetItemById(collectionId) is not BoxSet collection)
var collection = _libraryManager.GetItemById(collectionId) as BoxSet;
if (collection == null)
{
throw new ArgumentException("No collection exists with the supplied Id");
}
@@ -245,7 +251,11 @@ namespace Emby.Server.Implementations.Collections
if (fireEvent)
{
ItemsAddedToCollection?.Invoke(this, new CollectionModifiedEventArgs(collection, itemList));
ItemsAddedToCollection?.Invoke(this, new CollectionModifiedEventArgs
{
Collection = collection,
ItemsChanged = itemList
});
}
}
}
@@ -253,7 +263,9 @@ namespace Emby.Server.Implementations.Collections
/// <inheritdoc />
public async Task RemoveFromCollectionAsync(Guid collectionId, IEnumerable<Guid> itemIds)
{
if (_libraryManager.GetItemById(collectionId) is not BoxSet collection)
var collection = _libraryManager.GetItemById(collectionId) as BoxSet;
if (collection == null)
{
throw new ArgumentException("No collection exists with the supplied Id");
}
@@ -295,7 +307,11 @@ namespace Emby.Server.Implementations.Collections
},
RefreshPriority.High);
ItemsRemovedFromCollection?.Invoke(this, new CollectionModifiedEventArgs(collection, itemList));
ItemsRemovedFromCollection?.Invoke(this, new CollectionModifiedEventArgs
{
Collection = collection,
ItemsChanged = itemList
});
}
/// <inheritdoc />
@@ -307,7 +323,11 @@ namespace Emby.Server.Implementations.Collections
foreach (var item in items)
{
if (item is ISupportsBoxSetGrouping)
if (item is not ISupportsBoxSetGrouping)
{
results[item.Id] = item;
}
else
{
var itemId = item.Id;
@@ -331,7 +351,6 @@ namespace Emby.Server.Implementations.Collections
}
var alreadyInResults = false;
// this is kind of a performance hack because only Video has alternate versions that should be in a box set?
if (item is Video video)
{
@@ -347,13 +366,11 @@ namespace Emby.Server.Implementations.Collections
}
}
if (alreadyInResults)
if (!alreadyInResults)
{
continue;
results[itemId] = item;
}
}
results[item.Id] = item;
}
return results.Values;

View File

@@ -1,5 +1,3 @@
#nullable disable
using System;
using System.Globalization;
using System.IO;

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using Emby.Server.Implementations.HttpServer;
using static MediaBrowser.Controller.Extensions.ConfigurationExtensions;
namespace Emby.Server.Implementations

View File

@@ -1,3 +1,5 @@
#nullable enable
using System;
using System.Collections.Generic;
using System.Security.Cryptography;

View File

@@ -1,5 +1,3 @@
#nullable disable
#pragma warning disable CS1591
using System;
@@ -183,9 +181,11 @@ namespace Emby.Server.Implementations.Data
foreach (var row in connection.Query("PRAGMA table_info(" + table + ")"))
{
if (row.TryGetString(1, out var columnName))
if (row[1].SQLiteType != SQLiteType.Null)
{
columnNames.Add(columnName);
var name = row[1].ToString();
columnNames.Add(name);
}
}

View File

@@ -9,7 +9,7 @@ namespace Emby.Server.Implementations.Data
{
public class ManagedConnection : IDisposable
{
private SQLiteDatabaseConnection? _db;
private SQLiteDatabaseConnection _db;
private readonly SemaphoreSlim _writeLock;
private bool _disposed = false;
@@ -54,12 +54,12 @@ namespace Emby.Server.Implementations.Data
return _db.RunInTransaction(action, mode);
}
public IEnumerable<IReadOnlyList<ResultSetValue>> Query(string sql)
public IEnumerable<IReadOnlyList<IResultSetValue>> Query(string sql)
{
return _db.Query(sql);
}
public IEnumerable<IReadOnlyList<ResultSetValue>> Query(string sql, params object[] values)
public IEnumerable<IReadOnlyList<IResultSetValue>> Query(string sql, params object[] values)
{
return _db.Query(sql, values);
}

Some files were not shown because too many files have changed in this diff Show More