1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-16 11:19:18 +01:00

Add script for copying song details to the clipboard.

Fixes issue #1357
This commit is contained in:
John Maguire 2011-07-13 13:17:02 +00:00
parent 39858fcf9d
commit 4ee632de73
4 changed files with 34 additions and 0 deletions

View File

@ -7,6 +7,7 @@ function(install_script_files scriptname)
endfunction(install_script_files)
add_subdirectory(amazon-covers)
add_subdirectory(clipboard)
add_subdirectory(digitallyimported-radio)
add_subdirectory(google-covers)
add_subdirectory(invalidate-deleted)

View File

@ -0,0 +1,4 @@
install_script_files(clipboard
clipboard.py
script.ini
)

View File

@ -0,0 +1,21 @@
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()

View File

@ -0,0 +1,8 @@
[Script]
name=Copy to Clipboard
description=Copies song details to the clipboard
author=John Maguire <john.maguire@gmail.com>
url=http://www.clementine-player.org
language=python
script_file=clipboard.py