gort818 / qtwebflix

A qt webengine program for netflix
GNU General Public License v3.0
248 stars 28 forks source link

Support for mpris interface #45

Closed petrmanek closed 5 years ago

petrmanek commented 5 years ago

I'm using QtWebFlix regularly now and I have a feature suggestion. It'd be awesome if QtWebFlix could support the mpris D-Bus interface.

This would allow:

gort818 commented 5 years ago

@petrmanek nvm not working..

gort818 commented 5 years ago

@petrmanek Ok I think it is good to go

gort818 commented 5 years ago

@petrmanek Ok did a nice test was able to use mpris with no issues, the executable has doubled in size from 127K to 332K :) let me know if you have any issues

petrmanek commented 5 years ago

@gort818 trying now... will let you know how it went

petrmanek commented 5 years ago

@gort818 Are you sure it builds from the sources?

When I tried the same thing, it worked nicely until I uninstalled qtmpris and qtdbusextended packages in /usr/lib/. From that point on, it started complaining that

Project ERROR: dbusextended-qt5 development package not found

The build directory currently looks like this:

build
├── lib
│   ├── qtdbusextended
│   │   ├── Makefile.dbusextended-qt
│   │   └── src
│   │       ├── dbusextendedabstractinterface.o
│   │       ├── dbusextendedpendingcallwatcher.o
│   │       ├── dbusextended-qt5.prf
│   │       ├── libdbusextended-qt5.prl
│   │       ├── libdbusextended-qt5.so -> libdbusextended-qt5.so.1.0.0
│   │       ├── libdbusextended-qt5.so.1 -> libdbusextended-qt5.so.1.0.0
│   │       ├── libdbusextended-qt5.so.1.0 -> libdbusextended-qt5.so.1.0.0
│   │       ├── libdbusextended-qt5.so.1.0.0
│   │       ├── Makefile
│   │       ├── moc_dbusextendedabstractinterface.cpp
│   │       ├── moc_dbusextendedabstractinterface.o
│   │       ├── moc_dbusextendedpendingcallwatcher_p.cpp
│   │       ├── moc_dbusextendedpendingcallwatcher_p.o
│   │       ├── moc_predefs.h
│   │       └── pkgconfig
│   │           └── dbusextended-qt5.pc
│   └── qtmpris
│       ├── Makefile.mpris-qt
│       └── src
└── Makefile

To me, this suggests that pkg-config does not see the dbusextended-qt5.pc file, and that's why the qtmpris target fails.

petrmanek commented 5 years ago

Victory! It took me a while (I'm not your regular QMake user) but I figured out how to do it.

So the current state of the fork is as follows:

  1. Repositories qtmpris and qtdbusextended are now referenced as submodules. For this reason, all package build files (bump @omni6) have to use --recursive when cloning QtWebFlix, otherwise the lib/ directory will be left empty.
  2. I had to create patched .pro files for both libraries. Unfortunately, this was a necessary step in order to bypass pkg-config and build both libraries as static. Both configuration files can be found in the lib/ directory along with their README.md -- they will have to be kept up-to-date with their counterparts in their respective repos.
  3. qtwebflix.pro was moved to src/src.pro and configured to link with the built libraries. The new qtwebflix.pro contains dependency information to ensure that the libraries get built ahead of the executable.
  4. The executable binary is now located in src/qtwebflix within the build directory and has grown to ~360 kB. It no longer requires qtmpris and qtdbusextended as runtime dependencies, since they are both linked statically.

Let me know if it works for you.

omni6 commented 5 years ago

the whole stuff is too fragmented... can we do a merge please?

For pkgbuild i think i found a solution to init the submodules:

source=("git://somewhere.org/something/something.git"
        "git://somewhere.org/mysubmodule/mysubmodule.git")

prepare() {
  cd something
  git submodule init
  git config submodule.mysubmodule.url $srcdir/mysubmodule
  git submodule update
}
petrmanek commented 5 years ago

@omni6 Nice work!

In the meantime, I've refactored the code. We currently have MprisInterface base class which does the generic stuff and NetflixMprisInterface which contains JavaScripts and timers specific to Netflix.

This way, we can later add implementations for Amazon Prime, HBO Go, etc. and still have everything nicely organized.

omni6 commented 5 years ago

No wait with honour... i haven't used your patched *.pro files. When i do i can't get a proper make install to work. Yes sure because of no pkgconfig... can we get a complete install rule when doing make -C ${srcdir}/src/src.pro INSTALL_ROOT="${pkgdir}" install

including:

?

petrmanek commented 5 years ago

@omni6 The libs are not required at runtime -- only at build time. So, you don't need to include them in the package.

You should be able to get everything just by executing the following commands in the project root:

mkdir build
cd build
qmake -c release ..
make
INSTALL_ROOT="${pkgdir}" make install

Disclaimer: I'm not sure how will handle the .desktop and .svg file.

omni6 commented 5 years ago

@petrmanek but when the libs are not required, i can use the old way and do it manually... i will test...

omni6 commented 5 years ago

here we go: PKGBUILD

petrmanek commented 5 years ago

@omni6 Seems nice. But we need to merge it to the base repo before going ahead with the release.

omni6 commented 5 years ago

@petrmanek sure, this is for testing. Only thing to change is url

Will wait for your go @gort818 !

omni6 commented 5 years ago

@petrmanek

Disclaimer: I'm not sure how will handle the .desktop and .svg file.

no worries, not a problem.

gort818 commented 5 years ago

@petrmanek

  1. I had to create patched .pro files for both libraries. Unfortunately, this was a necessary step in order to bypass pkg-config and build both libraries as static. Both configuration files can be found in the lib/ directory along with their README.md -- they will have to be kept up-to-date with their counterparts in their respective repos.

Oops should have let you know that sorry! Looking good, whenever you are ready to send a pull request send it on over.

A question though, how are you going to check which mpris interface to use?

@omni6 package looks good I will let you know when we are good to go.

petrmanek commented 5 years ago

@gort818 Pull request underway.

A question though, how are you going to check which mpris interface to use?

MainWindow can switch interfaces based on the current URL's hostname in the QWebEngineView.

omni6 commented 5 years ago

i have to push, aur package broken...

gort818 commented 5 years ago

@petrmanek @omni6 Thanks guys!