Exemple #1
0
        public bool StopTimeshift(string userName, int slotIndex)
        {
            IUser user;
            IInternalControllerService control = GlobalServiceProvider.Get <IInternalControllerService>();

            return(control.StopTimeShifting(GetUserName(userName, slotIndex), out user));
        }
Exemple #2
0
        private string SwitchTVServerToChannel(string userName, int channelId)
        {
            if (String.IsNullOrEmpty(userName))
            {
                ServiceRegistration.Get <ILogger>().Error("Called SwitchTVServerToChannel with empty userName");
                throw new ArgumentNullException("userName");
            }

            IUser currentUser = UserFactory.CreateBasicUser(userName, -1);

            ServiceRegistration.Get <ILogger>().Debug("Starting timeshifiting with username {0} on channel id {1}", userName, channelId);

            IInternalControllerService control = GlobalServiceProvider.Get <IInternalControllerService>();

            IVirtualCard card;
            IUser        user;
            TvResult     result = control.StartTimeShifting(currentUser.Name, channelId, out card, out user);

            ServiceRegistration.Get <ILogger>().Debug("Tried to start timeshifting, result {0}", result);

            if (result != TvResult.Succeeded)
            {
                // TODO: should we retry?
                ServiceRegistration.Get <ILogger>().Error("Starting timeshifting failed with result {0}", result);
                throw new Exception("Failed to start tv stream: " + result);
            }
            return(userName.StartsWith(LOCAL_USERNAME + "-") ? card.TimeShiftFileName : card.RTSPUrl);
        }
Exemple #3
0
        public override Task <bool> StopTimeshiftAsync(string userName, int slotIndex)
        {
            IUser user;
            IInternalControllerService control = GlobalServiceProvider.Instance.Get <IInternalControllerService>();
            var name   = GetUserName(userName, slotIndex);
            var result = control.StopTimeShifting(name, out user);

            return(Task.FromResult(result));
        }
Exemple #4
0
        public bool StopTimeshift(string userName, int slotIndex)
        {
            IUser user;

#if TVE3
            user = GetUserByUserName(GetUserName(userName, slotIndex));
            if (user == null)
            {
                return(false);
            }
            return(_tvControl.StopTimeShifting(ref user));
#else
            IInternalControllerService control = GlobalServiceProvider.Instance.Get <IInternalControllerService>();
            return(control.StopTimeShifting(GetUserName(userName, slotIndex), out user));
#endif
        }
        protected void UpdateServerState()
        {
            IInternalControllerService controller = GlobalServiceProvider.Instance.Get <IInternalControllerService>();
            IRecordingService          recordings = GlobalServiceProvider.Get <IRecordingService>();
            IList <ISchedule>          currentlyRecordingSchedules = recordings.ListAllActiveRecordingsByMediaType(MediaTypeEnum.TV)
                                                                     .Union(recordings.ListAllActiveRecordingsByMediaType(MediaTypeEnum.Radio))
                                                                     .Select(r => r.Schedule.ToSchedule()).ToList();

            TvServerState state = new TvServerState
            {
                IsRecording = controller.IsAnyCardRecording(),
                CurrentlyRecordingSchedules = currentlyRecordingSchedules
            };

            ServiceRegistration.Get <IServerStateService>().UpdateState(TvServerState.STATE_ID, state);
        }
Exemple #6
0
        public override Task <AsyncResult <List <ICard> > > GetCardsAsync()
        {
            IInternalControllerService control = GlobalServiceProvider.Instance.Get <IInternalControllerService>();
            List <ICard> cards = control.CardCollection.Select(card => new SlimTvCard()
            {
                Name            = card.Value.CardName,
                CardId          = card.Value.Card.TunerId,
                EpgIsGrabbing   = card.Value.Epg.IsGrabbing,
                HasCam          = card.Value.DataBaseCard.UseConditionalAccess,
                CamType         = card.Value.Card.CamType == CamType.Default ? SlimTvCamType.Default : SlimTvCamType.Astoncrypt2,
                DecryptLimit    = card.Value.DataBaseCard.DecryptLimit, Enabled = card.Value.DataBaseCard.Enabled,
                RecordingFolder = card.Value.DataBaseCard.RecordingFolder,
                TimeshiftFolder = card.Value.DataBaseCard.TimeshiftingFolder,
                DevicePath      = card.Value.DataBaseCard.DevicePath,
                PreloadCard     = card.Value.DataBaseCard.PreloadCard,
                Priority        = card.Value.DataBaseCard.Priority
            }).Cast <ICard>().ToList();

            return(Task.FromResult(new AsyncResult <List <ICard> >(cards.Count > 0, cards)));
        }
Exemple #7
0
 public void Start(IInternalControllerService controller)