NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 40 41 42 43 44 … 93 Next »
v1.x BaseButtonListUiTask plugin/skin question

 
  • 0 Vote(s) - 0 Average
v1.x BaseButtonListUiTask plugin/skin question
Ton
Offline

Member

Posts: 233
Threads: 16
Joined: Aug 2005
#11
2007-09-14, 09:49 PM
Well, you could maybe create a "singleton" class....

Don't know if you did any Java, and never used it in C#, but it should...

Basically what you do is create a static variable of the type of your class...

Then, in your constructor (or initialize code) you check if this variable is initialized and, if not, create a new intance of your class.

You then return a reference to this instance....

Maybe a "google" for "singleton c#" will help...
//Ton
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,789
Threads: 769
Joined: Nov 2003
#12
2007-09-15, 02:05 AM
Yes, he could do that.
DronnyBoyd
Offline

Member

Posts: 63
Threads: 15
Joined: Dec 2005
#13
2007-09-15, 10:13 AM
Ton Wrote:Well, you could maybe create a "singleton" class....

Don't know if you did any Java, and never used it in C#, but it should...

Basically what you do is create a static variable of the type of your class...

Then, in your constructor (or initialize code) you check if this variable is initialized and, if not, create a new intance of your class.

You then return a reference to this instance....

Maybe a "google" for "singleton c#" will help...

Thanks for the suggestion (don't worry, I do know what a singleton is, I've done a fair bit of Java and C# (and C++ and lots of other languages)), but I don't actually see how it would help.

I don't control the creation of the plugin instances, GBPVR does. So, unless there's a way to register an IEventNotification interface to receive events (perhaps this is what I'm missing) from inside a plugin, then making my plugin task class a singleton won't help, as far as I can see.

Perhaps I'm using the IEventNotification interface incorrectly? Is there some way I should implement it in my plugin DLL that I don't know about? I'll try it, and see...

Anyhow, thanks again for the assistance, I'm hoping to make my video-library plugin available for others to try, just a last few hurdles to get over, and of course finding time with a family and a full-time job! Having said that, this is the first non-work coding I've done in quite a while, and I'm really enjoying it, and as always the GBPVR community (and the man himself!) make it fun too!

cheers

Dronny.
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,789
Threads: 769
Joined: Nov 2003
#14
2007-09-15, 04:23 PM
You can have the constructor for your BaseButtonListUiTask set "singleton = this;", then create a separate small class which implements IEventNotification. In it's implementation of IEventNotification.Notify() it'd call something like MyPlugin.getInstance().MyNotify().

Hope that makes sense.
DronnyBoyd
Offline

Member

Posts: 63
Threads: 15
Joined: Dec 2005
#15
2007-09-15, 05:54 PM
sub Wrote:You can have the constructor for your BaseButtonListUiTask set "singleton = this;", then create a separate small class which implements IEventNotification. In it's implementation of IEventNotification.Notify() it'd call something like MyPlugin.getInstance().MyNotify().

Hope that makes sense.

Yep, that bit's fine, but what I don't get is how does my IEventNotification-implementing class get instantiated by GBPVR? Is there some magic I have to do to let GBPVR know my plugin DLL contains it, or what?

Sorry for being so dumb, I'm sure I'm missing something obvious here Smile

Dronny
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,789
Threads: 769
Joined: Nov 2003
#16
2007-09-15, 06:12 PM
When the app starts it scans DLLs in the plugin for classes that implement various interfaces, and if found will create an instance of that class (assuming it has a default public constructor). In the case of classes implementing IEventNotification, it'll add these to the notification list to call during events.
DronnyBoyd
Offline

Member

Posts: 63
Threads: 15
Joined: Dec 2005
#17
2007-09-16, 02:54 PM
sub Wrote:When the app starts it scans DLLs in the plugin for classes that implement various interfaces, and if found will create an instance of that class (assuming it has a default public constructor). In the case of classes implementing IEventNotification, it'll add these to the notification list to call during events.

Ah-ha! Got it working now, thanks very much! I just hadn't twigged how the various plugin classes were instantiated.

Ok, I should be able to make progress now, cheers!!!

Dronny.
DronnyBoyd
Offline

Member

Posts: 63
Threads: 15
Joined: Dec 2005
#18
2007-09-17, 09:29 PM
Ok, here we go again Smile

What I'm trying to do now is to to use a query on the PLAYBACK_POSITION table to determine whether a video is "being watched" (so I can show the user which ones are in the middle of watching, as it were). Thing is, when the VideoStopping event fires (now successfully using IEventNotification.Notify() thanks) it seems that the file is in the table. So, I defer the check until a little later, and it seems that even if I let the video run to the very end, it remains in the PLAYBACK_POSITION table.

Maybe there's a better way to achieve what I want, but I don't know what that would be. Essentially I'd like to be able to tell the difference between someone watching a video to the very end, and someone stopping it part-way through. That way, I can highlight in the listview those videos that are still being watched (as well as distinguishing those that have never been watched at all, but I can do that ok).

I guess my question is, what decides whether a file remains in the PLAYBACK_POSITION table, or is there a better way to do this?

cheers

Dronny.
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,789
Threads: 769
Joined: Nov 2003
#19
2007-09-18, 10:51 AM
I think it deletes this resume info from PLAYBACK_POSITION when playback of that file completes.
DronnyBoyd
Offline

Member

Posts: 63
Threads: 15
Joined: Dec 2005
#20
2007-09-18, 11:41 AM
sub Wrote:I think it deletes this resume info from PLAYBACK_POSITION when playback of that file completes.

That's the weird thing -- when I let the video play to the end, it still seem to be in the PLAYBACK_POSITION table sometimes. I guess I can verify that by playing it again and seeing whether the 'Resume/Restart' popup pops up.

Is there any way of getting the duration and current position programmatically?

Alternatively, I could just put up a 'yes/no' dialog after the video stops playing saying "Are you still watching this?" or something... a bit lame, but it would help get the feature working as I want.

thanks

Dronny
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)

Pages (3): « Previous 1 2 3 Next »


Possibly Related Threads…
Thread Author Replies Views Last Post
  PIP plugin for Kodi sgilani 2 3,048 2022-10-17, 12:44 AM
Last Post: sgilani
  Web API only_new Question Gazavant 6 2,794 2021-04-04, 06:54 PM
Last Post: sub
  New Systems Plugin kirschey 10 3,527 2020-11-14, 08:01 PM
Last Post: sub
  Another Artwork question scJohn 15 8,375 2019-09-10, 05:33 PM
Last Post: nonob
  Skin help (correct location?) SFX Group 4 3,943 2018-01-24, 07:42 AM
Last Post: pBS
  WEB API GuidService/Listing question(s) scJohn 6 4,400 2017-08-09, 02:18 PM
Last Post: scJohn
  skin question pBS 2 3,380 2016-06-18, 07:03 PM
Last Post: pBS
  VIdeo playback from plugin mvallevand 5 3,612 2015-08-06, 10:43 PM
Last Post: sub
  Skin - view further into the future, scale the guide Vitenka 5 3,369 2014-11-26, 07:28 PM
Last Post: Vitenka
  Attention Sub: Open TV / Custom Data Grabber plugin Benoire 2 2,989 2014-11-14, 02:05 AM
Last Post: Benoire

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode