示例#1
0
        private static void UpdateOneTimeRequest(ScheduleEntry wmc)
        {
            using (var allRecordings = new Recordings(WmcStore.WmcObjectStore))
            {
                var programContentKey = new ProgramContentKey(wmc.ProgramContent);
                var recordings        = (Recordings)allRecordings.WhereKeyIsInRange(programContentKey, programContentKey);
                if (!recordings.Any())
                {
                    return;
                }

                var enumerator = recordings.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    var recordingToUpdate = (Recording)enumerator.Current;
                    if (!(recordingToUpdate?.Request is OneTimeRequest))
                    {
                        continue;
                    }
                    recordingToUpdate.Update(delegate
                    {
                        recordingToUpdate.Program = wmc.Program;
                    });
                    Logger.WriteWarning($"OneTimeRequest recording on {wmc.Service.CallSign} at {wmc.StartTime.ToLocalTime()} was updated to record [{wmc.Program.Title}]-[{wmc.Program.EpisodeTitle}].");
                }
            }
        }
示例#2
0
        private static void RemoveScheduleEntry(ScheduleEntry wmc)
        {
            if (wmc.ProgramContent == null)
            {
                goto RemoveEntry;
            }
            using (var allRecordings = new Recordings(WmcStore.WmcObjectStore))
            {
                var programContentKey = new ProgramContentKey(wmc.ProgramContent);
                var recordings        = (Recordings)allRecordings.WhereKeyIsInRange(programContentKey, programContentKey);
                if (recordings.Any())
                {
                    var enumerator = recordings.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        var recordingAffected = (Recording)enumerator.Current;
                        if (recordingAffected?.Request is OneTimeRequest)
                        {
                            Logger.WriteWarning($"OneTimeRequest recording on {wmc.Service.CallSign} at {wmc.StartTime.ToLocalTime()} for [{wmc.Program.Title}]-[{wmc.Program.EpisodeTitle}] may have been rescheduled or is no longer valid. Check your guide.");
                        }
                    }
                }
            }

RemoveEntry:
            wmc.Unlock();
            wmc.Update(delegate
            {
                wmc.Service = null;
                wmc.Program = null;
            });
        }
        private void OnLoadRecordings()
        {
            try
            {
                for (int i = 0; i < Recordings.Count; i++)
                {
                    Recordings.RemoveAt(i);
                }

                RegionManager.Regions[RegionNames.RecordingRegion].RemoveAll();

                foreach (var recording in TvHeadend.GetRecordings())
                {
                    Recordings.Add(recording);
                }

                foreach (var recording in Recordings.OrderBy(r => r.Start))
                {
                    var navigationParams = new NavigationParameters {
                        { "DataContext", recording }
                    };
                    RegionManager.RequestNavigate(RegionNames.RecordingRegion, new Uri("Recording", UriKind.Relative), NavigationCompleted, navigationParams);
                }

                EventAggregator.GetEvent <StatusChangedEvent>().Publish(new StatusInfo($"{Recordings.Count} Recordings."));
            }
            catch (Exception ex)
            {
                EventAggregator.GetEvent <StatusChangedEvent>().Publish(new StatusInfo(ex.Message));
            }
        }
示例#4
0
        private void ButtonSave(object sender, RoutedEventArgs e)
        {
            if (!Playlist.Any())
            {
                this.ShowMessageAsync("No Recording", string.Format("Playlist empty"));
                return;
            }

            if (!File.Exists(Playlist.First().GetFullPath()))
            {
                this.ShowMessageAsync("No Recording", string.Format("Recording file {0} could not be found", Playlist.First().GetFullPath()));
                return;
            }

            var fileDialog = new SaveFileDialog();

            fileDialog.InitialDirectory = RecordingDir;
            fileDialog.Filter           = "TKinectRecording (*.xed)|*.xed|All Files (*.*)|*.*";
            fileDialog.FilterIndex      = 1;

            bool?userClickedOk = fileDialog.ShowDialog();

            if (userClickedOk == true)
            {
                File.Copy(Path.Combine(TempRecordingDir, TempRecordingName), fileDialog.FileName);

                var fileInfo = new FileInfo(fileDialog.FileName);
                if (RecordingDir == fileInfo.DirectoryName)
                {
                    Recordings.Add(new Recording(fileInfo.Name, fileInfo.DirectoryName));
                }
            }
        }
