Script for shutting down clementine at the end of the current playlist.

Fixes issue #271
This commit is contained in:
John Maguire 2011-01-18 22:56:47 +00:00
parent 046c75380c
commit 4db998c0b6
4 changed files with 37 additions and 0 deletions

27
scripts/shutdown/main.py Normal file
View File

@ -0,0 +1,27 @@
import clementine
from PyQt4.QtGui import QAction
import sys
class Plugin:
def __init__(self):
self.enabled = False
clementine.player.PlaylistFinished.connect(self.PlaylistFinished)
self.action = QAction("Shutdown at end", None)
self.action.setCheckable(True)
self.action.triggered.connect(self.Enabled)
clementine.ui.AddAction("playlist_menu", self.action)
# Slots
def PlaylistFinished(self):
if self.enabled:
print "Reached the end of the playlist - shutting down."
sys.exit(0)
def Enabled(self, enabled):
print "Shutdown at end of playlist enabled: %s" % enabled
self.enabled = enabled
plugin = Plugin()

View File

@ -0,0 +1,9 @@
[Script]
name=Shutdown At End
description=Adds an option to shutdown Clementine at the end of the current playlist.
author=John Maguire <john.maguire@gmail.com>
url=http://www.clementine-player.org
icon=system-shutdown.png
language=python
script_file=main.py

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -587,6 +587,7 @@ MainWindow::MainWindow(
scripts_->ui()->RegisterActionLocation("tools_menu", ui_->menu_tools, ui_->action_update_library);
scripts_->ui()->RegisterActionLocation("extras_menu", ui_->menu_extras, NULL);
scripts_->ui()->RegisterActionLocation("help_menu", ui_->menu_help, NULL);
scripts_->ui()->RegisterActionLocation("playlist_menu", ui_->menu_playlist, NULL);
// Load theme
StyleSheetLoader* css_loader = new StyleSheetLoader(this);