Giter Site home page Giter Site logo

matthias4217 / jukebox-ultra-nrv Goto Github PK

View Code? Open in Web Editor NEW

This project forked from etiandre/jukebox-ultra-nrv

3.0 3.0 3.0 2.31 MB

Multi-user jukebox for LAN use

Home Page: https://gitlab.com/club-jeux-int/jukebox-ultra-nrv

Python 43.81% JavaScript 9.09% CSS 36.25% HTML 10.61% Dockerfile 0.23%
flask jquery mpv python youtube-dl

jukebox-ultra-nrv's People

Contributors

cepehang avatar etiandre avatar madewink avatar matthias4217 avatar mrplobi avatar rubenroy avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

jukebox-ultra-nrv's Issues

Add support for Bandcamp albums

I'm not sure how to do this :

  • Either we add all the album at once
  • Or we display all the songs and the user has to select only one at once

Systemd service call to the jukebox fails when no shell=True

When the jukebox is called in the shell "by hand" to be executed by python3.6, it runs just fine. But when setting up a systemd service as such:

# /etc/systemd/system/jukebox.service
[Unit]
Description=Jukebox service

[Service]
WorkingDirectory=/home/hackademint/jukebox-ultra-nrv/
ExecStart=/usr/bin/python3.6 run.py
Restart=always
User=hackademint
Group=hackademint

[Install]
WantedBy=default.target

then it seems to have a hard time getting the sound card's master control. The 41th line of the main.py script in jukebox/src/, which is:

amixer_out = subprocess.check_output(['amixer', 'get', "'Master',0"]).decode()

fails as the alsa mixer does not find the master control:

amixer: Unable to find simple control 'Master',0

while this definitely does not happen when ran "by hand". A fix that I found was to add the keyword argument shell=True to the check_output() function:

amixer_out = subprocess.check_output(['amixer', 'get', 'Master'], shell=True).decode()

This way, it seems that the subprocess call is made just like from an actual shell, so it works well.

Also, selecting the 'Master' control seems preferable to me, as alsamixer automatically resolves it to 'Master',0 when called, but I'm not too sure on that one.

Removing the currently playing song stops the jukebox completely

When removing the currently playing song from the jukebox using the corresponding black cross button, the entry is removed yes, but firstly the song does not really stop:

capture-2

and secondly also, the entire server seems to simply exit without any error message:

capture-3

while the youtube embeded video still runs and is still interactive but without any sound produced though.

Not enough quota for Youtube API

