Mopidy-Touchscreen

mopidy looks pretty cool. i have used MPD quite a bit and now im trying to get my new raspberry pi 3 with adafruit 2.8" capacitive touch screen working. it has taken me a few days to get things figured out, to get mopidy running and grabbing my local tracks, to get the spotify extension working. i used adafruits easy install image so the touchscreen works and not only do i see console output but the touchscreen test program shows touch inputs working. Mopidy-Touchscreen installed fine and it says its running when i run mopidy (sudo mopidy). i have added root to the audio group and spotify and my local files play fine. unfortunately i dont quite understand how and where i can access the actual touchscreen interface. my pi just shows the INFO lines from mopidy that its running and the extensions are loaded. am i missing something?

ok. i figured it out. i didnt have the lines needed in the mopidy.conf file:

sdl_fbdev = /dev/fb1
sdl_mousdrv = TSLIB
sdl_mousedev = /dev/input/touchscreen

once i did that, presto change-o… it worked! i was having problems with the mouse pointer being stuck in the upper left corner. the touchscreen would work, it only registered a click in the upper left corner though. so i followed thse instructions to use the old SDL library https://learn.adafruit.com/adafruit-2-8-pitft-capacitive-touch/pitft-pygame-tips and that fixed the remaining problems. the only issue i still have is no album art for my local files although it is pulling art for the spotify songs. any ideas? anyone?

this is what i am getting on my Now Playing screen even after i installed Mopidy-Local-Images (it is playing music right now)

That screen should show some controls on the top (Volume, pause…). Probably an error happened and because of that nothing is being shown on that screen. I only use Spotify and I made and tested the code to work with it, so probably some adjustments will need to be made to work with Mopidy-Local-Images.

You can run mopidy using the next commad:
sudo mopidy > log.txt 2>&1
This will save the output to log.txt. Check for errors on the file or post it here so I can check what is going wrong.

@9and3r thanks for taking a look and thanks for writing that cool touchscreen plugin. heres the log. i started mopidy, selected local files, selected a file and then pressed the NowPlaying tab and it was red with no title.

