diff --git a/README.md b/README.md index b09c4d0..c7d1e15 100644 --- a/README.md +++ b/README.md @@ -37,8 +37,8 @@ The interface is in German. This section names the controls as they appear on sc - The start field defaults to **Jetzt**. It also lists the next twelve full hours, and you can type your own time such as `14:30`. A typed time that has already passed today means tomorrow. A **Jetzt** plan begins with music up to the first news at the next :00 or :30; the chosen hours count from there. - **Jetzt starten** starts the plan you created. A **Jetzt** plan moves to the moment you press it, so nothing is skipped while you looked it over. It stays disabled until a plan exists. While laut.fm is switched on the button reads **Live starten** and also starts the live stream; if laut.fm cannot be reached, the music still plays and a warning says why. While on air the button turns red and reads **Sendung beenden**, which stops playback and the live stream together. 2. The timeline shows every item with start time, type (song, news, ad, moderator), title and duration. - 3. **Start** puts the plan on air on the real clock. Before the planned start the now-playing card shows when the broadcast begins; if the plan has already begun, playback joins at the next item. The same button then reads **Stopp** and ends it. The now-playing card shows the current item, its progress and the volume. - 4. **Edit the timeline**: select an upcoming row and use the buttons above the list to move it up or down, edit it, or remove it (trash icon), or drag it to a new place with the mouse: a label with type and title follows the cursor, a line shows where it lands, and the row fades in at its new place. The grip on the left of a row shows it can be dragged. **Hinzufügen** inserts a song (the one chosen under **Songwunsch**), news, an ad or moderator talk as the item after next: two places after the item on air, or at position 3 of the list when nothing is on air; for everything but songs you set title and length first. News, ad and moderator items have no title until you give them one; news and moderator items can also change their length. A double-click opens the editor too. Every item after a change follows on without a gap. The item on air can be edited too, but not moved or removed; **Jetzt beenden** in the now-playing card ends it at once and starts the next item. + 3. The now-playing card shows the current item and its progress. Before the planned start it shows when the broadcast begins; if the plan has already begun, playback joins at the next item. + 4. **Edit the timeline**: select an upcoming row and use the buttons above the list to move it up or down, edit it, or remove it (trash icon), or drag it to a new place with the mouse: a label with type and title follows the cursor, a line shows where it lands, and the row fades in at its new place. The grip on the left of a row shows it can be dragged. **Hinzufügen** inserts a song (the one chosen under **Songwunsch**), news, an ad or moderator talk as the item after next: two places after the item on air, or at position 3 of the list when nothing is on air; for everything but songs you set title and length first. News, ad and moderator items have no title until you give them one; news and moderator items can also change their length. A double-click opens the editor too. Every item after a change follows on without a gap. The item on air can be edited too, but not moved or removed. 5. **Speaking reminder**: 30 seconds before a news or moderator item goes on air, a dialog in the middle of the screen reminds you on any page and stays until you click **OK**. 6. **Microphone**: **Mikro ein** in the now-playing card puts the default microphone on air, also over running music; the button turns red and reads **Mikro aus**. It works with or without a broadcast and stays on while you visit other pages. 7. **Mix levels**, below the now-playing row: under **Was die Hörer hören**, **Musik** and **Mikrofon** set how loud the music and the microphone are for the listeners. Under **Was du hörst**, **Musik** sets how loud the music is on your own device; you never hear your own microphone there, because the delay is distracting. **Genau wie die Hörer** lets you hear exactly what the listeners hear, microphone included. diff --git a/src/Radiosender/Controllers/ScheduleController.cs b/src/Radiosender/Controllers/ScheduleController.cs index 15fc7d5..5f5b8fe 100644 --- a/src/Radiosender/Controllers/ScheduleController.cs +++ b/src/Radiosender/Controllers/ScheduleController.cs @@ -190,22 +190,6 @@ public class ScheduleController /// Item on air or over. public IReadOnlyList Remove(int index) => Change(index, change: items => items.RemoveAt(index)); - /// Nothing on air. - public IReadOnlyList EndCurrentNow() - { - var index = CurrentIndex; - if (CurrentItem is null) - throw new ScheduleException(Loc.T("Schedule_NothingOnAirError")); - var now = _now(); - // Whole seconds: next start not in the future. - var end = new DateTime(now.Ticks - now.Ticks % TimeSpan.TicksPerSecond, now.Kind); - return Change(index, currentAllowed: true, change: items => - { - var item = items[index]; - items[index] = item with { Duration = end > item.Start ? end - item.Start : TimeSpan.Zero }; - }); - } - /// Edit not allowed for item, or item over. public IReadOnlyList EditItem(int index, string title, TimeSpan duration) => Change(index, currentAllowed: true, change: items => { diff --git a/src/Radiosender/Services/Localization/Strings.en.resx b/src/Radiosender/Services/Localization/Strings.en.resx index b19a599..81ebca1 100644 --- a/src/Radiosender/Services/Localization/Strings.en.resx +++ b/src/Radiosender/Services/Localization/Strings.en.resx @@ -120,9 +120,6 @@ No schedule yet. Choose the hours and create a schedule. End broadcast The broadcast could not be ended - The item could not be ended - End now - Ends the current item right away; the next one starts. The schedule could not be extended: {0} Broadcast ended The whole schedule has been played. @@ -159,7 +156,6 @@ No song selected First choose a song under “Song request”. Nothing on air - Nothing is on air. Now On air now This item is on air. It can be edited or ended, but not moved or removed. @@ -186,7 +182,6 @@ “Now”, a full hour, or your own time like 14:30 Choose “Now” or a time, or type one, for example 14:30. Start time unclear - Stop Stops playback and the live stream to laut.fm. Stops playback. Replace selection diff --git a/src/Radiosender/Services/Localization/Strings.resx b/src/Radiosender/Services/Localization/Strings.resx index 1a771ae..b9973ec 100644 --- a/src/Radiosender/Services/Localization/Strings.resx +++ b/src/Radiosender/Services/Localization/Strings.resx @@ -120,9 +120,6 @@ Noch kein Plan. Stunden wählen und Plan erstellen. Sendung beenden Die Sendung konnte nicht beendet werden - Das Element konnte nicht beendet werden - Jetzt beenden - Beendet das laufende Element sofort; das nächste startet. Der Plan konnte nicht verlängert werden: {0} Sendung beendet Der ganze Plan wurde gespielt. @@ -159,7 +156,6 @@ Kein Song gewählt Wähle zuerst unter „Songwunsch“ einen Song. Nichts auf Sendung - Es ist nichts auf Sendung. Jetzt Läuft gerade Dieses Element ist auf Sendung. Es kann bearbeitet oder beendet, aber nicht verschoben oder entfernt werden. @@ -186,7 +182,6 @@ „Jetzt“, eine volle Stunde oder eine eigene Uhrzeit wie 14:30 Wähle „Jetzt“ oder eine Uhrzeit, oder tippe eine ein, zum Beispiel 14:30. Startzeit unklar - Stopp Stoppt die Wiedergabe und den Livestream zu laut.fm. Stoppt die Wiedergabe. Auswahl ersetzen diff --git a/src/Radiosender/Views/Pages/SchedulePage.xaml b/src/Radiosender/Views/Pages/SchedulePage.xaml index b3bf2cc..2bd7026 100644 --- a/src/Radiosender/Views/Pages/SchedulePage.xaml +++ b/src/Radiosender/Views/Pages/SchedulePage.xaml @@ -134,25 +134,10 @@ - - - diff --git a/src/Radiosender/Views/Pages/SchedulePage.xaml.cs b/src/Radiosender/Views/Pages/SchedulePage.xaml.cs index cfbe457..2f0e54f 100644 --- a/src/Radiosender/Views/Pages/SchedulePage.xaml.cs +++ b/src/Radiosender/Views/Pages/SchedulePage.xaml.cs @@ -23,7 +23,6 @@ public partial class SchedulePage : Page private readonly DispatcherTimer _progressTimer = new() { Interval = TimeSpan.FromMilliseconds(250) }; private bool _loading; private int _scrolledTo = -1; - private bool? _shownPlaying; private (bool OnAir, bool Live, bool Enabled)? _shownStart; private readonly ObservableCollection _rows = []; @@ -96,7 +95,6 @@ public partial class SchedulePage : Page private void OnLanguageChanged(object? sender, EventArgs e) => Dispatcher.BeginInvoke(() => { _shownStart = null; - _shownPlaying = null; var selected = Timeline.SelectedIndex; _rows.Clear(); NowKind.Content = null; // same item again would not refresh the chip @@ -313,20 +311,6 @@ public partial class SchedulePage : Page System.Windows.Automation.AutomationProperties.SetName(StartNowButton, (string)StartNowButton.Content); } - private void OnEndNow(object sender, RoutedEventArgs e) - { - try - { - _controller.EndCurrentNow(); - Message.IsOpen = false; - } - catch (ScheduleException ex) - { - ShowMessage(InfoBarSeverity.Error, Loc.T("Schedule_EndItemFailed"), ex.Message); - } - ShowCurrent(); - } - private void OnRemove(object sender, RoutedEventArgs e) => ChangeSelected(row => _controller.Remove(row.Index)); private void OnAddItem(object sender, RoutedEventArgs e) @@ -549,16 +533,6 @@ public partial class SchedulePage : Page private void OnTimelineSelectionChanged(object sender, SelectionChangedEventArgs e) => UpdateButtons(); - private async void OnPlayToggle(object sender, RoutedEventArgs e) - { - var stop = _controller.IsPlaying; - _expectPlaying = !stop; - if (stop) - NowKind.Visibility = Visibility.Collapsed; - UpdateProgress(); - await RunAsync(Loc.T("Schedule_StartFailed"), stop ? _controller.Stop : _controller.Start); - } - // BeginInvoke, not Invoke: engine Stop waits for this pool thread -> deadlock. private void OnItemStarted(object? sender, int index) => Dispatcher.BeginInvoke(ShowCurrent); @@ -609,17 +583,10 @@ public partial class SchedulePage : Page private void UpdateButtons() { var playing = _expectPlaying ?? _controller.IsPlaying; - PlayButton.IsEnabled = !_working && (playing || _controller.Plan.Count > 0); CreateButton.IsEnabled = !_working; // Without a plan only stopping makes sense. StartNowButton.IsEnabled = !_working && (OnAir || _controller.Plan.Count > 0); ShowStartButton(); - if (playing != _shownPlaying) - { - _shownPlaying = playing; - PlayButton.Content = Loc.T(playing ? "Schedule_Stop" : "Schedule_Start"); - PlayButton.Icon = new SymbolIcon(playing ? SymbolRegular.Stop24 : SymbolRegular.Play24); - } var row = Timeline.SelectedItem as TimelineRow; @@ -633,7 +600,6 @@ public partial class SchedulePage : Page RemoveButton.IsEnabled = Editable(index); var onAir = !_working && playing && index >= 0 && index == current; EditItemButton.IsEnabled = (Editable(index) || onAir) && row!.Item.Kind != ScheduleItemKind.Song; - EndNowButton.IsEnabled = !_working && _expectPlaying != false && _controller.CurrentItem is not null; var blocker = row switch { diff --git a/tests/Radiosender.Tests/ScheduleControllerTests.cs b/tests/Radiosender.Tests/ScheduleControllerTests.cs index ff3eb80..5430f0d 100644 --- a/tests/Radiosender.Tests/ScheduleControllerTests.cs +++ b/tests/Radiosender.Tests/ScheduleControllerTests.cs @@ -265,32 +265,6 @@ public sealed class ScheduleControllerTests : IDisposable return (controller, started); } - [Fact] - public async Task EndCurrentNow_EndsTheItemOnAirAndStartsTheNext() - { - var (controller, started) = await OnAirWithTheFirstNewsAsync(); - _now = _now.AddMinutes(2); - - var plan = controller.EndCurrentNow(); - - Assert.Equal(TimeSpan.FromMinutes(2), plan[0].Duration); - AssertContiguousFrom(plan, plan[0].Start); - Assert.Equal(_now, plan[1].Start); - Assert.True(await started.WaitAsync(TimeSpan.FromSeconds(5))); - Assert.Equal(1, controller.CurrentIndex); - controller.Stop(); - } - - [Fact] - public void EndCurrentNow_WithNothingOnAirThrows() - { - AddSongs(); - var controller = Create(); - controller.CreatePlan(1); - - Assert.Throws(() => controller.EndCurrentNow()); - } - [Fact] public async Task EditItem_ChangesTheItemOnAirButItCannotBeRemoved() {