Taapat / enigma2-plugin-blurayplayer

Enigma2 plugin to play Blu-ray videos
GNU General Public License v2.0
3 stars 3 forks source link

Does not work with Python3 #25

Closed original-birdman closed 2 years ago

original-birdman commented 2 years ago

This is not working with the OpenVix Python3 version.

The problem is that when gotFilename gets to self.orig_gotFilename() the self is an unsubstantiated instance of the MovieSelection class, so doesn't contain any attributes (calling type() on it shows it to be a type not a class ...MovieSelection).

In fact there is no need to use types.MethodType() at all. Just putting a function (defined as a method, so with self as the first parameter) into a class makes it a callable method.

However, there is a further problem, caused by making orig_gotFilename (and orig_itemSelectedCheckTimeshiftCallback) methods.

If I rename an original method as orig_method and make it a new method in the object then if some other module comes along also wishing to intercept that method and does so by the same renaming then the whole thing falls over as that module will get my method as its orig_method and when I call orig_method I'll be calling myself (which Python will detect after ~1000 recursions).

So the original intercepted methods must be kept as private variables in the code and called as functions using orig_method(self, ...).

I do have fixed code that does this, and will submit a PR shortly.

Taapat commented 2 years ago

As I see on OpenVix the MovieSelection code is similar to OpnePLi so you need to use a plugin from branch openpli which does not use function override.

original-birdman commented 2 years ago

Not sure what you mean by "use a plugin from branch openpli".

Anyway, this code doesn't work.

Taapat commented 2 years ago

Are you a checked on ATV for which a branch master has been created? Check all branches of this plugin. As I write on OpenVIX you need to use branch openpli: https://github.com/Taapat/enigma2-plugin-blurayplayer/tree/openpli

original-birdman commented 2 years ago

The PR I'm submitting makes this one work on OpenVix (and should be simpler everywhere) so that intercepting the MovieSelection works. There is no need for types.MethodType(). Also read the very important part about when two plugins both wish to override MovieSelection.