com.mydetv.swarm 2017-09-12

Milestones
authenticating to Google, Facebook, and Twitter
Chats are working, emoticons, and chat history
bandwidth tests are working, chaining videos is still a bit flaky.

Next Steps
UI work
*adding channel participants to left panel
*adding user controls. edit nickname
*show username for debugging

Next Up
Add gstreamer so tier 1 streams can come from java and not the browser

timezones, joda, and mysql

Ever since I created a job that was responsible for billing, I realized how important timezones and daylight savings are to application development. I had scheduled the job to run at 1:30 AM. Once a year it didn’t run (when daylight savings skipped 1:30 and jumped to 2:30), and once a year it ran twice (when daylight savings jumped back at 2 AM to 1 AM). Then I had to worry about global deployments and learned even more. Now my rule is, do everything in UTC. Convert things for users to display in their timezone, but store it all UTC.

Some notes for Java 8:

import java.time.ZonedDateTime;
converting:
ZonedDateTime zdt = ZonedDateTime.parse(input, fmt);
Timestamp sqlTs = Timestamp.from(zdt.toInstant());

ZonedDateTime zonedDateTime = ZonedDateTime.now();

ZoneId zoneId = ZoneId.of(“UTC+1”);

ZonedDateTime zonedDateTime2 =
ZonedDateTime.of(2015, 11, 30, 23, 45, 59, 1234, zoneId);
ZonedDateTime newZoneDateTime =
previousDateTime.plus(Period.ofDays(3));
ZoneId zoneId = ZoneId.of(“UTC+1”);
ZoneId zoneId2 = ZoneId.of(“Europe/Copenhagen”);

Some notes for mysql and joda
mysql has a field time datetime which is actually the number of seconds since 1970
it includes milliseconds as a fractional part.
joda has a datetime which is similar
for sprocs, pass datetime as timestamp

to convert from joda datetime to mysql’s timestamp
java.sql.Timestamp d = new java.sql.Timestamp(jodaDateTime.getMillis());

and back again
os.setDt(new DateTime(java.sql.Timestamp.valueOf(rs.getTimestamp(“dt”).toString())));

that worked but I’m hoping for a better way

favicon

Who knew there was so much to know about a Favicon. A Cheat Sheet to get things straight and a generator to get the job done.

Let’s define what we want for our websites.

Firefox, Chrome, IE, Edge and Devices IOS and Android.
Animations are just plain irritating so none of that.

Establishing a lowest common denominator:
16×16 and 32×32
IOS: 70×76

facebook authentication screen will use 1024×1024

shn shorten

Shorten is an old format to create lossless compressed audio files. FLAC is the new way. I’ll show some of the joy I’ve had trying to convert the old shn files to flac.

ffmpeg seems to want to do it if you have it compiled with the correct libraries.
ffmpeg -i file.shn file.shn.flac

com.mydetv.swarm data calculations

A java signaling server for connecting up the various clients.

Authentication will be done via major providers, users can pick their favorite- facebook, google, twitter, microsoft, linkedin. This will allow us to use their profile picture, email address, and if they are greater that 18 from the provider.

Websockets is used for the signaling to/from the server.

Webrtc will be used for the audio/video and data streams. Data streams will be used to test the users bandwidth (even though getStats is broken for data streams so we’ll write our own).

From the start we will accommodate just two channels- 24×7 reruns and live. Each channel will serve two streams: standard and low quality (for users with limited bandwidth or data caps imposed by their ISP). Standard quality will be around 1.5 to 3 Mbps and low quality will be 500 Kbps.

Tier zero is the original stream. Tier 1 is hosted at My Delaware TV and will serve several tier 2 users. Tier 2 users will serve tier 3 users, and so on down the pyramid. Testing will provide the practical number of users each tier can serve, all the way down to tier n.

Say tier 1 will serve 4 tier 2 users. Tier 2 will each serve two tier 3 users, allowing us to accommodate 4+4*2= 12 total users. Tier 10 will be able to accommodate 2044 users.

tier users in tier
2 4
3 12
4 28
5 60
6 124
7 252
8 508
9 1020
10 2044

To directly serve that many users a 2 Mbps feed My Delaware TV would need 4088 Mpbs. At Verizon business FIOS pricing using my current bill/speed, I would need 28 150 Mbps lines at a cost of $4,140/month.

