Script for shutting down clementine at the end of the current playlist.
Fixes issue #271
This commit is contained in:
parent
046c75380c
commit
4db998c0b6
|
@ -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()
|
|
@ -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 |
|
@ -587,6 +587,7 @@ MainWindow::MainWindow(
|
||||||
scripts_->ui()->RegisterActionLocation("tools_menu", ui_->menu_tools, ui_->action_update_library);
|
scripts_->ui()->RegisterActionLocation("tools_menu", ui_->menu_tools, ui_->action_update_library);
|
||||||
scripts_->ui()->RegisterActionLocation("extras_menu", ui_->menu_extras, NULL);
|
scripts_->ui()->RegisterActionLocation("extras_menu", ui_->menu_extras, NULL);
|
||||||
scripts_->ui()->RegisterActionLocation("help_menu", ui_->menu_help, NULL);
|
scripts_->ui()->RegisterActionLocation("help_menu", ui_->menu_help, NULL);
|
||||||
|
scripts_->ui()->RegisterActionLocation("playlist_menu", ui_->menu_playlist, NULL);
|
||||||
|
|
||||||
// Load theme
|
// Load theme
|
||||||
StyleSheetLoader* css_loader = new StyleSheetLoader(this);
|
StyleSheetLoader* css_loader = new StyleSheetLoader(this);
|
||||||
|
|
Loading…
Reference in New Issue