mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-16 19:31:02 +01:00
4ee632de73
Fixes issue #1357
22 lines
662 B
Python
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()
|