You are not logged in.

#176 2013-05-15 20:21:23

OK100
Member
From: [U==]
Registered: 2010-04-26
Posts: 455

Re: Lyvi - command-line lyrics (and more!) viewer

Idlusen wrote:

Hi,

I modified Lyvi a tiny bit so that it can support foobar2000 (with control).

Since it is not a native player (although worth using in my opinion), and since my solution is a dirty hack, is it of any use giving it?

I'm curious, can I see the code? wink

Offline

#177 2013-05-15 21:45:18

Idlusen
Member
From: France
Registered: 2013-05-15
Posts: 21

Re: Lyvi - command-line lyrics (and more!) viewer

Sure! Here's what I came up with.

WARNING: what follows is plain dirty.

I assumed that foobar is running through wine. The problem is that Peter Pawlowski doesn't want foobar to export info about current track unless you code a plugin.
I found pyfoobar but it seems to rely on windows dependencies and I don't think it would be good to add wine-related dependencies.

The only way I found is to get the info from the titlebar which is fully customizable. Then using wmctrl and grep/cut we can retrieve what we want.

So the prerequisites are:

  • You have formatted foobar's titlebar.

  • You use a wmctrl-compliant wm.

The code:
I added a key/value entry in search_player():

players = {
	'foobar2000.exe': foobar2000,

And added a foobar2000 player class (I in fact only adapted the cmus one):

class foobar2000(Player):
    def __init__(self):
        self.run = {
            'type': 'process',
            'name': 'foobar2000.exe',
        }
        self.np = {
            'type': 'command',
            'name': 'foo-remote',
            'str': {
                'artist_beg': 'tag artist ',
                'artist_end': '\n',
                'album_beg': 'tag album ',
                'album_end': '\n',
                'title_beg': 'tag title ',
                'title_end': '\n',
                'file_beg': 'file ',
                'file_end': '\n',
                'stopped': 'status stopped',
            },
        }
        self.ctl = {
            'type': 'command',
            'commands': {
                'play': 'wine /home/Idlusen/Desktop/foobar2000_16/foobar2000.exe /play',
                'pause': 'wine /home/Idlusen/Desktop/foobar2000_16/foobar2000.exe /pause',
                'next': 'wine /home/Idlusen/Desktop/foobar2000_16/foobar2000.exe /next',
                'prev': 'wine /home/Idlusen/Desktop/foobar2000_16/foobar2000.exe /prev',
                'stop': 'wine /home/Idlusen/Desktop/foobar2000_16/foobar2000.exe /stop',
                'volup': '',
                'voldn': '',
            },
        }

I know: foobar's commands use a hardcoded path, and what is foo-remote?
foo-remote is the bash script I wrote to imitate cmus-remote -Q output:

#!/bin/bash

if [[ "`wmctrl -l | grep foobar | cut -d "@" -f 6`" == "1" ]]
then
    pause="status stopped"
fi

title=`wmctrl -l| grep foobar | cut -d '@' -f 2`
album=`wmctrl -l| grep foobar | cut -d '@' -f 3`
artist=`wmctrl -l| grep foobar | cut -d '@' -f 4`

echo "tag title $title
tag album $album
tag artist $artist
$pause"

exit

I think this could easily be merged with the python code.

And finally the titlebar's fomatting is (from foobar2000 preferences/Display):

@[%title%]@[%album%]@[%artist%]@[%path%]@[%ispaused%]@ - foobar2000

I used "@" because I needed an uncommon character in song tiles/album names/artist names.
[%path%] is problematic due to Windows path format, plus I don't really know how player.file is used.
" - foobar2000" is needed so we can grep it out of wmctrl

All of this works fine for me, though I'm very aware it is highly sketchy.

So is there anyway to integrate an improved version of this (I'm working on it) in lyvi or will this forever be my personal trick? ^^

Offline

#178 2013-05-18 17:27:37

OK100
Member
From: [U==]
Registered: 2010-04-26
Posts: 455

Re: Lyvi - command-line lyrics (and more!) viewer

^ Thanks for the code. I'm currently working on a new version of lyvi (branch rewrite: https://github.com/ok100/lyvi/tree/rewrite if anyone's interested) and I'll try to include it.

Offline

#179 2013-05-18 17:32:38

OK100
Member
From: [U==]
Registered: 2010-04-26
Posts: 455

Re: Lyvi - command-line lyrics (and more!) viewer

@everyone:
Latest rxvt-unicode update breaks lyvi's background feature: https://projects.archlinux.org/svntogit … c92e03cc65
I'll try to find different approach for setting backgrounds. In the meantime, you need to compile rxvt-unicode with

--enable-pixbuf

Offline

#180 2013-05-19 16:54:27

OK100
Member
From: [U==]
Registered: 2010-04-26
Posts: 455

Re: Lyvi - command-line lyrics (and more!) viewer

@everyone:
FYI, now there's also #lyvi channel on Freenode.

Offline

#181 2013-08-24 00:58:28

sardina
Member
Registered: 2013-02-23
Posts: 152

Re: Lyvi - command-line lyrics (and more!) viewer

Hi OK100, first of all thanks for your work.

Can you tell me how to reproduce this result?

My attepts produced this. No matter how I set the offsets: images are always centered "behind" all panes.

This is my latest lyvi.conf:

bg                            = True
bg_type                       = cover
bg_opacity                    = 0.6
bg_tmux_cover_pane            = 1
bg_tmux_cover_pane_underlying = False
player                        = mpd
mpd_config_file               = /home/luke/.mpd/mpd.conf

Also, how can I set 'lang' in order to have Italian metadata? I tried 'lang=it' without success.

TIA.

Last edited by sardina (2013-08-24 01:07:34)

Offline

#182 2013-08-24 05:38:55

OK100
Member
From: [U==]
Registered: 2010-04-26
Posts: 455

Re: Lyvi - command-line lyrics (and more!) viewer

@sardina:

Hi,

Can you tell me how to reproduce this result?

My attepts produced this. No matter how I set the offsets: images are always centered "behind" all panes.

This is my latest lyvi.conf:

bg                            = True
bg_type                       = cover
bg_opacity                    = 0.6
bg_tmux_cover_pane            = 1
bg_tmux_cover_pane_underlying = False
player                        = mpd
mpd_config_file               = /home/luke/.mpd/mpd.conf

You also need to set bg_tmux and bg_tmux_window_title options (see man lyvi for details).
By the way, the current master branch is deprecated and will not be updated any more. You might want to use the rewrite branch instead.

Also, how can I set 'lang' in order to have Italian metadata? I tried 'lang=it' without success.

Not all providers have metadata in all languages.

Offline

#183 2013-08-24 15:35:17

sardina
Member
Registered: 2013-02-23
Posts: 152

Re: Lyvi - command-line lyrics (and more!) viewer

OK100 wrote:

By the way, the current master branch is deprecated and will not be updated any more. You might want to use the rewrite branch instead.

I saw that, but I didn't find any related documentation on your github.

Which are the dependencies? (I got several ImportError trying to start it)
How to install it correctly? (there's no PKGBUILD)
How to configure it? (lyvi.conf from master branch doesn't work anymore)

Offline

#184 2013-08-25 07:56:10

OK100
Member
From: [U==]
Registered: 2010-04-26
Posts: 455

Re: Lyvi - command-line lyrics (and more!) viewer

sardina wrote:

Which are the dependencies? (I got several ImportError trying to start it)

Dependencies are python, python-urwid, python-pillow, python-glyr-git (AUR), python-gobject, python-dbus, python-psutil.

sardina wrote:

How to install it correctly? (there's no PKGBUILD)

For now, just clone the repository and checkout the rewrite branch:

git clone https://github.com/ok100/lyvi.git
cd lyvi
git checkout rewrite
sardina wrote:

How to configure it? (lyvi.conf from master branch doesn't work anymore)

Configuration file for the new version is a python script. For example, config file for the tmux background like on this screenshot would look like this:

bg = True
bg_tmux_backdrops_pane = 1
bg_tmux_backdrops_underlying = False
bg_tmux_cover_pane = 1
bg_tmux_cover_underlying = False
bg_tmux_window_title = 'tmux-lyvi'
bg_type = 'cover'

Documentation is still missing, though you can find all currenly supported options in the config_defaults.py file.

Last edited by OK100 (2013-10-26 19:21:02)

Offline

#185 2013-08-25 12:45:21

sardina
Member
Registered: 2013-02-23
Posts: 152

Re: Lyvi - command-line lyrics (and more!) viewer

Thanks for your reply.

OK100 wrote:
sardina wrote:

Which are the dependencies? (I got several ImportError trying to start it)

Dependencies are python, python-pillow (AUR), python-glyr-git (AUR).

I got this:

Traceback (most recent call last):
  File "/home/luke/bin/lyvi", line 3, in <module>
    import lyvi
  File "/home/luke/.config/lyvi/lyvi/__init__.py", line 111, in <module>
    import lyvi.tui
  File "/home/luke/.config/lyvi/lyvi/tui.py", line 6, in <module>
    import urwid
ImportError: No module named 'urwid'

So extra/python-urwid is needed as well.

Moreover, lyvi seems to misunderstand some names:

20130825144234.png 20130825144258.png

Last edited by sardina (2013-08-25 12:45:47)

Offline

#186 2013-08-26 11:46:00

OK100
Member
From: [U==]
Registered: 2010-04-26
Posts: 455

Re: Lyvi - command-line lyrics (and more!) viewer

Does this command show the right image?

glyrc cover --artist "My Bloody Valentine" --album "Loveless Disc 1  Original Version Remastered" --write '/tmp/:artist:_:album:.:format:' --callback 'sxiv ":path:"'

(replace sxiv with your image viewer)

Offline

#187 2013-08-26 13:26:16

sardina
Member
Registered: 2013-02-23
Posts: 152

Re: Lyvi - command-line lyrics (and more!) viewer

Yes.

Offline

#188 2013-08-26 17:47:06

zeltak
Member
From: New England
Registered: 2010-08-07
Posts: 168

Re: Lyvi - command-line lyrics (and more!) viewer

Hya ok100

ok after moving apartments, switching countries and jobs i finally have some breathing time smile whats up?

how do i go and test the new version/branch? is there an AUR package?

best

Z.

Offline

#189 2013-08-26 21:01:06

dysoco
Member
Registered: 2011-10-11
Posts: 43

Re: Lyvi - command-line lyrics (and more!) viewer

Oh damn, I was writing the same, but I'll just use this tongue

I created a small script which streams music directly from Youtube, so I don't have to download them, I just type "Blowin in the wind" in the TTY and I can listen to it.
I was writing a Lyrics feature for this, I'll see if I can modify this in any way.

Thanks!

Offline

#190 2013-08-26 21:10:58

SahibBommelig
Member
From: Germany
Registered: 2010-05-28
Posts: 80

Re: Lyvi - command-line lyrics (and more!) viewer

dysoco wrote:

I created a small script which streams music directly from Youtube, so I don't have to download them, I just type "Blowin in the wind" in the TTY and I can listen to it.
I was writing a Lyrics feature for this, I'll see if I can modify this in any way.

Lyvi uses libglyr for this. (Just in the unlikely case you were not aware of it.)

Offline

#191 2013-08-27 12:06:30

OK100
Member
From: [U==]
Registered: 2010-04-26
Posts: 455

Re: Lyvi - command-line lyrics (and more!) viewer

@zeltak:
Hi,
See this post.

@sardina:
Please can you tell me how to reproduce it? Did you play a song from MCR before that album?


I'm thinking about adding another view which will show a list of youtube videos of the currently playing song. User will be able to choose the video and play it in external player. Moreover, in configuration file will be possible to set a custom string that is append to every search, e.g "tutorial" to search for tutorials how to play the song, etc.

Last edited by OK100 (2013-08-27 12:14:28)

Offline

#192 2013-08-27 18:33:03

sardina
Member
Registered: 2013-02-23
Posts: 152

Re: Lyvi - command-line lyrics (and more!) viewer

OK100 wrote:

@sardina:
Please can you tell me how to reproduce it? Did you play a song from MCR before that album?

Here I just started ncmpcpp, Loomer being the first song in the playlist.

Then I switched to if i am.

Both songs are by My Bloody Valentine, respectively from Loveless and m b v albums.

I have no My Chemical Romance albums.

Offline

#193 2013-08-28 08:36:01

OK100
Member
From: [U==]
Registered: 2010-04-26
Posts: 455

Re: Lyvi - command-line lyrics (and more!) viewer

sardina wrote:

I have no My Chemical Romance albums.

So it seems like libglyr issue. Try to delete the cache file (~/.local/share/lyvi/metadata.db).

Offline

#194 2013-09-07 16:15:34

dysoco
Member
Registered: 2011-10-11
Posts: 43

Re: Lyvi - command-line lyrics (and more!) viewer

Would love support for RadioTray: http://radiotray.sourceforge.net/

I'll try to do that myself, although I have little to no idea how lyvi handles lyrics tongue

I guess you use DBUS? How do I interact with it to get the song title?

Last edited by dysoco (2013-09-07 16:27:48)

Offline

#195 2013-09-28 07:48:10

OK100
Member
From: [U==]
Registered: 2010-04-26
Posts: 455

Re: Lyvi - command-line lyrics (and more!) viewer

dysoco wrote:

Would love support for RadioTray: http://radiotray.sourceforge.net/

I'll try to do that myself, although I have little to no idea how lyvi handles lyrics tongue

I guess you use DBUS? How do I interact with it to get the song title?

If RadioTray supports MPRIS then it should work with Lyvi out-of-box.

Offline

#196 2013-09-30 20:59:01

jdarnold
Member
From: Medford MA USA
Registered: 2009-12-15
Posts: 485
Website

Re: Lyvi - command-line lyrics (and more!) viewer

Looks like there is the beginnings of MPRIS in RadioTray but it is commented out and, when uncommented, still is a work in progress so it doesn't show up in Lyvi.

Offline

#197 2013-11-03 18:44:42

CarbonChauvinist
Member
Registered: 2012-06-16
Posts: 412
Website

Re: Lyvi - command-line lyrics (and more!) viewer

Does/Can lyvi work with python2-pillow?

Last edited by CarbonChauvinist (2013-11-03 18:45:30)


"the wind-blown way, wanna win? don't play"

Offline

#198 2013-11-04 13:06:58

CarbonChauvinist
Member
Registered: 2012-06-16
Posts: 412
Website

Re: Lyvi - command-line lyrics (and more!) viewer

CarbonChauvinist wrote:

Does/Can lyvi work with python2-pillow?

After checking the AUR page, which I should have done first, I see this was already addressed by a "luculu" who posted:

A patch is needed due to replacement of python2-imaging with python2-pillow. Line containing "import Image" must be converted to "from PIL import Image". Then it works otherwise command gives import error


"the wind-blown way, wanna win? don't play"

Offline

#199 2013-11-04 16:36:28

OK100
Member
From: [U==]
Registered: 2010-04-26
Posts: 455

Re: Lyvi - command-line lyrics (and more!) viewer

CarbonChauvinist wrote:
CarbonChauvinist wrote:

Does/Can lyvi work with python2-pillow?

After checking the AUR page, which I should have done first, I see this was already addressed by a "luculu" who posted:

A patch is needed due to replacement of python2-imaging with python2-pillow. Line containing "import Image" must be converted to "from PIL import Image". Then it works otherwise command gives import error

The master branch hasn't been updated for a while. Consider using the rewrite branch (which can be installed with lyvi-git AUR package)

Offline

#200 2013-11-13 18:34:49

RMorel
Member
Registered: 2013-10-05
Posts: 10

Re: Lyvi - command-line lyrics (and more!) viewer

Hi OK100,

First of, thank you for the great program. I love the convenience of it when used alongside a CLI based mpd setup.

I recently switched to the 'lyvi-git' AUR package and I feel as if it is significantly faster on startup/shutdown.

Today though I am experiencing some problems with lyvi. It would seem to be a bug in lyvi.

My keyboard shortcuts for mpd stopped working, but only while lyvi was running. These shortcuts are just wrappers around mpc.
So I tied mpc in the shell, which gave either 'error: Connection closed by the server' or an error about max connections exceeded.
Following this I checked the open file descriptors of mpd and of lyvi. lyvi appears to open a whole mess of connections to mpd and it is aggregating more and more of them over time.

I have mpd setup to it's default port 6600.
Here some information on the open connections:
Without lyvi running:

% lsof -i :6600
COMMAND   PID USER   FD   TYPE   DEVICE SIZE/OFF NODE NAME
mpd     20092 rolf    7u  IPv4 15373313      0t0  TCP *:mshvlm (LISTEN)

Directly after starting lyvi:

% lsof -i :6600
COMMAND   PID USER   FD   TYPE   DEVICE SIZE/OFF NODE NAME
mpd     20092 rolf    7u  IPv4 15373313      0t0  TCP *:mshvlm (LISTEN)
mpd     20092 rolf   12u  IPv4 15911157      0t0  TCP localhost.localdomain:mshvlm->localhost.localdomain:54275 (ESTABLISHED)
mpd     20092 rolf   14u  IPv4 15911148      0t0  TCP localhost.localdomain:mshvlm->localhost.localdomain:54269 (ESTABLISHED)
lyvi    24054 rolf    7u  IPv4 15909271      0t0  TCP localhost.localdomain:54269->localhost.localdomain:mshvlm (ESTABLISHED)
lyvi    24054 rolf   10u  IPv4 15906386      0t0  TCP localhost.localdomain:54275->localhost.localdomain:mshvlm (ESTABLISHED)

Here it is already using two connections where only one is required.
Important to note though is that it first opens a connection on FD 7 then opens two FIFOs/pipes on FD 8 and 9 and from FD 10 onwards new connections.

And after a few minutes I have as many as a hundred open connections from lyvi to mpd.

% lsof -i :6600
COMMAND   PID USER   FD   TYPE   DEVICE SIZE/OFF NODE NAME
mpd     20092 rolf    7u  IPv4 15373313      0t0  TCP *:mshvlm (LISTEN)
mpd     20092 rolf   12u  IPv4 15989431      0t0  TCP localhost.localdomain:mshvlm->localhost.localdomain:55977 (ESTABLISHED)
mpd     20092 rolf   14u  IPv4 15911148      0t0  TCP localhost.localdomain:mshvlm->localhost.localdomain:54269 (ESTABLISHED)
mpd     20092 rolf   15u  IPv4 15989432      0t0  TCP localhost.localdomain:mshvlm->localhost.localdomain:55979 (ESTABLISHED)
mpd     20092 rolf   16u  IPv4 15989433      0t0  TCP localhost.localdomain:mshvlm->localhost.localdomain:55981 (ESTABLISHED)
mpd     20092 rolf   17u  IPv4 15949652      0t0  TCP localhost.localdomain:mshvlm->localhost.localdomain:55983 (ESTABLISHED)
mpd     20092 rolf   18u  IPv4 15949653      0t0  TCP localhost.localdomain:mshvlm->localhost.localdomain:55985 (ESTABLISHED)
mpd     20092 rolf   19u  IPv4 15949654      0t0  TCP localhost.localdomain:mshvlm->localhost.localdomain:55987 (ESTABLISHED)
mpd     20092 rolf   20u  IPv4 15949658      0t0  TCP localhost.localdomain:mshvlm->localhost.localdomain:55989 (ESTABLISHED)
mpd     20092 rolf   21u  IPv4 15949659      0t0  TCP localhost.localdomain:mshvlm->localhost.localdomain:55991 (ESTABLISHED)
mpd     20092 rolf   22u  IPv4 15949660      0t0  TCP localhost.localdomain:mshvlm->localhost.localdomain:55993 (ESTABLISHED)
lyvi    24054 rolf    7u  IPv4 15909271      0t0  TCP localhost.localdomain:54269->localhost.localdomain:mshvlm (ESTABLISHED)
lyvi    24054 rolf   10u  IPv4 15986658      0t0  TCP localhost.localdomain:54847->localhost.localdomain:mshvlm (CLOSE_WAIT)
lyvi    24054 rolf   11u  IPv4 15986663      0t0  TCP localhost.localdomain:54849->localhost.localdomain:mshvlm (CLOSE_WAIT)
lyvi    24054 rolf   12u  IPv4 15987729      0t0  TCP localhost.localdomain:54851->localhost.localdomain:mshvlm (CLOSE_WAIT)
lyvi    24054 rolf   13u  IPv4 15986807      0t0  TCP localhost.localdomain:54853->localhost.localdomain:mshvlm (CLOSE_WAIT)
lyvi    24054 rolf   14u  IPv4 15986812      0t0  TCP localhost.localdomain:54855->localhost.localdomain:mshvlm (CLOSE_WAIT)
lyvi    24054 rolf   15u  IPv4 15986817      0t0  TCP localhost.localdomain:54857->localhost.localdomain:mshvlm (CLOSE_WAIT)
lyvi    24054 rolf   16u  IPv4 15986822      0t0  TCP localhost.localdomain:54859->localhost.localdomain:mshvlm (CLOSE_WAIT)
lyvi    24054 rolf   17u  IPv4 15986828      0t0  TCP localhost.localdomain:54861->localhost.localdomain:mshvlm (CLOSE_WAIT)
lyvi    24054 rolf   18u  IPv4 15986837      0t0  TCP localhost.localdomain:54863->localhost.localdomain:mshvlm (CLOSE_WAIT)
lyvi    24054 rolf   19u  IPv4 15948200      0t0  TCP localhost.localdomain:54867->localhost.localdomain:mshvlm (CLOSE_WAIT)
lyvi    24054 rolf   20u  IPv4 15948226      0t0  TCP localhost.localdomain:54901->localhost.localdomain:mshvlm (CLOSE_WAIT)
lyvi    24054 rolf   21u  IPv4 15948231      0t0  TCP localhost.localdomain:55429->localhost.localdomain:mshvlm (CLOSE_WAIT)
...
lyvi    24054 rolf   68u  IPv4 15948483      0t0  TCP localhost.localdomain:55973->localhost.localdomain:mshvlm (CLOSE_WAIT)
lyvi    24054 rolf   69u  IPv4 15948488      0t0  TCP localhost.localdomain:55975->localhost.localdomain:mshvlm (CLOSE_WAIT)
lyvi    24054 rolf   70u  IPv4 15948493      0t0  TCP localhost.localdomain:55977->localhost.localdomain:mshvlm (ESTABLISHED)
lyvi    24054 rolf   71u  IPv4 15948498      0t0  TCP localhost.localdomain:55979->localhost.localdomain:mshvlm (ESTABLISHED)
lyvi    24054 rolf   72u  IPv4 15948503      0t0  TCP localhost.localdomain:55981->localhost.localdomain:mshvlm (ESTABLISHED)
lyvi    24054 rolf   73u  IPv4 15948508      0t0  TCP localhost.localdomain:55983->localhost.localdomain:mshvlm (ESTABLISHED)
lyvi    24054 rolf   74u  IPv4 15948513      0t0  TCP localhost.localdomain:55985->localhost.localdomain:mshvlm (ESTABLISHED)
lyvi    24054 rolf   75u  IPv4 15948518      0t0  TCP localhost.localdomain:55987->localhost.localdomain:mshvlm (ESTABLISHED)
lyvi    24054 rolf   76u  IPv4 15948523      0t0  TCP localhost.localdomain:55989->localhost.localdomain:mshvlm (ESTABLISHED)
lyvi    24054 rolf   77u  IPv4 15948548      0t0  TCP localhost.localdomain:55991->localhost.localdomain:mshvlm (ESTABLISHED)
lyvi    24054 rolf   78u  IPv4 15948553      0t0  TCP localhost.localdomain:55993->localhost.localdomain:mshvlm (ESTABLISHED)
lyvi    24054 rolf   79u  IPv4 15948558      0t0  TCP localhost.localdomain:55995->localhost.localdomain:mshvlm (CLOSE_WAIT)
lyvi    24054 rolf   80u  IPv4 15948563      0t0  TCP localhost.localdomain:55997->localhost.localdomain:mshvlm (CLOSE_WAIT)
...

My lyvi config:

% cat ~/.config/lyvi/rc 
mpd_config_file=/home/rolf/.config/mpd/mpd.conf

As for version information:
'pacman -Qii mpd' gives version '0.18.3-2'. Version 0.18 (2013/10/31) did entail a major rewrite to C++.
'pacman -Qii lyvi-git' gives version '55.4088e32-1'.
'pacman -Qii python' gives version '3.3.2-2'.

If you need any additional information to get comprehensive view on what is going on I would be happy to do so.

Last edited by RMorel (2013-11-13 18:37:15)

Offline

Board footer

Powered by FluxBB