Need some help to develop plugin (2 Viewers)

boein

Portal Member
May 1, 2006
40
11
Hi all,

I'm trying to create a plugin that can record streaming radio, especially the streams coming from the radiotime-plugin. I already managed to created a basic plugin that's a mixture of the demo-plugin for developers and parts of my own code calling an external program called streamripper. The basics works and now I'm trying to build a fancy shell around it, but it's hard to reverse engineer existing plugins and code and to be honest the develeopers tutorial is very basic.
So here some questions:
When you record something from TV a flashing red-icon appears in the corner of your screen, how do you make it appear, I would like to use it in my plugin.
The streamripper puts ripped mp3-files in a directory, I want my plugin to make them appear when the files are created.

Thanks

Boein

************
Finally found some time to finish this pluging. A first version of the plugin is ready, you can find it in the download section under MPStreamRipper...Enjoy.
 

jameson_uk

Retired Team Member
  • Premium Supporter
  • January 27, 2005
    7,258
    2,528
    Birmingham
    Home Country
    United Kingdom United Kingdom
    I will try and dig out the recording layer code later

    The recording image is a layer. Take a look at
    WebSVN - MediaPortal - Rev 25339 - /trunk/TvEngine3/TVLibrary/TvPlugin/TvPlugin/TVOverlay.cs
    This is the code that handles this image appearing for TV.

    You would need to change the window ID
    Code:
    GetID = (int)Window.WINDOW_TV_OVERLAY;
    and implement some logic to show whether the image should be shown or not
    Code:
    _lastStatus = TVHome.IsAnyCardRecording;
    but this will appear on just about all screens (everything except for full screen video) so make sure this is what you want to do.

    I think this is all you need to do but let us know how you get on
     

    boein

    Portal Member
    May 1, 2006
    40
    11
    Hi Jameson,

    thanks for your help but I don't see how I can call the tvoverlay-window in my plugin based on your reply. Maybe a quick tutorial could help ;-) I already looked at the myfirstplugin demo on the site, in fact my plugin is based on that one ;-) but could use some more info. The demo only explains to setup 2 buttons in my case start recording and stop recording but working/calling other screens is still a mystery to me.

    Regards,
    Boein



    I will try and dig out the recording layer code later

    The recording image is a layer. Take a look at
    WebSVN - MediaPortal - Rev 25339 - /trunk/TvEngine3/TVLibrary/TvPlugin/TvPlugin/TVOverlay.cs
    This is the code that handles this image appearing for TV.

    You would need to change the window ID
    Code:
    GetID = (int)Window.WINDOW_TV_OVERLAY;
    and implement some logic to show whether the image should be shown or not
    Code:
    _lastStatus = TVHome.IsAnyCardRecording;
    but this will appear on just about all screens (everything except for full screen video) so make sure this is what you want to do.

    I think this is all you need to do but let us know how you get on
     

    jameson_uk

    Retired Team Member
  • Premium Supporter
  • January 27, 2005
    7,258
    2,528
    Birmingham
    Home Country
    United Kingdom United Kingdom
    thanks for your help but I don't see how I can call the tvoverlay-window in my plugin based on your reply. Maybe a quick tutorial could help ;-)
    You would need to implement your own version of this. I have not tried it but I believe the code in there will register it as a layer within MP and then it will check whether or not to display based on the logic you set.

    I already looked at the myfirstplugin demo on the site, in fact my plugin is based on that one ;-) but could use some more info. The demo only explains to setup 2 buttons in my case start recording and stop recording but working/calling other screens is still a mystery to me.
    Did you actually look at the link? This is not the two button hello world example but a full plugin that implements most GUI activity you are going to be interested in.
     

    boein

    Portal Member
    May 1, 2006
    40
    11
    Yes I looked at the other manuals as well (skin + plugin) , unfortunately the skin-design wiki only explains the xml-part. It does not explain how you call them in your program pass parameters ...etc. Only a simple "hello world" example ;-) Anyway calling the tvoverlay using
    GUIWindowManager.ActivateWindow(3002) works but it's not "overlaying" the only thing I can see is the blinking record-icon on a black screen, which is already something.
    Any ideas?
     

    jameson_uk

    Retired Team Member
  • Premium Supporter
  • January 27, 2005
    7,258
    2,528
    Birmingham
    Home Country
    United Kingdom United Kingdom
    Yes I looked at the other manuals as well (skin + plugin) , unfortunately the skin-design wiki only explains the xml-part. It does not explain how you call them in your program pass parameters ...etc. Only a simple "hello world" example ;-)
    So did you look at the GUIControlsDemo plugin which is shown in that link I posted and links to http://team-mediaportal.com/extensions/other/guicontrolsdemo which is a full plugin implementing most controls and there is source code so not just explaining the xml part. Not sure what you are trying to achieve in passing parameters but that is application logic which is up to you how you want to implement. Have a look at the source code for other plugins will help a lot.

    Anyway calling the tvoverlay using
    GUIWindowManager.ActivateWindow(3002)
    You do not call the overlay window, you need to implement your own overlay. Read the tv code and you will see there is a line that registers the layer and a line which determines whether it should be shown or not and you just need to implement that logic and MP should then take care about displaying the layer
     

    boein

    Portal Member
    May 1, 2006
    40
    11
    Ok that explains a lot, when adding the xml-code into the xml of my plugin, the record icon show up and I can also see the rest of my plugin GUI controls. Nice. One last question, I believe it's possible to control the the xml-code from your vb-code right?
    For example: the icon is shown, the moment my plugin starts, I discovered that yo can change this behaviour by simply changing parameters in the xml.
    this is the xml-part for the record icon, mark the <animation effect ...> line
    <animation effect="fade" start="20" time="2000" condition="true" pulse="true">Conditional</animation>
    changing pulse="true" to pulse="false" disables the blinking of the icon, condition="true" to "false" disables it and so on.
    Now the question, how do you control that from within your vb.net code?
    In the hello-world example they show how to work with labels and using GUIPropertyManager.Set/getProperty("#label...", "True") but that does not seem to work in this case.
    What's the secret...?

    Thanks
    Boein

    <control>
    <description>rec logo</description>
    <type>image</type>
    <id>100</id>
    <posX>14</posX>
    <posY>16</posY>
    <width>18</width>
    <height>18</height>
    <texture>tvguide_record_button.png</texture>
    <animation effect="fade" start="20" time="2000" condition="true" pulse="#BoeinPlugin.Record">Conditional</animation>
    <animation effect="fade" time="250">WindowClose</animation>
    <animation effect="fade" time="250">WindowOpen</animation>
    </control>
     

    jameson_uk

    Retired Team Member
  • Premium Supporter
  • January 27, 2005
    7,258
    2,528
    Birmingham
    Home Country
    United Kingdom United Kingdom
    are you just trying to control when the record icon shows?

    if so and assuming you have implemented your own layer which is basically the same as the TV layer then you just need to provide your own logic
    Code:
    _lastStatus = TVHome.IsAnyCardRecording;
    if you change this to
    Code:
    _lastStatus = MyPluginClass.IsRecording;
    and you have a static variable in MyPluginClass then all you need to do is set this to true when you want to display the icon and false when you do not
     

    boein

    Portal Member
    May 1, 2006
    40
    11
    Yes,

    When I click on Start recording, the icon should pop-up and when I click stop recording it should disappear (so the same behaviour when you would record something from the TV).
    The code you gave me doesn't work, also its C# and i'm programming in vb.net. I tried to make it recognised in my classes but no luck. I guess creating plugins isn't as easy as I thought and maybe it's better to leave it to the pro's.

    Thanks for your time anyway.

    Boein
     

    Users who are viewing this thread

    Top Bottom