WifiRemote for MP2 (1 Viewer)

FreakyJ

Retired Team Member
  • Premium Supporter
  • July 25, 2010
    4,024
    1,420
    Home Country
    Germany Germany
    This is what I did:
    Code:
    case "subtitles":
              if (Utils.IsNowPlaying())
              {
                ISubtitlePlayer subtitlePlayer = ServiceRegistration.Get<IPlayerContextManager>().PrimaryPlayerContext.CurrentPlayer as ISubtitlePlayer;
                if (subtitlePlayer != null)
                {
                  var availableSubtitlesList = subtitlePlayer.Subtitles.ToList();
                  int index = availableSubtitlesList.FindIndex(x => x == subtitlePlayer.CurrentSubtitle);
                  if (index == (availableSubtitlesList.Count - 1))
                    index = 0;
                  subtitlePlayer.SetSubtitle(availableSubtitlesList[index]);
                }
    
              }
              break;
    
            case "audiotrack":
              if (Utils.IsNowPlaying())
              {
                ISharpDXVideoPlayer videoPlayer = ServiceRegistration.Get<IPlayerContextManager>().PrimaryPlayerContext.CurrentPlayer as ISharpDXVideoPlayer;
                if (videoPlayer != null)
                {
                  var availableAudiotracksList = videoPlayer.AudioStreams.ToList();
                  int index = availableAudiotracksList.FindIndex(x => x == videoPlayer.CurrentAudioStream);
                  if (index == (availableAudiotracksList.Count - 1))
                    index = 0;
                  videoPlayer.SetAudioStream(availableAudiotracksList[index]);
                }
    
              }
              break;
    
            /*case "screenshot":
              button = Key.Screenshot;
              break;*/
    
            case "aspectratio":
              if (Utils.IsNowPlaying())
              {
                ISharpDXVideoPlayer videoPlayer = ServiceRegistration.Get<IPlayerContextManager>().PrimaryPlayerContext.CurrentPlayer as ISharpDXVideoPlayer;
                if (videoPlayer != null)
                {
                  var availableGeometriesList = availableGeometries.Values.ToList();
                  int index = availableGeometriesList.FindIndex(x => x.Name == videoPlayer.GeometryOverride.Name);
                  if (index == (availableGeometriesList.Count - 1))
                    index = 0;
                  videoPlayer.GeometryOverride = availableGeometriesList[index];
                }
                 
              }
              break;

    But I am not sure if this is right :whistle:

    @morpheus_xx
    Maybe a bit offtopic here, but hwile I am writing:
    How do I get Fanart for a episode? I use this code:
    Code:
    IList<FanArtImage> fanart = ServiceRegistration.Get<IFanArtService>().GetFanArt(fanArtMediaType, fanartType, name, 0, 0, true);

    And fet this in my log:
    GetArtworkResized: no fanart found - fanArtMediaType: Series, fanartType: Banner, name: Pilot
    So "name" is the name of the Episode in the SeriesAspect. I also tried Thumbnail instead of Banner as a fallback, but same result. I could reverse the patterns for season, and seres, but not for an actual episode :/
     

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    But I am not sure if this is right
    Accessing the player interfaces looks ok. But I don't understand the purpose of the logic here:
    Code:
                  var availableSubtitlesList = subtitlePlayer.Subtitles.ToList();
                  int index = availableSubtitlesList.FindIndex(x => x == subtitlePlayer.CurrentSubtitle);
                  if (index == (availableSubtitlesList.Count - 1))
                    index = 0;
                  subtitlePlayer.SetSubtitle(availableSubtitlesList[index]);
    Is the ' case "subtitles": ' an action to:
    1. retrieve available subtitles, or
    2. to set a specific selection?
    Your code seems to enumerate all items and then set one (which is already the current?)
     

    FreakyJ

    Retired Team Member
  • Premium Supporter
  • July 25, 2010
    4,024
    1,420
    Home Country
    Germany Germany
    Your code seems to enumerate all items and then set one (which is already the current?)
    My fault... This should be better, right?
    Code:
    int index = availableSubtitlesList.FindIndex(x => x == subtitlePlayer.CurrentSubtitle) + 1;

    Edit: I basically want to iterate through the list by every button press
     

    FreakyJ

    Retired Team Member
  • Premium Supporter
  • July 25, 2010
    4,024
    1,420
    Home Country
    Germany Germany
    New Version is in firts post. Couldn't test it because AMPdroid is not that happy with this WifiRemore plugin :/

    Here is the first version of the MPExtenden plugin: https://forum.team-mediaportal.com/threads/plugin-mp2extended.132322/
    I implemented everything you requested + some more. There is still the issue for retrieving Images for Episodes: https://forum.team-mediaportal.com/threads/plugin-wifiremote-for-mp2.132267/page-5#post-1155261

    So feel free to write down more API calls you would like to see :)
     

    johanj

    MP Donator
  • Premium Supporter
  • January 31, 2009
    781
    398
    46
    Home Country
    Sweden Sweden
    Could only test aspect ratio now. Aspect ratio works. But you need to first manually press the info button and change aspect once. Then it works to toggle between the aspect ratios using WifiRemote.
     

    FreakyJ

    Retired Team Member
  • Premium Supporter
  • July 25, 2010
    4,024
    1,420
    Home Country
    Germany Germany
    Could only test aspect ratio now. Aspect ratio works. But you need to first manually press the info button and change aspect once. Then it works to toggle between the aspect ratios using WifiRemote.
    Thank you! I might know what's wrong :) Will fix it later^^
     

    FreakyJ

    Retired Team Member
  • Premium Supporter
  • July 25, 2010
    4,024
    1,420
    Home Country
    Germany Germany
    New Plugin version in first post, I hope this fixes your issue :)
     

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    Maybe a bit offtopic here, but hwile I am writing:
    How do I get Fanart for a episode? I use this code:
    This doesn't work yet: currently we have no "Episode" item, they are regular "VideoItems". That's why they doesn't contain series names etc.

    This can be changed first with the MIA rework. But the branch is quite far :)
     

    ge2301

    Lead Design MP2
  • Team MediaPortal
  • January 11, 2014
    8,705
    3,491
    Stuttgart
    Home Country
    Germany Germany

    Users who are viewing this thread

    Top Bottom