MYDETV update 2017-07-27

Got a java program wired up and authenticating users with Google.
Eventually will hook up Facebook and maybe more.

Websockets is next:
for java:
https://blog.openshift.com/how-to-build-java-websocket-applications-using-the-jsr-356-api/
wasn’t clear on how to start the server with the jetty module enabled

WebSocket tutorial with Java server (Jetty) and JavaScript client


not quite there but the browser side javascript part helped me

https://stackoverflow.com/questions/23048778/how-to-instantiate-a-websocketadapter-instance-for-jetty-websockets
a little closer

cutting the cord

Been running mythtv for years. A newer setting is the security pin on the mythtv-setup – general page. It appeared as blank and needed to be 0000.

2020-11-10
build myth:
https://www.mythtv.org/download

 

Kodi from my mac, w8, and ubuntu OK
firestick OK
all working fine, can see live tv and recorded shows.

Links:
This helped setup my capture USB device:
HOWTO set up a Hauppauge HVR-950Q on myth .24 and mythbuntu 10.10
PITA: now requires a login
Here’s what I did 2020-10-10

sudo apt install pavucontrol paprefs pavumeter
make sure the thing is plugged in. dmesg>
[Tue Nov 10 03:43:39 2020] usbcore: registered new interface driver au0828
[Tue Nov 10 03:43:39 2020] usbcore: registered new interface driver snd-usb-audio
[Tue Nov 10 03:43:46 2020] usb 1-2: new high-speed USB device number 4 using ehci-pci
[Tue Nov 10 03:43:46 2020] usb 1-2: config 1 interface 0 altsetting 0 endpoint 0x81 has invalid wMaxPacketSize 0
[Tue Nov 10 03:43:46 2020] usb 1-2: New USB device found, idVendor=2040, idProduct=7200
[Tue Nov 10 03:43:46 2020] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=10
[Tue Nov 10 03:43:46 2020] usb 1-2: Product: WinTV HVR-950
[Tue Nov 10 03:43:46 2020] usb 1-2: Manufacturer: Hauppauge
[Tue Nov 10 03:43:46 2020] usb 1-2: SerialNumber: 4035532980
[Tue Nov 10 03:43:46 2020] au0828: i2c bus registered
[Tue Nov 10 03:43:46 2020] tveeprom: Hauppauge model 72001, rev E1H3, serial# 4035532980
[Tue Nov 10 03:43:46 2020] tveeprom: MAC address is 00:0d:fe:89:58:b4
[Tue Nov 10 03:43:46 2020] tveeprom: tuner model is Xceive XC5000C (idx 173, type 88)
[Tue Nov 10 03:43:46 2020] tveeprom: TV standards NTSC(M) ATSC/DVB Digital (eeprom 0x88)
[Tue Nov 10 03:43:46 2020] tveeprom: audio processor is AU8522 (idx 44)
[Tue Nov 10 03:43:46 2020] tveeprom: decoder processor is AU8522 (idx 42)
[Tue Nov 10 03:43:46 2020] tveeprom: has no radio, has IR receiver, has no IR transmitter
[Tue Nov 10 03:43:46 2020] au0828: hauppauge_eeprom: hauppauge eeprom: model=72001
[Tue Nov 10 03:43:46 2020] au8522 6-0047: creating new instance
[Tue Nov 10 03:43:46 2020] au8522_decoder creating new instance…
[Tue Nov 10 03:43:46 2020] tuner: 6-0061: Tuner -1 found with type(s) Radio TV.
[Tue Nov 10 03:43:46 2020] xc5000: unknown parameter ‘#avoid’ ignored
[Tue Nov 10 03:43:46 2020] xc5000: unknown parameter ‘reload’ ignored
[Tue Nov 10 03:43:46 2020] xc5000 6-0061: creating new instance
[Tue Nov 10 03:43:46 2020] xc5000: Successfully identified at address 0x61
[Tue Nov 10 03:43:46 2020] xc5000: Firmware has not been loaded previously
[Tue Nov 10 03:43:47 2020] au8522 6-0047: attaching existing instance
[Tue Nov 10 03:43:47 2020] xc5000 6-0061: attaching existing instance
[Tue Nov 10 03:43:47 2020] xc5000: Successfully identified at address 0x61
[Tue Nov 10 03:43:47 2020] xc5000: Firmware has not been loaded previously
[Tue Nov 10 03:43:47 2020] dvbdev: DVB: registering new adapter (au0828)
[Tue Nov 10 03:43:47 2020] usb 1-2: DVB: registering adapter 0 frontend 0 (Auvitek AU8522 QAM/8VSB Frontend)…
[Tue Nov 10 03:43:47 2020] IR LIRC bridge handler initialized
[Tue Nov 10 03:43:47 2020] Registered IR keymap rc-hauppauge
[Tue Nov 10 03:43:47 2020] IR RC5(x/sz) protocol handler initialized
[Tue Nov 10 03:43:47 2020] rc rc0: au0828 IR (Hauppauge HVR950Q) as /devices/pci0000:00/0000:00:12.2/usb1/1-2/rc/rc0
[Tue Nov 10 03:43:47 2020] input: au0828 IR (Hauppauge HVR950Q) as /devices/pci0000:00/0000:00:12.2/usb1/1-2/rc/rc0/input13
[Tue Nov 10 03:43:47 2020] lirc lirc0: lirc_dev: driver ir-lirc-codec (au0828-input) registered at minor = 0
[Tue Nov 10 03:43:47 2020] au0828: Remote controller au0828 IR (Hauppauge HVR950Q) initialized
[Tue Nov 10 03:43:47 2020] au0828: Registered device AU0828 [Hauppauge HVR950Q]

