tgorgdotcom / locast2plex

A very simple script to connect locast to Plex's live tv/dvr feature.
MIT License
232 stars 43 forks source link

Ubuntu 16.04 LTS Plex Error during "Live" playback #52

Open craigarno opened 4 years ago

craigarno commented 4 years ago

Just upgraded Plex to plexmediaserver_1.20.1.3252-a78fef9a9_amd64.deb, but something may have also changed at Locast.

image

# uname -a
Linux pluto 4.4.0-187-generic #217-Ubuntu SMP Tue Jul 21 04:18:15 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

image

# python -V
Python 2.7.12

Here is the init sequence which shows an error which may not have existed before:

craig@pluto:~/Project/locast2plex% python main.py -u:craig@mydomain.com -p:xxxxxxxx --debug --addy:127.0.0.1
Locast2Plex v0.4.1
DEBUG MODE ACTIVE
UUID found.
UUID set to: nlkmkntz...
Logging into Locast using username craig@mydomain.com...
Validating User Info...
User Info obtained.
User didDonate: True
User donationExpire: 1603474321
Getting user location...
User location obtained as 47.8388/-122.1985
Getting user's media market (DMA)...
DMA found as 819
Getting list of stations based on DMA...
Loading FCC Stations list...
Starting device server on 0.0.0.0:6077
Starting SSDP server...
Process Process-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
    self._target(*self._args, **self._kwargs)
  File "main.py", line 232, in ssdpServerProcess
    ssdp.run()
  File "/home/usr/craig/Project/locast2plex/SSDPServer.py", line 54, in run
    self.sock.bind(('0.0.0.0', SSDP_PORT))
  File "/usr/lib/python2.7/socket.py", line 228, in meth
    return getattr(self._sock,name)(*args)
error: [Errno 98] Address already in use

When attempting to view a Live show from Locast using Firefox 80.0 (64-bit) Plex Web GUI (which used to work):

127.0.0.1 - - [27/Aug/2020 10:27:38] "GET /discover.json HTTP/1.0" 200 -
127.0.0.1 - - [27/Aug/2020 10:27:38] "GET /lineup.json HTTP/1.0" 200 -
127.0.0.1 - - [27/Aug/2020 10:27:38] "GET /lineup_status.json HTTP/1.0" 200 -
Getting station info for 1572389490750...
Determining best video stream for 1572389490750...
Found 3 Playlists
1572389490750 will use 1280x720 resolution at 2700000bps
127.0.0.1 - - [27/Aug/2020 10:27:39] "GET /watch/1572389490750 HTTP/1.1" 200 -
ffmpeg version 2.8.15-0ubuntu0.16.04.1 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.10) 20160609
  configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
  WARNING: library configuration mismatch
  avcodec     configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv --enable-version3 --disable-doc --disable-programs --disable-avdevice --disable-avfilter --disable-avformat --disable-avresample --disable-postproc --disable-swscale --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libvo_aacenc --enable-libvo_amrwbenc
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
[https @ 0x13666e0] No trailing CRLF found in HTTP header.
Input #0, hls,applehttp, from 'https://sea.locastnet.org/proxy/sea/variant/4BMQxEn1Ab3eymmWLFixx4IBKOahP25kp7LUrpkuJSjrKTZ7EpaVZpBOrunwOU5BwrOG1toUqz8fiiCReGiFjSVKIt3MVFznpAIazsrJVIy.m3u8':
  Duration: N/A, start: 90123.972622, bitrate: N/A
  Program 0 
    Metadata:
      variant_bitrate : 0
    Stream #0:0: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], Closed Captions, 30 fps, 30 tbr, 90k tbn, 60 tbc
    Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 201 kb/s
Output #0, mpegts, to 'pipe:1':
  Metadata:
    encoder         : Lavf56.40.101
    Stream #0:0: Video: h264 ([27][0][0][0] / 0x001B), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 30 fps, 30 tbr, 90k tbn, 90k tbc
    Stream #0:1: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz, stereo, 201 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[https @ 0x1388fc0] No trailing CRLF found in HTTP header.
frame=  246 fps=0.0 q=-1.0 size=    1695kB time=00:00:08.19 bitrate=1694.9kbits/[https @ 0x136dee0] No trailing CRLF found in HTTP header.
frame=  360 fps=316 q=-1.0 size=    3591kB time=00:00:12.01 bitrate=2449.1kbits/127.0.0.1 - - [27/Aug/2020 10:27:41] "GET /discover.json HTTP/1.0" 200 -
127.0.0.1 - - [27/Aug/2020 10:27:41] "GET /lineup_status.json HTTP/1.0" 200 -
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 44990)
Traceback (most recent call last):
  File "/usr/lib/python2.7/SocketServer.py", line 290, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 318, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 331, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python2.7/SocketServer.py", line 654, in __init__
    self.finish()
  File "/usr/lib/python2.7/SocketServer.py", line 713, in finish
    self.wfile.close()
  File "/usr/lib/python2.7/socket.py", line 283, in close
    self.flush()
  File "/usr/lib/python2.7/socket.py", line 307, in flush
    self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe
----------------------------------------
craigarno commented 4 years ago

More testing suggests this isn't a locast2plex problem at least for Ubuntu 16.04 LTS x64, rather it appears to be a Plex WebGUI problem: Summary for Plex Version 1.20.1.3252 Live TV using locast2plex tuner under Ubuntu 16.04 LTS x64:

craigarno commented 4 years ago

Separate issue, I contacted my Locast provider and they say Locast can support up to 4 live streams (locast2plex defaults to 2). Locast Support also warns that quick channel surfing can cause a lockout when activated streams aren't closed fast enough to keep the 4 stream limit from being exceeded. They also say, wait some minutes (probably about 30 minutes) and the problem will clear at the Locast end.

In my setup the locast2plex parameter to modify is in templates.py called TunerCount: 4

From Locast Support:

Users can stream Locast on up to 4 devices simultaneously. Channel surfing will cause users to receive this error. We recommend remaining on each channel for at least 30 seconds before moving on to the next channel.

Locast does not support 3rd party DVR apps and cannot assist in troubleshooting related issues.

If you receive a Max Streams/Rate Limit error it will clear after a period of time and you will be allowed to login again.