the folder was not enough

This commit is contained in:
Paweł Bara 2011-03-13 12:44:45 +00:00
parent 548c666dcf
commit e2cd6d02ee
3 changed files with 56 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -0,0 +1,47 @@
from PyQt4.Qt import QAction
from PyQt4.QtCore import QObject
from PyQt4.QtCore import Qt
from PyQt4.QtCore import SIGNAL
from PyQt4.QtGui import QColor
import clementine
class RainbowizerScript(QObject):
priority = 1
colors = [ QColor("#ec1e24"),
QColor("#f45a2c"),
QColor("#fcf204"),
QColor("#3cb64c"),
QColor("#04aeec"),
QColor("#242264"),
QColor("#94268c") ];
def __init__(self):
QObject.__init__(self)
self.action = QAction("rainbowize_playlist", self)
self.action.setText("Rainbowize!")
self.action.setCheckable(True)
self.connect(self.action, SIGNAL("changed()"), self.rainbowize)
clementine.ui.AddAction('playlist_menu', self.action)
def rainbowize(self):
for playlist in clementine.playlists.GetAllPlaylists():
if self.action.isChecked():
i = 0
for item in playlist.GetAllItems():
i = (i + 1) % len(self.colors)
item.SetBackgroundColor(self.priority, self.colors[i])
else:
# undo all rainbow colors
for item in playlist.GetAllItems():
item.RemoveBackgroundColor(self.priority)
script = RainbowizerScript()

View File

@ -0,0 +1,9 @@
[Script]
name=Rainbowizer
description=This is a sample plugin designed to show you how to use the color API of playlist items. It rainbowizes your playlist for better user experience!
author=Pawel Bara <keirangtp ( at ) gmail.com>
url=http://www.clementine-player.org
icon=icon.jpg
language=python
script_file=rainbow.py