Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MPD server script : Argument list too long #10

Open
taziden opened this issue Jan 31, 2017 · 4 comments
Open

MPD server script : Argument list too long #10

taziden opened this issue Jan 31, 2017 · 4 comments

Comments

@taziden
Copy link
Contributor

taziden commented Jan 31, 2017

Hi,

I seem to hit a limit on the number of arguments while executing the mpd server script :

$ python3 server.py --full-rescan ~/music/
Traceback (most recent call last):
  File "server.py", line 183, in <module>
    full_rescan(args.mpd_root)
  File "server.py", line 88, in full_rescan
    subprocess.check_call(["blissify", mpd_root] + all_songs)
  File "/usr/lib/python3.4/subprocess.py", line 556, in check_call
    retcode = call(*popenargs, **kwargs)
  File "/usr/lib/python3.4/subprocess.py", line 537, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/usr/lib/python3.4/subprocess.py", line 859, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.4/subprocess.py", line 1457, in _execute_child
    raise child_exception_type(errno_num, err_msg)
OSError: [Errno 7] Argument list too long

Stats from my mpd db :

$ mpc stats
Artists:   3120
Albums:    3030
Songs:    37429
@Phyks
Copy link
Owner

Phyks commented Feb 1, 2017

Hi,

Thanks for the feedback, indeed it is failing because it is passing 37429 (number of songs) arguments which is way too much.

I believe @Polochon-street has some quick fix for this that he might push soon.

Anyways, the best option and long term fix for this would be to change the way blissify works and make it listen on stdin rather than taking a list of arguments. I'll try to fix this deeper as soon as possible :/

@Polochon-street
Copy link
Contributor

Polochon-street commented Feb 1, 2017

Hi,
Here's a quick (dirty) fix while we correct the innards of blissify:
0001-Quick-and-dirty-fix-for-songs-list-lengh.txt

If you can't apply the patch, just replace L88 subprocess.check_call(["blissify", mpd_root] + all_songs)
by
nb_songs = len(all_songs)
for i in range(int(len(all_songs) / 100)):
subprocess.check_call(["blissify", mpd_root] + all_songs[i*100:(i+1)*100])
subprocess.check_call(["blissify", mpd_root] + all_songs[len(all_songs) - (len(all_songs) % 100):len(all_songs)])

That should fix your issue!

@taziden
Copy link
Contributor Author

taziden commented Feb 2, 2017

Thanks, it works.
(Well, work in progress)

@taziden taziden closed this as completed Feb 2, 2017
@Phyks Phyks reopened this Feb 2, 2017
@Phyks
Copy link
Owner

Phyks commented Feb 2, 2017

Good to know! I have just reopened the issue to remember to have a deeper look as soon as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants