1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-16 19:31:02 +01:00
Clementine-audio-player-Mac.../scripts/clipboard/clipboard.py
2011-07-13 13:17:02 +00:00

22 lines
662 B
Python

import clementine
from PythonQt.QtGui import QAction
from PythonQt.QtGui import QApplication
class Plugin:
def __init__(self):
self.clipboard = QApplication.clipboard()
self.action = QAction("Copy to clipboard", None)
clementine.ui.AddAction("song_menu", self.action)
self.action.connect("activated()", self.CopyToClipboard)
def CopyToClipboard(self):
selection = clementine.playlists.current_selection().indexes()
title = selection[clementine.Playlist.Column_Title].data()
artist = selection[clementine.Playlist.Column_Artist].data()
song = '%s - %s' % (title, artist)
self.clipboard.setText(song)
plugin = Plugin()