Skip to content

Commit

Permalink
mpris (#64)
Browse files Browse the repository at this point in the history
mpris
  • Loading branch information
rachmadaniHaryono authored Mar 13, 2022
1 parent 3f2fcfb commit 67e5be7
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 7 deletions.
47 changes: 46 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,53 @@ yewtube is run on the command line using the command:

Enter `h` from within the program for help.


Using yewtube with mpris
------------------------

1. Install PyGObject, GTK and their dependencies based on this guide https://pygobject.readthedocs.io/en/latest/getting_started.html
2. Install yewtube with mpris extra

```shell
> # recommended
> pipx install 'yewtube[mpris]'
> # or
> pip install 'yewtube[mpris]'
```

3. check yewtube version

```shell
> yt --version
yewtube version : 2.8.2
yt_dlp version : 2022.02.04
Python version : 3.9.7 (default, Nov 7 2021, 15:17:57)
[GCC 11.2.0]
Processor : x86_64
Machine type : x86_64
Architecture : 64bit, ELF
Platform : Linux-5.13.0-35-generic-x86_64-with-glibc2.34
sys.stdout.enc : utf-8
default enc : utf-8
Config dir : /home/user/.config/mps-youtube
dbus : 1.2.18
glib : True
env:TERM : tmux-256color
env:SHELL : /usr/bin/zsh
env:LANG : en_US.UTF-8
```

If everything working correctly, dbug and glib would have similar result as above text

4. run `set mpris true` on yewtube
5. check with `playerctl`

```shell
> playerctl -l
mps-youtube.instance567867
```

How to Contribute
-----------------

Contributions are welcomed! However, please check out the [contribution page](https://github.com/iamtalhaasghar/yewtube/blob/master/CONTRIBUTING.md) before making a contribution.

29 changes: 23 additions & 6 deletions mps_youtube/init.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import argparse
import logging
import multiprocessing
import os
import platform
import re
import sys
import logging
import tempfile
import argparse
import platform
import multiprocessing

try:
# pylint: disable=F0401
Expand All @@ -23,9 +23,9 @@
except ImportError:
has_readline = False

from . import cache, g, __version__, screen, c, paths, config
from .util import has_exefile, dbg, xprint, load_player_info, assign_player
from . import __version__, c, cache, config, g, paths, screen
from .helptext import helptext
from .util import assign_player, dbg, has_exefile, load_player_info, xprint

mswin = os.name == "nt"

Expand Down Expand Up @@ -274,6 +274,21 @@ def _get_version_info():

from yt_dlp.version import __version__ as ytdlp_version

dbus_version = None
glib = False
try:
import dbus

dbus_version = dbus.__version__
except Exception:
pass
try:
from gi.repository import GLib

glib = True
except Exception:
pass

out = "yewtube version : " + __version__
out += "\nyt_dlp version : " + ytdlp_version
out += "\nPython version : " + sys.version
Expand All @@ -284,6 +299,8 @@ def _get_version_info():
out += "\nsys.stdout.enc : " + sys.stdout.encoding
out += "\ndefault enc : " + sys.getdefaultencoding()
out += "\nConfig dir : " + paths.get_config_dir()
out += "\ndbus : " + str(dbus_version)
out += "\nglib : " + str(glib)

for env in "TERM SHELL LANG LANGUAGE".split():
value = os.environ.get(env)
Expand Down

0 comments on commit 67e5be7

Please sign in to comment.