afrancoto / WebMenu

Rhythmbox 3 third party plugin WebMenu
6 stars 2 forks source link

with nothing playing plugin dumps error message #4

Closed fossfreedom closed 12 years ago

fossfreedom commented 12 years ago

as title says...

Traceback (most recent call last):
  File "/home/dad/.local/share/rhythmbox/plugins/WebMenu/WebMenu.py", line 187, in search_on_youtube
    metadata=self.get_metadata(shell) #Calls "get_metadata"
  File "/home/dad/.local/share/rhythmbox/plugins/WebMenu/WebMenu.py", line 176, in get_metadata
    playing_title = self.playing_entry.get_string(RB.RhythmDBPropType.TITLE)
AttributeError: 'NoneType' object has no attribute 'get_string'
afrancoto commented 12 years ago

Thank you for your feedback! :D

With nothing playing the webmenu should be hidden, is that right? So, the only way to generate this error is by using the shortcut keys, I think... I'll find a way to solve this problem as soon as possible!

fossfreedom commented 12 years ago

possibly - I've raised a separate issue on the menu placement

I simply started rhythmbox - nothing was playing and nothing selected. I went to the menu and selected youtube.

Hope this helps.

afrancoto commented 12 years ago

Fixed! (Version 0.8) I always used RememberTheRhythm, another extension that automatically starts the last song when you launch Rhythmbox, so I didn't realize that the auto-hide didn't work with the first song! Thanks! :)

P.S.: If it is still not working please let me know :)

fossfreedom commented 12 years ago

umm ... if you just launch rhythmbox (disable all other plugins except WebMenu) - the web menu is automatically visible. Thus highlighting (but not playing) anything gives the error still :(

afrancoto commented 12 years ago

Mmmm.. we have a strange problem here: If I disable every plugin except "WebMenu" it's items are enabled when I launch Rhythmbox (with no playing song) If I disable every plugin except "WebMenu" AND "10 Band Equalizer" it works perfectly (items disabled at launch with no playing song). Wtf?

Here is the function to disable the items:

def do_activate(self):
    shell = self.object
  [...]
    sp=shell.props.shell_player #Connects play/stop events to "song_changed")
    sp.connect ('playing-changed', self.song_changed, shell.props, config.get_settings())

def song_changed(self, playing, user_data, s_props, settings):
    self.playing_entry = s_props.shell_player.get_playing_entry() 
    now_is_playing=self.playing_entry is not None #current playing song==None --> False

    s_props.ui_manager.get_widget("/MenuBar/WebMenu/YTitem").set_sensitive(now_is_playing)  #Disable the YouTube Option
    for website in settings["default-album-services"]: #Disable all the options in the "Album" submenu
    menu_option="/MenuBar/WebMenu/AlbumMenu/AL_"+website
        s_props.ui_manager.get_widget(menu_option).set_sensitive(now_is_playing)
    for website in settings["default-artist-services"]: #Enable all the options in the "Album" submenu
    menu_option="/MenuBar/WebMenu/ArtistMenu/AR_"+website
        s_props.ui_manager.get_widget(menu_option).set_sensitive(now_is_playing)
afrancoto commented 12 years ago

fossfreedom fixed this by calling the song_changed function in do_activate :P thanks!