mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-26 12:05:04 +01:00
create collections from movies page
This commit is contained in:
@@ -674,14 +674,19 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
{
|
||||
var folder = child.GetFolder();
|
||||
|
||||
if (folder.Id == Guid.Empty)
|
||||
if (folder != null)
|
||||
{
|
||||
folder.Id = (folder.Path ?? folder.GetType().Name).GetMBId(folder.GetType());
|
||||
if (folder.Id == Guid.Empty)
|
||||
{
|
||||
folder.Id = (folder.Path ?? folder.GetType().Name).GetMBId(folder.GetType());
|
||||
}
|
||||
|
||||
folder = GetItemById(folder.Id) as BasePluginFolder ?? folder;
|
||||
|
||||
rootFolder.AddVirtualChild(folder);
|
||||
|
||||
RegisterItem(folder);
|
||||
}
|
||||
|
||||
rootFolder.AddVirtualChild(folder);
|
||||
|
||||
RegisterItem(folder);
|
||||
}
|
||||
|
||||
return rootFolder;
|
||||
|
||||
@@ -115,7 +115,8 @@
|
||||
"HeaderSplitMedia": "Split Media Apart",
|
||||
"MessageConfirmSplitMedia": "Are you sure you wish to split the media sources into separate items?",
|
||||
"HeaderError": "Error",
|
||||
"MessagePleaseSelectItemsToGroup": "Please select two or more items to group together.",
|
||||
"MessagePleaseSelectOneItem": "Please select at least one item.",
|
||||
"MessagePleaseSelectTwoItems": "Please select at least two items.",
|
||||
"MessageTheFollowingItemsWillBeGrouped": "The following titles will be grouped into one item:",
|
||||
"MessageConfirmItemGrouping": "Media Browser clients will automatically choose the optimal version to play based on device and network performance. Are you sure you wish to continue?",
|
||||
"HeaderResume": "Resume",
|
||||
@@ -138,5 +139,6 @@
|
||||
"HeaderSelectImagesByNamePathHelp": "Browse or enter the path to your items by name folder. The folder must be writeable.",
|
||||
"HeaderSelectMetadataPathHelp": "Browse or enter the path you'd like to store metadata within. The folder must be writeable.",
|
||||
"HeaderSelectChannelDownloadPath": "Select Channel Download Path",
|
||||
"HeaderSelectChannelDownloadPathHelp": "Browse or enter the path to use for storing channel cache files. The folder must be writeable."
|
||||
"HeaderSelectChannelDownloadPathHelp": "Browse or enter the path to use for storing channel cache files. The folder must be writeable.",
|
||||
"OptionNewCollection": "New..."
|
||||
}
|
||||
@@ -234,6 +234,7 @@
|
||||
"ButtonSelect": "Select",
|
||||
"ButtonSearch": "Search",
|
||||
"ButtonGroupVersions": "Group Versions",
|
||||
"ButtonAddToCollection": "Add to Collection",
|
||||
"PismoMessage": "Utilizing Pismo File Mount through a donated license.",
|
||||
"TangibleSoftwareMessage": "Utilizing Tangible Solutions Java/C# converters through a donated license.",
|
||||
"HeaderCredits": "Credits",
|
||||
@@ -452,6 +453,8 @@
|
||||
"LabelPreferredDisplayLanguageHelp": "Translating Media Browser is an ongoing project and is not yet complete.",
|
||||
"LabelReadHowYouCanContribute": "Read about how you can contribute.",
|
||||
"HeaderNewCollection": "New Collection",
|
||||
"HeaderAddToCollection": "Add to Collection",
|
||||
"ButtonSubmit": "Submit",
|
||||
"NewCollectionNameExample": "Example: Star Wars Collection",
|
||||
"OptionSearchForInternetMetadata": "Search the internet for artwork and metadata",
|
||||
"ButtonCreate": "Create",
|
||||
@@ -807,5 +810,6 @@
|
||||
"LabelChannelDownloadPathHelp": "Specify a custom download path if desired. Leave empty to download to an internal program data folder.",
|
||||
"LabelChannelDownloadAge": "Delete content after: (days)",
|
||||
"LabelChannelDownloadAgeHelp": "Downloaded content older than this will be deleted. It will remain playable via internet streaming.",
|
||||
"ChannelSettingsFormHelp": "Install channels such as Trailers and Vimeo in the plugin catalog."
|
||||
"ChannelSettingsFormHelp": "Install channels such as Trailers and Vimeo in the plugin catalog.",
|
||||
"LabelSelectCollection": "Select collection:"
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using MediaBrowser.Common.Events;
|
||||
using System.IO;
|
||||
using MediaBrowser.Common.Events;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller;
|
||||
@@ -142,6 +143,16 @@ namespace MediaBrowser.Server.Implementations.Session
|
||||
SessionInfo = info
|
||||
|
||||
}, _logger);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(info.DeviceId))
|
||||
{
|
||||
var capabilities = GetSavedCapabilities(info.DeviceId);
|
||||
|
||||
if (capabilities != null)
|
||||
{
|
||||
ReportCapabilities(info, capabilities, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async void OnSessionEnded(SessionInfo info)
|
||||
@@ -237,7 +248,7 @@ namespace MediaBrowser.Server.Implementations.Session
|
||||
{
|
||||
return session;
|
||||
}
|
||||
|
||||
|
||||
// Save this directly. No need to fire off all the events for this.
|
||||
await _userRepository.SaveUser(user, CancellationToken.None).ConfigureAwait(false);
|
||||
|
||||
@@ -1148,6 +1159,13 @@ namespace MediaBrowser.Server.Implementations.Session
|
||||
{
|
||||
var session = GetSession(sessionId);
|
||||
|
||||
ReportCapabilities(session, capabilities, true);
|
||||
}
|
||||
|
||||
private async void ReportCapabilities(SessionInfo session,
|
||||
SessionCapabilities capabilities,
|
||||
bool saveCapabilities)
|
||||
{
|
||||
session.PlayableMediaTypes = capabilities.PlayableMediaTypes;
|
||||
session.SupportedCommands = capabilities.SupportedCommands;
|
||||
|
||||
@@ -1168,6 +1186,59 @@ namespace MediaBrowser.Server.Implementations.Session
|
||||
SessionInfo = session
|
||||
|
||||
}, _logger);
|
||||
|
||||
if (saveCapabilities)
|
||||
{
|
||||
await SaveCapabilities(session.DeviceId, capabilities).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
private string GetCapabilitiesFilePath(string deviceId)
|
||||
{
|
||||
var filename = deviceId.GetMD5().ToString("N") + ".json";
|
||||
|
||||
return Path.Combine(_configurationManager.ApplicationPaths.CachePath, "devices", filename);
|
||||
}
|
||||
|
||||
private SessionCapabilities GetSavedCapabilities(string deviceId)
|
||||
{
|
||||
var path = GetCapabilitiesFilePath(deviceId);
|
||||
|
||||
try
|
||||
{
|
||||
return _jsonSerializer.DeserializeFromFile<SessionCapabilities>(path);
|
||||
}
|
||||
catch (DirectoryNotFoundException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
catch (FileNotFoundException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.ErrorException("Error getting saved capabilities", ex);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private readonly SemaphoreSlim _capabilitiesLock = new SemaphoreSlim(1, 1);
|
||||
private async Task SaveCapabilities(string deviceId, SessionCapabilities capabilities)
|
||||
{
|
||||
var path = GetCapabilitiesFilePath(deviceId);
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
||||
|
||||
await _capabilitiesLock.WaitAsync().ConfigureAwait(false);
|
||||
|
||||
try
|
||||
{
|
||||
_jsonSerializer.SerializeToFile(capabilities, path);
|
||||
}
|
||||
finally
|
||||
{
|
||||
_capabilitiesLock.Release();
|
||||
}
|
||||
}
|
||||
|
||||
public SessionInfoDto GetSessionInfoDto(SessionInfo session)
|
||||
|
||||
Reference in New Issue
Block a user