Changeset 0159c0a
- Timestamp:
- Nov 29, 2009, 5:59:45 PM (15 years ago)
- Branches:
- master, debian, mac, no-cups, web
- Children:
- d566e6b
- Parents:
- 7e6a613
- git-author:
- Jessica B. Hamrick <jhamrick@…> (11/29/09 17:59:45)
- git-committer:
- Jessica B. Hamrick <jhamrick@…> (11/29/09 17:59:45)
- Location:
- gutenbach-rhythmbox-plugin
- Files:
-
- 2 added
- 3 deleted
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gutenbach-rhythmbox-plugin/__init__.py
r7e6a613 r0159c0a 5 5 import subprocess 6 6 7 menu_ui = """ 7 # UI Change is an extra item added to right-click menu when clicking on tracks 8 popup_ui = """ 8 9 <ui> 9 10 <popup name="BrowserSourceViewPopup"> 10 <menuitem name=" Pikamp3" action="SendToPikamp3"/>11 <menuitem name="Gutenbach" action="SendToGutenbach"/> 11 12 </popup> 12 13 </ui> 13 14 """ 14 class Pikamp3Plugin(rb.Plugin):15 class GutenbachPlugin(rb.Plugin): 15 16 def __init__(self): 16 17 rb.Plugin.__init__(self) … … 18 19 def activate(self, shell): 19 20 self.shell = shell 20 # Create action for sending a track to pikamp321 action = gtk.Action('SendTo Pikamp3', _('Send to pikamp3'),22 _("Queue selected tracks to the pikamp3server."),21 # Create action for sending a track to gutenbach 22 action = gtk.Action('SendToGutenbach', _('Send to gutenbach'), 23 _("Queue selected tracks to the gutenbach server."), 23 24 "") 24 action.connect('activate', self. pikamp3_action, shell)25 action_group = gtk.ActionGroup(' Pikamp3ActionGroup')25 action.connect('activate', self.gutenbach_action, shell) 26 action_group = gtk.ActionGroup('GutenbachActionGroup') 26 27 action_group.add_action(action) 27 28 manager = shell.get_ui_manager() 28 29 manager.insert_action_group(action_group) 29 manager.add_ui_from_string(menu_ui) 30 manager.add_ui_from_string(popup_ui) 31 32 # Default configuration options 33 self.printer = "pikamp3" 34 self.printer_host = "lbsg.mit.edu" 30 35 31 36 def deactivate(self, shell): 32 37 del self.shell 33 38 34 def pikamp3_action(self, action, shell):39 def gutenbach_action(self, action, shell): 35 40 source = shell.get_property("selected-source") 41 # For each track currently selected in the song browser 36 42 for entry in source.get_entry_view().get_selected_entries(): 43 # Only play files that are stored on the user's computer 37 44 uri = entry.get_playback_uri() 38 45 p = urlparse.urlparse(urllib.unquote(uri)) 39 46 if p.scheme == "file": 40 47 path = p.path 41 command = 'lpr -P pikamp3@lbsg.mit.edu "%s"' % path 48 if self.printer_host: 49 printer = '@'.join([self.printer, self.printer_host]) 50 else: 51 printer = self.printer 52 command = 'lpr -P %s "%s"' % (printer, path) 42 53 print command 43 54 subprocess.Popen(command, shell=True) 44 55 45 46
Note: See TracChangeset
for help on using the changeset viewer.