Schedules Direct must have (well worth the money)

mythtv guide not showing anything A bit of a pain, but it really was necessary to manually edit every channel.

Stations
Stations with location

Update 2018-10-31
Before I started any updates, I noticed Chip Porter uses HD Home Run. I decided to check it out, but the reviews were just awful. They say “setting up a DVR on a PC is difficult, we make it easy”. I guess they learned just how difficult it is.

I need to update mythtv to support the latest python, but that meant I needed a new QT.
First I installed from QT: https://www.qt.io/. That put it in /opt/Qt5.11.2/.
Then I created
installed it, created ~/.config/qtchooser and put this in there:
/opt/Qt5.11.2/bin
/opt/Qt5.11.2/lib

and checked it with
qmake -v
QMake version 3.0
Using Qt version 5.5.1 in /usr/lib/x86_64-linux-gnu

I also finally found a PPT but didn’t use it.
sudo add-apt-repository ppa:beineri/opt-qt-5.11.1-xenial

I went to my mythtv src directory, did a ‘git pull’ and
./configure \
–enable-proc-opt \
–enable-libmp3lame \
–enable-libx264 \
–enable-libvpx \
–enable-libxvid \
–enable-sdl \
–with-bindings=perl,php \
–perl-config-opts=”INSTALLDIRS=vendor” \
–disable-mythlogserver \
–enable-nonfree

make -j 5
still failed with
mythversion.h:9:2: error: #error You need Qt version >= 5.2.0 to compile MythTV.
#error You need Qt version >= 5.2.0 to compile MythTV.
^
Makefile:576: recipe for target ‘mythsocket.o’ failed
make[2]: *** [mythsocket.o] Error 1
make[2]: Leaving directory ‘/usr/src/mythtv/mythtv/mythtv/libs/libmythbase’
Makefile:78: recipe for target ‘sub-libmythbase-make_first’ failed
make[1]: *** [sub-libmythbase-make_first] Error 2
make[1]: Leaving directory ‘/usr/src/mythtv/mythtv/mythtv/libs’
Makefile:67: recipe for target ‘libs’ failed
make: *** [libs] Error 2

I ended up using ansible https://github.com/MythTV/ansible
First, install the package, then git the source, then run
ansible-playbook -i hosts qt5.yml

That seemed to do it, install worked and kodi looks ok.

Mythweb is always screwed so we’ll dig into that now.
on a0:

cp -a /nfs/a2/home/phomlish/mythtv/29.1/mythweb-fixes-29/* /usr3/web/secure/mythweb
cp -a /nfs/a2/droot/usr/local/share/mythtv/* /usr/local/share/mythtv

change:
/usr/local/share/mythtv/bindings/php/MythBackend.php
$host = “10.11.1.92”;
$port = 6543;
#$host = setting(‘BackendServerAddr’,$hostname);
#$port = setting(‘BackendServerPort’,$hostname);