linuxmint / hypnotix

An M3U IPTV Player
1.26k stars 168 forks source link

Help testing changes + suggestions #193

Open sbadux opened 2 years ago

sbadux commented 2 years ago

Hello, I'm sorry if this is not the right place to post, but please let me know if there's a better place. I'm newbie in software development but I wanted to start from an existing project to learn how a real software is built. Hypnotix is a good starting point because it's a good software, but not too complex to understand.

A reply to an issue says to modify the python file to have a detachable MPV window, so I started from there. After studying the software I (surprisingly) was able to create a new "Detach MPV window" option in the menu (thanks to Glade) and then use that checkbox to enable/disable the detachable MPV window. I made my changes to my real Linux Mint installation (not a good habit :slightly_smiling_face: ) and they worked. So I cloned the repository to download all the last changes and made my changes in the code.

Question 1: I've tried to launch the "test" script which seems to delete the old version and copy the new files. I got this error: (hypnotix.py:147269): GLib-GIO-ERROR **: 16:15:39.827: Settings schema 'org.x.hypnotix' does not contain a key named 'prefer-dark-mode' This happens also with the files downloaded directly from your original repository. Am I doing something wrong? How can I test my new version or a newer version downloaded from your original repository?

Question 2: I've saved the hypnotix.ui with Glade 3.38 installed from FlatHub. It has a lot of changes. E.g <property name="can_focus">True</property> becomes <property name="can-focus">True</property> without the underscore

The next version will be saved with Glade 3.38 or you still use the 3.22?

Question 3: If someone wants to take a look to my changes in the code and give me some suggestion/comment I would be very grateful. It's only few lines. I don't want to merge them, I'm just learning how to develop so every suggestion is welcome :slightly_smiling_face: Line 1401 to 1409 https://github.com/sbadux/hypnotix/blob/master/usr/lib/hypnotix/hypnotix.py#L1401

P.S. The code for the detachable MPV windows if from @Axel-Erfurt in the issue 179 "exit full screen from the osd using a mouse", I've just added the graphical option and the if-else

Axel-Erfurt commented 2 years ago

I've created a deb file and installed it, that's the only way to test it.

It works fine.

You can make a deb file and put it on your Releases.

mint-build -g https://github.com/sbadux/hypnotix.git

sbadux commented 2 years ago

I've created a deb file and installed it, that's the only way to test it.

It works fine.

You can make a deb file and put it on your Releases.

mint-build -g https://github.com/sbadux/hypnotix.git

Thank you very much. I'm glad it works fine! After installing mint-dev-tools I've also tried to build the .deb and it worked.

Thank you very much for your help and for the tip on how to build the deb package. Really easy! Just one more thing if you still have the package installed: When a detached MPV window is open, if you press "X" the window will close? In my case the MPV window freezes but I'm having some troubles with MPV so maybe it's not related to Hypnotix. If you already removed it, don't worry. It's not important. Thanks!

Axel-Erfurt commented 2 years ago

What I noticed is that the setting Detach is not saved.

For the detached mpv window problem you could terminate the mpv. When the channel is changed, the still open frozen window is then closed.

And you could use border=False to remove the titlebar.

    def reinit_mpv(self):
        if self.mpv != None:
            self.mpv.stop()
        options = {}
        try:
            mpv_options = self.settings.get_string("mpv-options")
            if ("=") in mpv_options:
                pairs = mpv_options.split()
                for pair in pairs:
                    key, value = pair.split("=")
                    options[key] = value
        except Exception as e:
            print("Could not parse MPV options!")
            print(e)

        options["user_agent"] = self.settings.get_string("user-agent")
        options["referrer"] = self.settings.get_string("http-referer")

        while not self.mpv_drawing_area.get_window() and not Gtk.events_pending():
            time.sleep(0.1)

        #Reads the Detach_MPV_window value. If True opens the new window. If False uses the standard embedded window
        chk_detach_MPV = ""
        chk_detach_MPV = self.builder.get_object("Detach_MPV_window").get_active()

        if chk_detach_MPV == True:
            if self.mpv != None:
                self.mpv.terminate()
            self.mpv = mpv.MPV(**options, input_default_bindings=True, input_vo_keyboard=True, osc=True, border=False)
        else:
            self.mpv = mpv.MPV(**options, script_opts='osc-layout=box,osc-seekbarstyle=bar,osc-deadzonesize=0,osc-minmousemove=3', input_default_bindings=True, \
                 input_vo_keyboard=True,osc=True, ytdl=True, wid=str(self.mpv_drawing_area.get_window().get_xid()))
sbadux commented 2 years ago

What I noticed is that the setting Detach is not saved.

How can I save it? Just an hint, then i'll search online how to implement it. Thanks

For the detached mpv window problem you could terminate the mpv. When the channel is changed, the still open frozen window is then closed.

I've also added the "mpv.terminate" option to the stop button so MPV is killed also if the stop button is pressed. In this way if the MPV window is freezed you can just press "stop" immagine