示例#5
0
 private void CreateWorkingDirectory()
 {
     Directory.CreateDirectory(OutputFolder);
     foreach (var file in Directory.GetFiles(OutputFolder))
     {
         Recordings.Insert(0, file);
     }
 }
示例#6
0
        public RecordingsPresenter(Recordings view, Subscribe subscribe, ModelFactory modelFactory, AppStorage appStorage)
        {
            _view       = view;
            _subscribe  = subscribe;
            _appStorage = appStorage;

            recorder = new UserActionsRecorder(_subscribe, modelFactory);
            replier  = new Replier();

            Init();
        }
        /// <summary>
        /// The file HATEOAS link has the appropriate URI for downloading a wave file for the recording.
        /// The file is accessible only if you provide the correct API access key for your account and the recording is for a leg/call in your account.
        /// </summary>
        /// <param name="callId">The unique ID of a call generated upon creation.</param>
        /// <param name="legId">The unique ID of a leg generated upon creation.</param>
        /// <param name="recordingId">The unique ID of a recording generated upon creation.</param>
        public Stream DownloadRecording(string callId, string legId, string recordingId)
        {
            ParameterValidator.IsNotNullOrWhiteSpace(callId, "callId");
            ParameterValidator.IsNotNullOrWhiteSpace(legId, "legId");
            ParameterValidator.IsNotNullOrWhiteSpace(recordingId, "recordingId");

            var resource = new Recordings(new Recording {
                CallId = callId, LegId = legId, Id = recordingId
            });

            return(restClient.PerformHttpRequest(resource.DownloadUri, HttpStatusCode.OK, resource.BaseUrl));
        }
        /// <summary>
        /// This request deletes a recording. The parameters are the unique ID of the recording, the leg and the call with which the recording is associated.
        /// If successful, this request will return an HTTP header of 204 No Content and an empty response.
        /// If the request failed, an error object will be returned.
        /// </summary>
        /// <param name="callId">The unique ID of a call generated upon creation.</param>
        /// <param name="legId">The unique ID of a leg generated upon creation.</param>
        /// <param name="recordingId">The unique ID of a recording generated upon creation.</param>
        public void DeleteRecording(string callId, string legId, string recordingId)
        {
            ParameterValidator.IsNotNullOrWhiteSpace(callId, "callId");
            ParameterValidator.IsNotNullOrWhiteSpace(legId, "legId");
            ParameterValidator.IsNotNullOrWhiteSpace(recordingId, "recordingId");

            var resource = new Recordings(new Recording {
                CallId = callId, LegId = legId, Id = recordingId
            });

            restClient.Delete(resource);
        }
        public VoiceResponse <Recording> ViewRecording(string callId, string legId, string recordingId)
        {
            ParameterValidator.IsNotNullOrWhiteSpace(callId, "callId");
            ParameterValidator.IsNotNullOrWhiteSpace(legId, "legId");
            ParameterValidator.IsNotNullOrWhiteSpace(recordingId, "recordingId");

            var resource = new Recordings(new Recording {
                CallId = callId, LegId = legId, Id = recordingId
            });
            var result = restClient.Retrieve(resource);

            return((VoiceResponse <Recording>)result.Object);
        }