Should we drop it and use another way to search on youtube ? (maybe with youtube-dl, since it is possible to use the cli option ytsearch:, like #14)

Song from bandcamp fails to be searched

INFO in playlist: Adding track https://horskh.bandcamp.com/track/victim                                                     
  File "playlist.py", line 36, in add                                                                 
    track["album"], track["duration"],
KeyError: 'album'

version mkIII-0.6.6

Internationalization

For now, most of the app is in french, but it would be cool to handle other languages (even if not providing translations, making it easier to add some in the future).

Add restart button

Sometimes, the jukebox bugs, and I have to restart it manually. A button on the web interface could be better.

Playing files from FTP

When browsing a ftp through a browser, we can fetch the url of a resource. However, it is encoded with %20 replacing spaces, accents replaced by %xx. We should parse it when needed.

Jukebox not compatible with Python 3.7

When executed in Python version 3.7, the asynchronous routine calls generate Exceptions like this:

Exception in callback MPV.__init__.<locals>.mpv_event_extractor() at /usr/local/lib/python3.7/dist-packages/mpv.py:276
handle: <Handle MPV.__init__.<locals>.mpv_event_extractor() at /usr/local/lib/python3.7/dist-packages/mpv.py:276>
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/mpv.py", line 254, in _event_generator
    raise StopIteration()
StopIteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3.7/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/local/lib/python3.7/dist-packages/mpv.py", line 278, in mpv_event_extractor
    for event in _event_generator(self.handle):
RuntimeError: generator raised StopIteration
Exception in thread Thread-27:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.7/threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "/home/hackademint/jukebox-ultra-nrv/jukebox/__init__.py", line 27, in player_worker
    self.mpv = MyMPV(None)  # we start the track
  File "/home/hackademint/jukebox-ultra-nrv/jukebox/src/MyMPV.py", line 10, in __init__
    self.playlist_pos = 0
  File "/usr/local/lib/python3.7/dist-packages/mpv.py", line 493, in setter
    _mpv_set_property_string(self.handle, name.encode(), str(proptype(value)).encode())
  File "/usr/local/lib/python3.7/dist-packages/mpv.py", line 174, in wrapper
    ErrorCode.raise_for_ec(func, *args)
  File "/usr/local/lib/python3.7/dist-packages/mpv.py", line 59, in raise_for_ec
    raise ex(ec, *args)
AttributeError: ('mpv property is not available', -10, <MpvHandle object at 0x7f39c1724bf8>, b'playlist-pos', b'0')

Exception in callback MPV.__init__.<locals>.mpv_event_extractor() at /usr/local/lib/python3.7/dist-packages/mpv.py:276
handle: <Handle MPV.__init__.<locals>.mpv_event_extractor() at /usr/local/lib/python3.7/dist-packages/mpv.py:276>
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/mpv.py", line 254, in _event_generator
    raise StopIteration()
StopIteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3.7/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/local/lib/python3.7/dist-packages/mpv.py", line 278, in mpv_event_extractor
    for event in _event_generator(self.handle):
RuntimeError: generator raised StopIteration

When looking it up, it seems to be due to python3.7 changing the way things work in asyncio (PEP 479), thus introducing this new bug. The fix that is adviced is to surround generator yields with a try-except clause. For example:

yield next(seq)

needs to be replaced by:

try:
    yield next(seq)
except StopIteration:
    return

Although the exception in itself seems to be raised by mpv, making the jukebox available to python3.7 shouldn't be too much of a hassle. If it is really too complex to solve yourselves, maybe consider declaring the jukebox to require python3.6 for now ?

Replace volume control

We currently use the Alsa mixer directly. Maybe it would be better to use the volume of mpv.

Fix the site length

For now, it seems that the Youtube iframe makes the page larger than the screen size. We should correct it.

Generic extractor

When doing a search with !url, use youtube-dl to fetch it.
If people open a ftp to which the jukebox can connect, youtube-dl is able to play it.

Songs sometimes fail to load and thus do not play

mai 14 23:12:21 hackademint python3.6[20735]: JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
mai 14 23:12:21 hackademint python3.6[20735]: ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave
mai 14 23:12:21 hackademint python3.6[20735]: couldn't open play stream: No such file or directory
mai 14 23:16:18 hackademint python3.6[20735]: ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave
mai 14 23:16:18 hackademint python3.6[20735]: Cannot connect to server socket err = No such file or directory
mai 14 23:16:18 hackademint python3.6[20735]: Cannot connect to server request channel
mai 14 23:16:18 hackademint python3.6[20735]: jack server is not running or cannot be started
mai 14 23:16:18 hackademint python3.6[20735]: JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
mai 14 23:16:18 hackademint python3.6[20735]: ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave
mai 14 23:16:18 hackademint python3.6[20735]: couldn't open play stream: No such file or directory

The jukebox seems to sometimes generate internal errors when trying to load a song that will then fail to play and the jukebox just goes to the next song in the current playlist. When trying again with the same song, it does not fail every time. The error does not seem to be consistent with resolution, length, volume, ...

Add a statistics page

Adds a page giving statistics :

  • Tracks with most plays (all time | these last 7 days | this day)
  • Users with most plays (all time | these last 7 days | this day)

Add a license

For now, there is nothing, and since the source code is available publicly, I feel like it would be better to have one.

Song not found on Youtube

File "backends/search/youtube.py", line 42, in search
    raise Exception("nothing found on youtube")
Exception: nothing found on youtube

Version : mkIII-0.6.9(last confirmed in mkIII-0.8.4)

Did search with https://www.youtube.com/watch?v=bipmm792YFE&list=PL326E728CF5AA4CBF&index=14. https://www.youtube.com/watch?v=bipmm792YFE works fine.

The problem is that youtube-dl think this is a playlist, and not an element in a playlist. (see #7 )

Allows users to update tracks

Tracks are currently stored after they have been added for the first time. However, they may lack some metadata when they have been searched (album for songs from Youtube, duration for songs from jamendo...).

I propose we add a button to the verso of tiles to update the information.

We could either do an other research on the track url with the same function as the current search, or implement a better search function with Youtube-dl

Plus de flexibilité sur Alsamixer

Actuellement, vous utilisez alsaaudio.Mixer() pour controler le volume audio. Si vous ne mettez pas d'arguments, il cherchera par défaut la carte son 'Master'. Cependant, la carte son ne s'appelle pas toujours 'Master'. Notamment, quand pulseaudio est installé, la carte son principale est renommée en 'Speaker'.

Il faudrait donc utiliser alsaaudio.mixers() pour obtenir la liste des cartes sons, puis soit choisir la première, soit permettre aux gens de mettre le nom de leur carte son (en mettant 'Master' par défaut). Et après quand tu créé un Mixer alsaaudio, tu fais alsaaudio.Mixer(control=[nom du contrôle])

Lock database access

File "/home/membre/soft/jukebox-ultra-nrv/jukebox/src/playlist.py", line 59, in add                                                                 
    (track_id, user_id))
sqlite3.OperationalError: database is locked

Version : mkIII-0.6.7

Since this version, there can be simultaneous access to the database in several threads. We must implement a lock.

Help page

Create a help/about page on the jukebox.

It should display the list of websites loaded, the address of the Github repository and maybe more.

Better account management

Refactor users :

  • Maybe add a profile section : a profile text
  • Allows user to change their password

Improves logs

We should rewrite the logging system, separating production from development and showing only informations needed.

Cache songs

Often, the same songs are listened several time in a short period. It could be interesting to download them and put them in cache. However, I don't know what's the best way to do it : most popular songs or most recent ?

Musics from suggestions don't play

When addind a song from the suggestions, mpv cannot play it. However, adding the same song by doing a search works fine. I haven't tested if it affected other sources than Youtube.

Version : mkIII-0.6.3

How to fix : we should probably focus on what url is stored in the database, it is possible that the media has been moved.

Concerning #20, we could fix both, as #20 is currently partially fixed.

Add equalizer

I suggest we add a new "Settings" page with an equalizer. It is probably done in a similar way than we have a volume slider.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.