[banshee] Added --restart-or-previous command line option



commit 66e3adbee6fee1740d97f77b636c15ccce30cdff
Author: Alexander Kojevnikov <alexander kojevnikov com>
Date:   Wed Jan 20 20:13:50 2010 +1100

    Added --restart-or-previous command line option

 src/Clients/Booter/Booter/Entry.cs                 |    1 +
 src/Clients/Halie/Halie/Client.cs                  |    3 +++
 .../IPlaybackControllerService.cs                  |    1 +
 .../PlaybackControllerService.cs                   |    5 +++++
 4 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/src/Clients/Booter/Booter/Entry.cs b/src/Clients/Booter/Booter/Entry.cs
index c788f45..632e3b3 100644
--- a/src/Clients/Booter/Booter/Entry.cs
+++ b/src/Clients/Booter/Booter/Entry.cs
@@ -157,6 +157,7 @@ namespace Booter
                 new LayoutGroup ("playback", Catalog.GetString ("Playback Control Options"),
                     new LayoutOption ("next", Catalog.GetString ("Play the next track, optionally restarting if the 'restart' value is set")),
                     new LayoutOption ("previous", Catalog.GetString ("Play the previous track, optionally restarting if the 'restart value is set")),
+                    new LayoutOption ("restart-or-previous", Catalog.GetString ("If the current song has been played longer than 4 seconds then restart it, otherwise the same as --previous")),
                     new LayoutOption ("play-enqueued", Catalog.GetString ("Automatically start playing any tracks enqueued on the command line")),
                     new LayoutOption ("play", Catalog.GetString ("Start playback")),
                     new LayoutOption ("pause", Catalog.GetString ("Pause playback")),
diff --git a/src/Clients/Halie/Halie/Client.cs b/src/Clients/Halie/Halie/Client.cs
index 1bfd8fb..7a08626 100644
--- a/src/Clients/Halie/Halie/Client.cs
+++ b/src/Clients/Halie/Halie/Client.cs
@@ -133,6 +133,9 @@ namespace Halie
                     case "first":    controller.First ();                                    break;
                     case "next":     controller.Next (ParseBool (arg.Value, "restart"));     break;
                     case "previous": controller.Previous (ParseBool (arg.Value, "restart")); break;
+                    case "restart-or-previous":
+                        controller.RestartOrPrevious (ParseBool (arg.Value, "restart"));
+                        break;
                     case "stop-when-finished":
                         controller.StopWhenFinished = !ParseBool (arg.Value);
                         break;
diff --git a/src/Core/Banshee.Services/Banshee.PlaybackController/IPlaybackControllerService.cs b/src/Core/Banshee.Services/Banshee.PlaybackController/IPlaybackControllerService.cs
index 9c8883f..8eed1e4 100644
--- a/src/Core/Banshee.Services/Banshee.PlaybackController/IPlaybackControllerService.cs
+++ b/src/Core/Banshee.Services/Banshee.PlaybackController/IPlaybackControllerService.cs
@@ -48,6 +48,7 @@ namespace Banshee.PlaybackController
         void First ();
         void Next (bool restart);
         void Previous (bool restart);
+        void RestartOrPrevious (bool restart);
 
         PlaybackShuffleMode ShuffleMode { get; set; }
         PlaybackRepeatMode RepeatMode { get; set; }
diff --git a/src/Core/Banshee.Services/Banshee.PlaybackController/PlaybackControllerService.cs b/src/Core/Banshee.Services/Banshee.PlaybackController/PlaybackControllerService.cs
index c224ce3..2322609 100644
--- a/src/Core/Banshee.Services/Banshee.PlaybackController/PlaybackControllerService.cs
+++ b/src/Core/Banshee.Services/Banshee.PlaybackController/PlaybackControllerService.cs
@@ -255,6 +255,11 @@ namespace Banshee.PlaybackController
 
         public void RestartOrPrevious ()
         {
+            RestartOrPrevious (RepeatMode == PlaybackRepeatMode.RepeatAll);
+        }
+
+        public void RestartOrPrevious (bool restart)
+        {
             const int delay = 4000; // ms
             if (player_engine.Position < delay) {
                 Previous ();



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]