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:
parent
39858fcf9d
commit
4ee632de73
@ -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)
|
||||
|
4
scripts/clipboard/CMakeLists.txt
Normal file
4
scripts/clipboard/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
install_script_files(clipboard
|
||||
clipboard.py
|
||||
script.ini
|
||||
)
|
21
scripts/clipboard/clipboard.py
Normal file
21
scripts/clipboard/clipboard.py
Normal 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()
|
8
scripts/clipboard/script.ini
Normal file
8
scripts/clipboard/script.ini
Normal 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
|
Loading…
Reference in New Issue
Block a user