示例#10
0
        private static bool programRecording()
        {
            bool     active          = false;
            DateTime expireTime      = DateTime.Now + TimeSpan.FromHours(23);
            int      intervalMinutes = 60;

            do
            {
                active = false;
                DateTime timeReady = DateTime.Now;
                using (Recordings recordings = new Recordings(Store.objectStore))
                {
                    foreach (Recording recording in recordings)
                    {
                        if ((recording.State == RecordingState.Initializing) || (recording.State == RecordingState.Recording))
                        {
                            active = true;
                            Logger.WriteInformation(string.Format("Recording in progress: {0:hh:mm tt} - {1:hh:mm tt} on channel {2}{3} -> {4} - {5}",
                                                                  recording.ScheduleEntry.StartTime.ToLocalTime(),
                                                                  recording.ScheduleEntry.EndTime.ToLocalTime(),
                                                                  recording.Channel.ChannelNumber,
                                                                  (recording.ScheduleEntry.Service != null) ? " " + recording.ScheduleEntry.Service.CallSign : string.Empty,
                                                                  (recording.ScheduleEntry.Program != null) ? recording.ScheduleEntry.Program.Title : "unknown program title",
                                                                  (recording.ScheduleEntry.Program != null) ? recording.ScheduleEntry.Program.EpisodeTitle : string.Empty));
                            if (recording.RequestedEndTime.ToLocalTime() > timeReady)
                            {
                                timeReady = recording.RequestedEndTime.ToLocalTime();
                            }
                        }
                    }
                }

                if ((timeReady > DateTime.Now) && (DateTime.Now < expireTime))
                {
                    TimeSpan delay = TimeSpan.FromTicks(Math.Min((timeReady - DateTime.Now).Ticks + TimeSpan.FromMinutes(1).Ticks,
                                                                 TimeSpan.FromMinutes(intervalMinutes).Ticks));

                    notifyIcon.Text = "EPG123\nDelaying import due to recording in progress...";
                    notifyIcon.Icon = epg123.Properties.Resources.EPG123_pause;

                    Thread.Sleep((int)delay.TotalMilliseconds);
                }
                else
                {
                    notifyIcon.Icon = epg123.Properties.Resources.EPG123_import;
                    return(active);
                }
            } while (active);

            return(active);
        }
        public bool BuildFromDirectory(string Directory)
        {
            // Get list of raw files
            string[] Files = System.IO.Directory.GetFiles(Directory, "*.mp4").OrderBy(x => x).ToArray();

            // Make sure there's at least one valid file
            if (Files.Length < 1)
            {
                return(false);
            }

            // Create a list of cam files
            List <TeslaCamFile> CurrentTeslaCams = new List <TeslaCamFile>(Files.Length);

            // Convert raw file to cam file
            foreach (var File in Files)
            {
                TeslaCamFile f = TeslaCamFile.TryParse(File);
                if (f != null)
                {
                    CurrentTeslaCams.Add(f);
                }
            }

            if (CurrentTeslaCams.Count == 0)
            {
                return(false);
            }

            // Now get list of only distinct events
            List <string> DistinctEvents = CurrentTeslaCams.Select(e => e.Date.UTCDateString).Distinct().ToList();

            // Find the files that match the distinct event
            foreach (var CurrentEvent in DistinctEvents)
            {
                List <TeslaCamFile> MatchedFiles   = CurrentTeslaCams.Where(e => e.Date.UTCDateString == CurrentEvent).ToList();
                TeslaCamFileSet     CurrentFileSet = new TeslaCamFileSet();

                CurrentFileSet.SetCollection(MatchedFiles);
                this.Recordings.Add(CurrentFileSet);
            }

            // Set metadata
            this.Recordings = Recordings.OrderBy(e => e.Date.UTCDateString).ToList();
            this.StartDate  = Recordings.First().Date;
            this.EndDate    = Recordings.Last().Date;

            // Success
            return(true);
        }
示例#12
0
 private void Delete()
 {
     if (SelectedRecording != null)
     {
         try
         {
             File.Delete(Path.Combine(OutputFolder, SelectedRecording));
             Recordings.Remove(SelectedRecording);
             SelectedRecording = Recordings.FirstOrDefault();
         }
         catch (Exception)
         {
             MessageBox.Show("Could not delete recording");
         }
     }
 }
示例#13
0
 private void Delete()
 {
     try
     {
         File.Delete(Path.Combine(RecordingsFolder, SelectedRecording));
         var currentRating = Path.Combine(RatingsFolder, _ratingModel.CurrentRating);
         if (File.Exists(currentRating))
         {
             File.Delete(currentRating);
         }
         Recordings.Remove(SelectedRecording);
         SelectedRecording = Recordings.FirstOrDefault();
     }
     catch (Exception)
     {
         MessageBox.Show("Could not delete recording");
     }
 }
		public RecordingViewModel()
		{
			Recordings.Add(new RecordingModel()
			{
				ArtistName = "Bach",
				CompositionName = "B Minor",
				ReleaseDateTime = new DateTime(1748, 7, 8)
			});

			Recordings.Add(new RecordingModel()
			{
				ArtistName = "Abu",
				CompositionName = "X Minor",
				ReleaseDateTime = new DateTime(1788, 7, 8)
			});

			Recordings.Add(new RecordingModel()
			{
				ArtistName = "Ali",
				CompositionName = "D Minor",
				ReleaseDateTime = new DateTime(1755, 7, 8)
			});
		}
        protected override async void OnAppearing()
        {
            base.OnAppearing();

            TitleLabel.Text = Release.Title;

            // load cover art
            Release.CoverArtUrl = await Client.GetCoverArtUrl(Release.MbId.ToString());

            if (!string.IsNullOrEmpty(Release.CoverArtUrl))
            {
                CoverImage.Source = new Uri(Release.CoverArtUrl);
            }

            Recordings.Clear();
            foreach (Recording recording in await Client.GetRecordings(Release.MbId.ToString()))
            {
                Recordings.Add(recording);
            }

            SearchingLabel.IsVisible     = false;
            RecordingsListView.IsVisible = true;
        }
示例#16
0
        public async void RecordOrStop(int value)
        {
            if (value == 1)
            {
                secondstimer.Start();
                graph.Start();
                secondscount = 0;
                await Recordings.ShowAsync();
            }
            else
            {
                secondstimer.Stop();
                graph.Stop();
                TranscodeFailureReason finalizeResult = await fileOutputNode.FinalizeAsync();

                if (finalizeResult != TranscodeFailureReason.None)
                {
                    MessageDialog md = new MessageDialog("Error in saving the audio", "OOPS!!");
                    await md.ShowAsync();

                    return;
                }
                else
                {
                    MessageDialog md = new MessageDialog("Sucessfully saved", "Hurray!!");
                    await md.ShowAsync();

                    UpdateInCommentSection(storageFile.Name);
                    com1.Add(new comments {
                        empname = pd.emp.name, message = storageFile.Name, dt = DateTime.Now, empid = pd.emp.id, IsFile = true, storagefile = storageFile
                    });
                    commentsSection.ItemsSource = null;
                    commentsSection.ItemsSource = com1;
                    Recordings.Hide();
                }
            }
        }
示例#17
0
 public void Init()
 {
     instance = new Recordings();
 }
示例#18
0
 public override string ToString()
 {
     return(string.Format("{0} [CallRecord: Result={1}, Notes={2}, Recordings={3}]", base.ToString(),
                          Result, Notes?.ToPrettyString(), Recordings?.ToPrettyString()));
 }
示例#19
0
 /// <summary>
 /// There are no comments for Recordings in the schema.
 /// </summary>
 public void AddToRecordings(Recordings recordings)
 {
     base.AddObject("Recordings", recordings);
 }
 public override string ToString()
 {
     return(string.Format("{0} [CallRecord: Result={1}, OriginateTime={2}, AnswerTime={3}, AnswerTime={4}, Notes={5}, Recordings={6}]", base.ToString(),
                          Result, OriginateTime, AnswerTime, AnswerTime, Notes?.ToPrettyString(), Recordings?.ToPrettyString()));
 }
示例#21
0
 /// <summary>
 /// Create a new Recordings object.
 /// </summary>
 /// <param name="songId">Initial value of SongId.</param>
 /// <param name="artistId">Initial value of ArtistId.</param>
 /// <param name="dateOccurred">Initial value of DateOccurred.</param>
 public static Recordings CreateRecordings(int songId, int artistId, global::System.DateTimeOffset dateOccurred)
 {
     Recordings recordings = new Recordings();
     recordings.SongId = songId;
     recordings.ArtistId = artistId;
     recordings.DateOccurred = dateOccurred;
     return recordings;
 }