INFO Starting Mopidy 2.1.0
INFO Loading config from builtin defaults
INFO Loading config from /root/.config/mopidy/mopidy.conf
INFO Loading config from command line options
INFO Enabled extensions: spotify, touchscreen, http, file, stream, m3u, mpd, softwaremixer, moped, musicbox_webclient, local
INFO Disabled extensions: none
INFO Starting Mopidy mixer: SoftwareMixer
INFO Mixer volume set to 80
INFO Starting Mopidy audio
INFO Starting Mopidy backends: StreamBackend, M3UBackend, FileBackend, LocalBackend, SpotifyBackend
INFO Audio output set to "autoaudiosink"
INFO Loaded 5505 local tracks using json
INFO Starting Mopidy core
INFO Logged in to Spotify in offline mode
INFO Logged in to Spotify in online mode
INFO Starting Mopidy frontends: TouchScreen, MpdFrontend, HttpFrontend
ERROR Frontend (MpdFrontend) initialization error: MPD server startup failed: [Errno 98] Address already in use
INFO HTTP server running at [::ffff:0.0.0.0]:6680
INFO Starting GLib mainloop
WARNING GStreamer warning: gst-stream-error-quark: No volume control found (3)
WARNING GStreamer warning: gst-stream-error-quark: No volume control found (3)
Traceback (most recent call last):
File “/usr/local/lib/python2.7/dist-packages/mopidy_touchscreen/touch_screen.py”, line 106, in track_playback_started
self.screen_manager.track_started(tl_track)
File “/usr/local/lib/python2.7/dist-packages/mopidy_touchscreen/screen_manager.py”, line 178, in track_started
self.screens[main_screen_index].track_started(track.track)
File “/usr/local/lib/python2.7/dist-packages/mopidy_touchscreen/screens/main_screen.py”, line 120, in track_started
track.length / 1000))
TypeError: unsupported operand type(s) for /: ‘NoneType’ and 'int’
Traceback (most recent call last):
File “/usr/local/lib/python2.7/dist-packages/mopidy_touchscreen/touch_screen.py”, line 106, in track_playback_started
self.screen_manager.track_started(tl_track)
File “/usr/local/lib/python2.7/dist-packages/mopidy_touchscreen/screen_manager.py”, line 178, in track_started
self.screens[main_screen_index].track_started(track.track)
File “/usr/local/lib/python2.7/dist-packages/mopidy_touchscreen/screens/main_screen.py”, line 120, in track_started
track.length / 1000))
TypeError: unsupported operand type(s) for /: ‘NoneType’ and 'int’
Traceback (most recent call last):
File “/usr/local/lib/python2.7/dist-packages/mopidy_touchscreen/touch_screen.py”, line 106, in track_playback_started
self.screen_manager.track_started(tl_track)
File “/usr/local/lib/python2.7/dist-packages/mopidy_touchscreen/screen_manager.py”, line 178, in track_started
self.screens[main_screen_index].track_started(track.track)
File “/usr/local/lib/python2.7/dist-packages/mopidy_touchscreen/screens/main_screen.py”, line 120, in track_started
track.length / 1000))
TypeError: unsupported operand type(s) for /: ‘NoneType’ and 'int’
Traceback (most recent call last):
File “/usr/local/lib/python2.7/dist-packages/mopidy_touchscreen/touch_screen.py”, line 106, in track_playback_started
self.screen_manager.track_started(tl_track)
File “/usr/local/lib/python2.7/dist-packages/mopidy_touchscreen/screen_manager.py”, line 178, in track_started
self.screens[main_screen_index].track_started(track.track)
File “/usr/local/lib/python2.7/dist-packages/mopidy_touchscreen/screens/main_screen.py”, line 120, in track_started
track.length / 1000))
TypeError: unsupported operand type(s) for /: ‘NoneType’ and 'int’
Traceback (most recent call last):
File “/usr/local/lib/python2.7/dist-packages/mopidy_touchscreen/touch_screen.py”, line 106, in track_playback_started
self.screen_manager.track_started(tl_track)
File “/usr/local/lib/python2.7/dist-packages/mopidy_touchscreen/screen_manager.py”, line 178, in track_started
self.screens[main_screen_index].track_started(track.track)
File “/usr/local/lib/python2.7/dist-packages/mopidy_touchscreen/screens/main_screen.py”, line 120, in track_started
track.length / 1000))
TypeError: unsupported operand type(s) for /: ‘NoneType’ and 'int’
INFO GLib mainloop got SIGTERM. Exiting…
INFO Stopping Mopidy frontends
INFO Stopping Mopidy core
INFO Stopping Mopidy backends
INFO Stopping Mopidy audio
INFO Stopping Mopidy mixer
pi@rpi3:~ $

The problem is that the song has no defined duration and because of that mopidy-touchscreen crashes as it expects to get the duration. This error should be already fixed on the development version.
Install mopidy-touchscreen from github (develop branch) and it should work.

thank you. i installed with pip install mopidy-touchscreen. how do i install the development version? download the git and copy the script files over the old ones?

i installed it by running the setup.py in the git package. i am still getting the same error

INFO Starting Mopidy 2.1.0
INFO Loading config from builtin defaults
INFO Loading config from /root/.config/mopidy/mopidy.conf
INFO Loading config from command line options
INFO Enabled extensions: spotify, touchscreen, http, moped, stream, m3u, mpd, softwaremixer, file, musicbox_webclient, local
INFO Disabled extensions: none
INFO Starting Mopidy mixer: SoftwareMixer
INFO Mixer volume set to 80
INFO Starting Mopidy audio
INFO Starting Mopidy backends: StreamBackend, M3UBackend, FileBackend, LocalBackend, SpotifyBackend
INFO Audio output set to "autoaudiosink"
INFO Loaded 5505 local tracks using json
INFO Starting Mopidy core
INFO Logged in to Spotify in offline mode
INFO Logged in to Spotify in online mode
INFO Starting Mopidy frontends: TouchScreen, MpdFrontend, HttpFrontend
ERROR Frontend (MpdFrontend) initialization error: MPD server startup failed: [Errno 98] Address already in use
INFO Starting GLib mainloop
INFO HTTP server running at [::ffff:0.0.0.0]:6680
WARNING GStreamer warning: gst-stream-error-quark: No volume control found (3)
Traceback (most recent call last):
File “/usr/local/lib/python2.7/dist-packages/Mopidy_Touchscreen-1.0.0-py2.7.egg/mopidy_touchscreen/touch_screen.py”, line 106, in track_playback_started
self.screen_manager.track_started(tl_track)
File “/usr/local/lib/python2.7/dist-packages/Mopidy_Touchscreen-1.0.0-py2.7.egg/mopidy_touchscreen/screen_manager.py”, line 178, in track_started
self.screens[main_screen_index].track_started(track.track)
File “/usr/local/lib/python2.7/dist-packages/Mopidy_Touchscreen-1.0.0-py2.7.egg/mopidy_touchscreen/screens/main_screen.py”, line 120, in track_started
track.length / 1000))
TypeError: unsupported operand type(s) for /: ‘NoneType’ and 'int’
INFO GLib mainloop got SIGTERM. Exiting…
INFO Stopping Mopidy frontends
INFO Stopping Mopidy core
INFO Stopping Mopidy backends
INFO Stopping Mopidy audio
INFO Stopping Mopidy mixer

