2024-04-05	New device and local music streaming

  As I'm  getting older I  noticed there  are two things  I absolutely
  can't stand anymore:  cables and fan noise. Last year  I go my hands
  on a  2013 Sony Vaio  with 4 Gigs of  RAM. Yes, by  modern standards
  this is an absolute potato  but as I'm doing nothing computationally
  expensive on my  machines it didn't bother me that  much. Except for
  one thing:  playing videos in Firefox.  Well, it works but  the fans
  start to spin up immediately. Most of the time I would just download
  videos and watch them with mpv but it was still a major annoyance.

  Also last  year I  got myself a  budget Android for  70€ and  when I
  tried  to watch  a video  in  Fennec (a  Firefox fork)  I was  quite
  astonished that there were no  hiccups, no overheating of the device
  and of course no fan noise. So it was possible even on the shittiest
  device semi-modern  device I could  get. In  that moment I  swore to
  myself that I would never again buy a laptop with active cooling.

  So  what are  my options  in early  2024? Apple  silicon? Absolutely
  fucking no... Well,  there are new Qualcomm chips[1]  on the horizon
  but until these are widely  available (and even more important Linux
  compatible) I  would have to  wait another year.  So why not  get an
  Android tablet  and attach  a Bluetooth keyboard  to it?  OK, mobile
  devices are  basically made for  spying on  the user but  nothing is
  perfect.  Long story  short: last  month I  bought a  Xiaomi Pad  6,
  debloated it  as much  as possible,  installed F-Droid,  installed a
  firewall[2] and blocked every process trying to phone home. This has
  to suffice. One can really go overboard with privacy paranoia.

  Everything worked out fine but I  had no good solution for listening
  to my  music collection. Yes,  I could  just copy everything  to the
  device itself  but I  toyed with  the idea  of network  solution for
  quite some time. I had a  spare Raspberrypi laying around so setting
  up  a little  server was  quickly done.  The Android  side was  more
  problematic.  First I  tried  streaming music  from  a mpd  instance
  running on  the server. This worked  but delays of ~20  seconds when
  changing a song are not acceptable for me.

  Then I learned  rather quickly that you cannot  mount Network shares
  in any file manager,  at least not without being a  pain in the ass.
  This also does not  work in Termux. Then I found a  blog post from a
  guy with a  rather strange setup running mpd locally  on Android and
  streaming over HTTP from the web server[3]. Didn't work for me.

  Next idea: create  a NFS share on  the server and read  from it with
  VLC (Video  Lan Client). This actually  worked but I don't  like VLC
  and it  just didn't feel right  to me. For  example I had to  add an
  option called  "insecure" to my  NFS share configuration for  VLC to
  actually find it. Not that it would  matter much but there had to be
  a simpler solution.

  If you just spin up a  web server with directory listing enabled you
  can  listen to  individual music  and  audio files  via the  browser
  without much hassle. The only problem  is I want a flat playlist and
  continuous playback.  Some time ago  I saw  guy on YouTube  adding a
  HTTP file  source to Kodi as  alternative to Jellyfin. I  tried this
  but I did not like the Kodi  app. It's huge and sluggish and I don't
  want it to  scrape the web to gather meta  information (which is its
  main selling point, I guess). After  waiting for quite some for Kodi
  to unsuccessfully process a folder of ~40 files I gave up.

  Next I began dabbling with  a program called Navidrome[4] which also
  kinda  worked but  the web  interface  was very  annoying and  every
  subsonic  compatible app  on F-droid  was also  annoying as  fuck. I
  don't care  for ID3-tags and  I don't care for  cover art. I  want a
  list of file names to click on. Heck, I don't even have a consistent
  naming convention  for my files. I  just don't care about  that shit
  just play the fucking files randomly and in an endless loop.

  So  back to  square one.  I  really wanted  a low-tech  ghetto-style
  solution for this. So I have a simple web server[5] set up. How do I
  turn a  directory listing into  some sort  of playlist? I  know with
  HTML5  you can  embed media  files  and control  them via  Javashit.
  Surely there  has to  be a  ready-to-go web app  for this  use case.
  After looking through some GitHub projects I found this simple HTML5
  audio player[6]. I  wrote a little shell script to  insert the paths
  to all my audio files directly into the HTML index file.

  I had to  fiddle a bit with  the paths but no biggy.  Then I tweaked
  the style  sheet so the  player takes  advantage of the  full screen
  width  and  height. After  starting  the  web  server in  the  right
  directory      the     web      player     is      accessible     at
  http://raspberrypi.local:8080/webplayer in my local network.

  There are some minor drawbacks to  this approach but it is just good
  enough for me. It is simple, static, lightweight and easy to set up.
  I like it and I also liked  ranting about the minute details of this
  trifle. Thanks  for reading (who  am I  kidding? nobody but  me will
  read this :^).

Footnotes
~~~~~~~~~

[1] https://www.qualcomm.com/products/mobile/snapdragon/pcs-and-tablets/snapdragon-x-elite
[2] https://rethinkdns.com/
[3] https://www.joram.io/blog/android-streaming-mpd/
[4] https://www.navidrome.org/
[5] https://github.com/emikulic/darkhttpd
[6] https://github.com/likev/html5-audio-player