1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-15 18:58:55 +01:00
Clementine-audio-player-Mac.../scripts/shutdown/main.py
2011-01-18 22:56:47 +00:00

28 lines
670 B
Python

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()