You are not logged in.

#26 2018-09-25 13:13:48

arnaudv6
Member
Registered: 2016-02-25
Posts: 51

Re: lizzy (music player) python script that feeds your music to mpv

@watsonalgas
Meanwhile I would very much value your experience and your opinion if you keep on using m over lizzy: I want to improve and optimize every little bit of the workflow in lizzy.

Offline

#27 2018-09-25 14:05:51

arnaudv6
Member
Registered: 2016-02-25
Posts: 51

Re: lizzy (music player) python script that feeds your music to mpv

arnaudv6 wrote:

you can select '/', as long as you don't type a filter string. Am I clear?

or, if you have this line in your profile in ~/.local/share/lizzy/config.ini

libraryIsSlash = no

then simply press [^a] when on left pane.
Again, am I clear?

Offline

#28 2018-10-04 23:37:28

watsonalgas
Member
Registered: 2007-01-15
Posts: 88

Re: lizzy (music player) python script that feeds your music to mpv

I meant to just simply type "m -o hello" and it would play the first match, so yeah, the command line without going into the program.

What I like about "m" is the speed of just typing and it'll play it, fast.  I like lizzy too, I just usually have something specific I want to play and don't need to look at a list.

On another note, when I type on the search line and hit backspace, it does nothing.  I have to use a back arrow and hit delete to be able to delete what I typed.  Am I doing something wrong?

Last edited by watsonalgas (2018-10-04 23:37:55)

Offline

#29 2018-10-05 07:42:26

arnaudv6
Member
Registered: 2016-02-25
Posts: 51

Re: lizzy (music player) python script that feeds your music to mpv

Thanks for your return, @watsonalgas!
You're doing nothing wrong but I must be.
If backspace don't work, you must have never seen the like of this screen, one of the two features I wanted bad enough to write lizzy.

Please help me debug this:

  • What locale do you use?

  • Can you uncomment lines 611 to 614 (inclusive), and press backspace in lizzy: which key is reported at the top? Does your filter-pattern string get altered in any way?

Offline

#30 2018-10-05 11:58:23

arnaudv6
Member
Registered: 2016-02-25
Posts: 51

Re: lizzy (music player) python script that feeds your music to mpv

I just flashed:
this certainly is a problem of "backspace terminal convention".... let off my question about the locale:
if you would just tell me the name of your terminal, and the key returned when uncommenting lines 611 to 614 (inclusive), and pressing backspace....
Thanks

edit: "your terminal" -> "the name of your terminal'

Last edited by arnaudv6 (2018-10-05 12:18:20)

Offline

#31 2018-10-05 13:44:25

watsonalgas
Member
Registered: 2007-01-15
Posts: 88

Re: lizzy (music player) python script that feeds your music to mpv

You're right, I've never seen that screen.  The key returned is ^?

I'm using tmux within urxvtc.

Offline

#32 2018-10-05 15:18:55

arnaudv6
Member
Registered: 2016-02-25
Posts: 51

Re: lizzy (music player) python script that feeds your music to mpv

OK, this should work now?! (version 2018.10.5)
Again, thanks @watsonalgas for reporting. There indeed was a backspace compatibility issue.
I installed xfce4-terminal because I know it can emulate multiple terminal types, but I didn't even have to go and play with them: the default config showed this bug:
I guess it affected all vte-based terminals also... Simple but nasty bug.

Offline

#33 2018-10-05 17:02:48

watsonalgas
Member
Registered: 2007-01-15
Posts: 88

Re: lizzy (music player) python script that feeds your music to mpv

Yeah, that works now.

It looks like .jpg files are shown in the results list, though.

Offline

#34 2018-10-05 17:19:52

arnaudv6
Member
Registered: 2016-02-25
Posts: 51

Re: lizzy (music player) python script that feeds your music to mpv

Yeah, the "excluded extensions" are just not added with their parent directory, but should you select a file, it works...
At least that is the actual behaviour.

Maybe I'll consider changing this: adding per profile extensions (or banned extensions)...
I don't know if some use lizzy as an image viewer in conjunction with mpv-image-viewer?
My images are mostly my camera photos, never renamed, I don't use mpv-image-viewer, and though I don't rely on musics id3 tags, I still rely on pictures metadata for search: lizzy is no-go for me here.
I still have to think those workflow through.

Offline

#35 2018-11-09 21:01:23

arnaudv6
Member
Registered: 2016-02-25
Posts: 51

Re: lizzy (music player) python script that feeds your music to mpv

Juste tagged a release of Lizzy. I deem it worth mentionning since lizzy should now work in TTYs.
As the changelog states, this is a mixed feelings bag: much remains to be done.
Still the code is in much better state. If you disregard the long comment blocks of "todo: notes to self".

Offline

#36 2018-11-13 18:04:14

arnaudv6
Member
Registered: 2016-02-25
Posts: 51

Re: lizzy (music player) python script that feeds your music to mpv

Just tagged a much cleaner code, with functional youtube-dl... I don't intend to advertise coming versions here. Those waiting on either
[ctrl]+[arrows] to work in TTY
[ctrl]+[c] to interrupt youtube-dl current download
please stay tuned in the repository.

Offline

#37 2018-11-14 17:43:00

