[Approved] Add Love/Ban option in Music Now Playing (1 Viewer)

DieBagger

Retired Team Member
  • Premium Supporter
  • September 11, 2007
    2,516
    1,276
    39
    Austria
    Home Country
    Austria Austria
    Hm, when I try this I always get:

    2010-11-02 00:47:40.433711 [ERROR][MPMain(10)]: Exception :confused:ystem.InvalidCastException: Unable to cast object of type 'MediaPortal.Dialogs.GUIDialogNotify' to type 'MediaPortal.Dialogs.GUIDialogNotifyLastFM'.
    at MediaPortal.GUI.Music.GUIMusicPlayingNow.doLastFMLove() in C:\Users\DieBagger\Documents\Work\Projects\Desktop\MediaPortal\MediaPortal1\Clean\mediaportal\WindowPlugins\GUIMusic\GUIMusicPlayingNow.cs:line 2302
    at MediaPortal.GUI.Music.GUIMusicPlayingNow.OnAction(Action action) in C:\Users\DieBagger\Documents\Work\Projects\Desktop\MediaPortal\MediaPortal1\Clean\mediaportal\WindowPlugins\GUIMusic\GUIMusicPlayingNow.cs:line 508
    at MediaPortal.GUI.Library.GUIWindowManager.OnAction(Action action) in C:\Users\DieBagger\Documents\Work\Projects\Desktop\MediaPortal\MediaPortal1\Clean\mediaportal\Core\guilib\GUIWindowManager.cs:line 457
    at MediaPortalApp.OnAction(Action action) in C:\Users\DieBagger\Documents\Work\Projects\Desktop\MediaPortal\MediaPortal1\Clean\mediaportal\xbmc\MediaPortal.cs:line 2759
    2010-11-02 00:47:40.433711 [ERROR][MPMain(10)]: Exception :Unable to cast object of type 'MediaPortal.Dialogs.GUIDialogNotify' to type 'MediaPortal.Dialogs.GUIDialogNotifyLastFM'.
    2010-11-02 00:47:40.434711 [ERROR][MPMain(10)]: site :Void doLastFMLove()
    2010-11-02 00:47:40.435711 [ERROR][MPMain(10)]: source :WindowPlugins
    2010-11-02 00:47:40.436711 [ERROR][MPMain(10)]: stacktrace: at MediaPortal.GUI.Music.GUIMusicPlayingNow.doLastFMLove() in C:\Users\DieBagger\Documents\Work\Projects\Desktop\MediaPortal\MediaPortal1\Clean\mediaportal\WindowPlugins\GUIMusic\GUIMusicPlayingNow.cs:line 2302
    at MediaPortal.GUI.Music.GUIMusicPlayingNow.OnAction(Action action) in C:\Users\DieBagger\Documents\Work\Projects\Desktop\MediaPortal\MediaPortal1\Clean\mediaportal\WindowPlugins\GUIMusic\GUIMusicPlayingNow.cs:line 508
    at MediaPortal.GUI.Library.GUIWindowManager.OnAction(Action action) in C:\Users\DieBagger\Documents\Work\Projects\Desktop\MediaPortal\MediaPortal1\Clean\mediaportal\Core\guilib\GUIWindowManager.cs:line 457
    at MediaPortalApp.OnAction(Action action) in C:\Users\DieBagger\Documents\Work\Projects\Desktop\MediaPortal\MediaPortal1\Clean\mediaportal\xbmc\MediaPortal.cs:line 2759
    2010-11-02 00:47:40.437711 [ERROR][MPMain(10)]: exception: Unable to cast object of type 'MediaPortal.Dialogs.GUIDialogNotify' to type 'MediaPortal.Dialogs.GUIDialogNotifyLastFM'. WindowPlugins at MediaPortal.GUI.Music.GUIMusicPlayingNow.doLastFMLove() in C:\Users\DieBagger\Documents\Work\Projects\Desktop\MediaPortal\MediaPortal1\Clean\mediaportal\WindowPlugins\GUIMusic\GUIMusicPlayingNow.cs:line 2302
    at MediaPortal.GUI.Music.GUIMusicPlayingNow.OnAction(Action action) in C:\Users\DieBagger\Documents\Work\Projects\Desktop\MediaPortal\MediaPortal1\Clean\mediaportal\WindowPlugins\GUIMusic\GUIMusicPlayingNow.cs:line 508
    at MediaPortal.GUI.Library.GUIWindowManager.OnAction(Action action) in C:\Users\DieBagger\Documents\Work\Projects\Desktop\MediaPortal\MediaPortal1\Clean\mediaportal\Core\guilib\GUIWindowManager.cs:line 457
    at MediaPortalApp.OnAction(Action action) in C:\Users\DieBagger\Documents\Work\Projects\Desktop\MediaPortal\MediaPortal1\Clean\mediaportal\xbmc\MediaPortal.cs:line 2759
     

    jameson_uk

    Retired Team Member
  • Premium Supporter
  • January 27, 2005
    7,258
    2,528
    Birmingham
    Home Country
    United Kingdom United Kingdom
    Hm, when I try this I always get:
    I had fixed this already but forgot to update the patch file so uploaded the old one :oops:

    In GUIMusicPlayingNow.cs
    Code:
            GUIDialogNotifyLastFM dlgNotifyLastFM = (GUIDialogNotifyLastFM)GUIWindowManager.GetWindow((int)Window.[b]WINDOW_DIALOG_NOTIFY)[/b];
    should be
    Code:
            GUIDialogNotifyLastFM dlgNotifyLastFM = (GUIDialogNotifyLastFM)GUIWindowManager.GetWindow((int)Window/[b]WINDOW_DIALOG_LASTFM[/b]);

    I will attach updated patch later
     

    jameson_uk

    Retired Team Member
  • Premium Supporter
  • January 27, 2005
    7,258
    2,528
    Birmingham
    Home Country
    United Kingdom United Kingdom
    OK had time to do this sooner than I thought I would. (and also managed to find the option to include the new dialog class in patch)

    Moved all patches to first page to make things simpler
     

    DieBagger

    Retired Team Member
  • Premium Supporter
  • September 11, 2007
    2,516
    1,276
    39
    Austria
    Home Country
    Austria Austria
    Tested and working well here.

    One note from looking through the code, in GUIDialogNotifyLastFM.cs on line 172 you have

    Code:
          imgLogo.Centered = centered;

    which is deprecated (see warning):
    Warning 33 'MediaPortal.GUI.Library.GUIImage.Centered' is obsolete:
    'ImageAlignment/ImageVAlignment should be used. (<align>/<valign> tag)' C:\Users\DieBagger\Documents\Work\Projects\Desktop\MediaPortal\MediaPortal1\Clean\mediaportal\Dialogs\Dialogs\GUIDialogNotifyLastFM.cs 172 7 Dialogs
     

    jameson_uk

    Retired Team Member
  • Premium Supporter
  • January 27, 2005
    7,258
    2,528
    Birmingham
    Home Country
    United Kingdom United Kingdom
    One note from looking through the code, in GUIDialogNotifyLastFM.cs on line 172 you have

    Code:
          imgLogo.Centered = centered;

    which is deprecated
    I simply copied the GUIDialogNotify class ;)

    I think that whole method for SetImageDimensions can actually safely be removed.

    I am not at a dev machine now. Could you try commenting it out and seeing if that causes any problems?
     

    jameson_uk

    Retired Team Member
  • Premium Supporter
  • January 27, 2005
    7,258
    2,528
    Birmingham
    Home Country
    United Kingdom United Kingdom
    Updated first post with v6
    I have taken the image control out of dialog altogether as it can be added by skin if wanted anyway.
     

    robyf

    Retired Team Member
  • Premium Supporter
  • June 20, 2005
    1,076
    278
    52
    Bolzano
    Home Country
    Italy Italy
    I also tested this and love it!! No problems so far on my production system.

    Only one thing: I can compile (with msbuild) only if I change line 77 of GUIDialogNotifyLastFM.cs

    from


    Code:
    protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)

    to

    Code:
    protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType)

    Maybe a problem of my setup?
     

    jameson_uk

    Retired Team Member
  • Premium Supporter
  • January 27, 2005
    7,258
    2,528
    Birmingham
    Home Country
    United Kingdom United Kingdom
    Maybe a problem of my setup?
    No, I think the performance improvements patch changed .NET version from 2.0 to 3.5 which causes the error.
    last fm dialog class needs
    Code:
    using Action = MediaPortal.GUI.Library.Action;
    adding to it

    I will attach a new patch when I get chance
     

    Users who are viewing this thread

    Top Bottom