EDIT: sorry. i made a mistake and it was the old version i was installing. once i figured out to download the DEVELOP zip and install that one, the error went away. i am still working on getting local images to work from my MP3 files, does your module require the Mopidy-Local-Images to pull images? where does it get the artwork?

@9and3r hey i have figured something out. if i play local media through a playlist that i created with mpd/mpc:

mpc clear
mpc -w update
mpc listall | mpc add
mpc save allmusic

and then through mopidy i select the playlsit, Mopidy-Touchscreen has the title of the song but says Unknown Artist and Unknown Title and has no playing time. if i play the SAME song through the local media tab, it has playing time and artist and album. i am still NOT seeing album art from local files so my question above is still relevant.

as far as i can tell, the playlist is the only way to play ALL my local music on random. so this is what is holding me back from actually using Mopidy and Mopidy-Spotify and Mopidy-Touchscreen as my main system. any ideas?

@9and3r - is Mopidy-Touchscreen working with Raspberry Pi Stretch?
pip install Mopidy-Touchscreen outputs the following error:

Collecting Mopidy-Touchscreen
Downloading https://www.piwheels.hostedpi.com/simple/mopidy-touchscreen/Mopidy_Touchscreen-1.0.0-py2.py3-none-any.whl
Collecting Mopidy>=1.0 (from Mopidy-Touchscreen)
Downloading Mopidy-2.1.0-py2.py3-none-any.whl (210kB)
100% |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 215kB 142kB/s
Collecting setuptools (from Mopidy-Touchscreen)
Exception:
Traceback (most recent call last):
File “/usr/lib/python2.7/dist-packages/pip/basecommand.py”, line 215, in main
status = self.run(options, args)
File “/usr/lib/python2.7/dist-packages/pip/commands/install.py”, line 353, in run
wb.build(autobuilding=True)
File “/usr/lib/python2.7/dist-packages/pip/wheel.py”, line 749, in build
self.requirement_set.prepare_files(self.finder)
File “/usr/lib/python2.7/dist-packages/pip/req/req_set.py”, line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File “/usr/lib/python2.7/dist-packages/pip/req/req_set.py”, line 554, in _prepare_file
require_hashes
File “/usr/lib/python2.7/dist-packages/pip/req/req_install.py”, line 278, in populate_link
self.link = finder.find_requirement(self, upgrade)
File “/usr/lib/python2.7/dist-packages/pip/index.py”, line 465, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File “/usr/lib/python2.7/dist-packages/pip/index.py”, line 423, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File “/usr/lib/python2.7/dist-packages/pip/index.py”, line 568, in _get_pages
page = self._get_page(location)
File “/usr/lib/python2.7/dist-packages/pip/index.py”, line 683, in _get_page
return HTMLPage.get_page(link, session=self.session)
File “/usr/lib/python2.7/dist-packages/pip/index.py”, line 792, in get_page
"Cache-Control": “max-age=600”,
File “/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py”, line 501, in get
return self.request(‘GET’, url, **kwargs)
File “/usr/lib/python2.7/dist-packages/pip/download.py”, line 386, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File “/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py”, line 488, in request
resp = self.send(prep, **send_kwargs)
File “/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py”, line 609, in send
r = adapter.send(request, **kwargs)
File “/usr/share/python-wheels/CacheControl-0.11.7-py2.py3-none-any.whl/cachecontrol/adapter.py”, line 47, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
File “/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/adapters.py”, line 423, in send
timeout=timeout
File “/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py”, line 643, in urlopen
_stacktrace=sys.exc_info()[2])
File “/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/util/retry.py”, line 315, in increment
total -= 1
TypeError: unsupported operand type(s) for -=: ‘Retry’ and ‘int’