Sirsurthur
Member
Registered: 2009-02-02
Posts: 122

Re: lizzy (music player) python script that feeds your music to mpv

Thanks Arnaud for these updates.

I only use lizzy as music player since few months now. Works great !

Offline

#38 2018-11-19 19:09:24

whitie
Member
Registered: 2011-03-13
Posts: 18

Re: lizzy (music player) python script that feeds your music to mpv

Just some thoughts about pythonic programming: Please read https://www.python.org/dev/peps/pep-0008/. Classes should be named MixedCase, functions and variables lower_case_with_underscores. Your 'sessionConfObj' is an useless use of a class, a dict would make the job. For your commandline arguments look at the argparse modul. It can also generate your help message. In various functions you have one letter variable names, this is horrible to read. Variable names should tell the reader what content the variable have. Path name concatenation should be done with os.path.join, not with +.

Whitie

Offline

#39 2018-11-28 08:18:16

arnaudv6
Member
Registered: 2016-02-25
Posts: 51

Re: lizzy (music player) python script that feeds your music to mpv

@Sirsurthur: glad you like it! Thanks


@whitie: Well you certainly gave some critics: thanks. And thanks for reading the code in the first place.
You're the whitie on bitbucket I guess from all the python projects there?

I checked my code against http://pep8online.com meticulously, and feel left-down because when re-reading this PEP it is in contradiction sometimes...
I wrote to the owner of that service to tell him.

Classes should be named MixedCase

Done

functions and variables lower_case_with_underscores

Done

Your 'sessionConfObj' is an useless use of a class, a dict would make the job.

Done
And thanks for the tip: as a matter of fact, when searching for a way to avoid globals, my first google match was the like of this[1], so I failed to see the obvious way.
[1] https://www.quora.com/How-can-I-avoid-u … ython-code

For your commandline arguments look at the argparse modul. It can also generate your help message.

I know about argparse but have you read my comment?

In various functions you have one letter variable names, this is horrible to read.

Done

Path name concatenation should be done with os.path.join, not with +.

Done

I feel like the code is in much better shape to be read, and I've progressed: thanks whitie

Last edited by arnaudv6 (2018-11-28 08:19:45)

Offline

#40 2018-12-12 07:05:27

whitie
Member
Registered: 2011-03-13
Posts: 18

Re: lizzy (music player) python script that feeds your music to mpv

@arnaudv6: Yes, I am the whitie from bitbucket. The Code looks much better now. Some minor things:

Constants should be upper (HELP, SCRIPT_REVISION),

print('Could not load startup playlist file:' + startup_playlist)

should be

print('Could not load startup playlist file:', startup_playlist)

Functions like this

def make_nice_dir_names_list(settings):
    """ generate comprehensive list of directories for browser mode.
        This has good results against code-speed and readability. """
    # 12 is arbitrary. Make it the average folders basename length?
    settings['nice_dir_names_list'] = [
        nice_dir_name(dir_path) for dir_path, _ in settings['music_db_list']
        if dir_path.endswith('/') and dir_path.rfind('/', 0, -1) < 12
        ]

are better written

def make_nice_dir_names_list(music_db_list):
    return [
        nice_dir_name(dir_path) for dir_path, _ in music_db_list
        if dir_path.endswith('/') and dir_path.rfind('/', 0, -1) < 12
        ]

# In the code
settings['nice_dir_names_list'] = make_nice_dir_names_list(settings['music_db_list'])

Don't give all the settings to every function when only two or three are used. Simply return the result and assign it to the settings dict.

Edit: Line 1088 ff

        # If music collection is not default-one, use separate index file.
        if profile is 'DEFAULT':
            profile = ''
        if defaultPath == settings['userMusicsPath']:
            settings['music_db_file'] = os.path.join(
                settings['xdg_data_home'], 'collection.idx')
        else:
            settings['music_db_file'] = os.path.join(
                settings['xdg_data_home'], profile + 'collection.idx')

can be written

        # If music collection is not default-one, use separate index file.
        if profile == 'DEFAULT':
            profile = ''
        settings['music_db_file'] = os.path.join(
            settings['xdg_data_home'], '{}collection.idx'.format(profile))

Whitie

Last edited by whitie (2018-12-12 08:23:29)

Offline

#41 Today 07:54:23

arnaudv6
Member
Registered: 2016-02-25
Posts: 51

Re: lizzy (music player) python script that feeds your music to mpv

@Whitie: thanks again for your time.

  • Done

  • Done

  • Done, thanks, that was a legacy of how -when thinking this feature through- I thought I'd reuse de default index file as much as possible across profiles.


@community: I just tagged a new version, with
Added scrollbars
Better coloring accross terminals
Working key-bindings accross terminals
Fixed overlapping notifications

With this version, lizzy changes default filenames in ~/.local/share/lizzy

  • collection.idx -> DEFAULTcollection.idx

  • session.m3u -> DEFAULTsession.m3u

Last edited by arnaudv6 (Today 07:54:41)

Offline

#42 Today 09:14:56

arnaudv6
Member
Registered: 2016-02-25
Posts: 51

Re: lizzy (music player) python script that feeds your music to mpv

...just actually committed the changes in default filenames. sorry for the false start

Offline

Board footer

Powered by FluxBB