示例#1
0
        public async Task <PlexLibrariesLiteResponse> GetPlexLibraries(string machineId)
        {
            try
            {
                var s = await PlexSettings.GetSettingsAsync();

                var settings = s.Servers.FirstOrDefault(x => x.MachineIdentifier == machineId);
                var libs     = await PlexApi.GetLibrariesForMachineId(settings.PlexAuthToken, machineId);

                return(new PlexLibrariesLiteResponse
                {
                    Successful = true,
                    Data = libs.Server.Section
                });
            }
            catch (Exception e)
            {
                _log.LogWarning(e, "Error thrown when attempting to obtain the plex libs");

                var message = e.InnerException != null ? $"{e.Message} - {e.InnerException.Message}" : e.Message;
                return(new PlexLibrariesLiteResponse
                {
                    Successful = false,
                    Message = message
                });
            }
        }