wouterdebie / locast2tuner

Locast to Emby/Plex/Channels server
https://wouterdebie.github.io/locast2tuner/
MIT License
52 stars 8 forks source link

Are you still watching message causes application exit #34

Closed jg-24 closed 3 years ago

jg-24 commented 3 years ago

Discovered this application a couple days ago after troubleshooting an issue with locast2plex and installed it via homebrew. Been working great so far and wanted to get a thank you in before noting the exception below.

Running on mac in terminal, the application failed overnight with the error message below. I had set a sleep timer on the TV and the channel was streaming while waiting for the Roku to timeout/stop streaming (I'm assuming), so I'm not sure if the issue was from the network, the station, Plex, or the Roku. I figured I'd pass along the message to see if there was an opportunity to improve the exception handling so the application doesn't exit.

2021-04-13T01:47:43 [INFO] - Serving https://sea.locastnet.org/proxy/sea/kffv_src269717279.ts (6 s) in 5.6484375s
2021-04-13T01:47:49 [INFO] - Stream 76d4518 - playing: segment "https://sea.locastnet.org/proxy/sea/kffv_src269717279.ts"
thread 'actix-rt|system:0|arbiter:3' panicked at 'called `Result::unwrap()` on an `Err` value: Error { inner: MissingTag { tag: "#EXTM3U", input: " " } }', src/http/mod.rs:382:83
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
zsh: abort      locast2tuner -c ./config.ini
wouterdebie commented 3 years ago

Thanks for this! It seems that the m3u data from locast.org was empty. This should definitely not lead to aborting the application :) As you see in #15 this area needs some attention. I'll work on this.

jg-24 commented 3 years ago

Upgraded to 0.1.12 yesterday, and not running again this morning. Just in case there's different and useful information the exit message, I included it below. I upgraded to 0.1.15 this morning and added RUST_BACKTRACE=1 to the config.ini in case that helps, should it exit again.

Thanks.

- Jeff

2021-04-14T02:01:51 [INFO] - Serving https://sea.locastnet.org/proxy/sea/kffv_src269731820.ts (6 s) in 5.611328s
2021-04-14T02:01:57 [INFO] - Stream 4a3fe67 - playing: segment "https://sea.locastnet.org/proxy/sea/kffv_src269731820.ts"
thread 'actix-rt|system:0|arbiter:8' panicked at 'called `Result::unwrap()` on an `Err` value: Error { inner: MissingTag { tag: "#EXTM3U", input: " " } }', src/http/mod.rs:382:83
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
zsh: abort      locast2tuner -c ./config.ini

config.ini excerpt from :6077/config

cache_timeout = 3600
days = 8
device_firmware = "hdhomerun3_atsc"
device_model = "HDHR3-US"
device_version = "20170612"
disable_station_cache = false
force_timestamps = false
multiplex = true
port = 6077
remap = false
ssdp = false
tuner_count = 5
verbose = 0
wouterdebie commented 3 years ago

@jg-24 Thanks for this. Is it running now or not? And does this only happen on a specific channel? If so, what channel in what DMA is this?

Adding RUST_BACKTRACE=1 to your config is not going to help, but I'm adding an option to enable this.

jg-24 commented 3 years ago

I updated and started it again this morning, and it will likely run all day again. I'll check again this evening and upgrade in case you've added anything today to see if that makes a difference.

I'd assume it's related to KFFV (44.1), but it's hard to say since it could be crappy comcast networking as well. Over the years, I've had many ssh sessions interrupted by whatever it is they do with their network. This is just the channel I have it on when I go to sleep. I was thinking of setting up a couple programs to record on other channels around the same time to see if that has a similar effect (isolating whether it's related to one channel).

For the other information you asked for, you'll need to spoon feed me what you want.

wouterdebie commented 3 years ago

@jg-24 I've added retry behavior in 0.1.17, which should mitigate those issues. Please have a look :)

rtm2017 commented 3 years ago

Just to build on error handling, as a newcomer to locast I ran into the previous issue with not having made a donation yet. I believe I found an error in v0.1.16 that happens when you have made a donation but not validated your email. When I would try to load anything in Plex I would get this error in locast2tuner and the Docker would shut down. I was able to connect VLC as a m3u tuner and see the instructions to go validate my email. I would have expected Plex to just display that message in stead of crashing locast2tuner.

[INFO] - locast2tuner 0.1.16 on Linux 5.10.21-Unraid starting..
[INFO] - UUID: e13a87bb-c904-4690-beca-6ac4b43d4cc2
[INFO] - Logging in with rtm2017@gmail.com
[INFO] - Login succeeded!
[INFO] - Downloading FCC facilities
[INFO] - Cached FCC facilities to /root/.locast2tuner/facilities
[INFO] - Loading stations for Dallas (cache: true, cache timeout: 3600, days: 8)..
[INFO] - Starting http server for Dallas on http://0.0.0.0:6077
[INFO] - Starting 12 workers
[INFO] - Starting "actix-web-service-0.0.0.0:6077" service on 0.0.0.0:6077
[INFO] - Tuners:
[INFO] - +--------+----------+-----+--------------------------------------+-----------------+---------------------+
[INFO] - | City | Zip code | DMA | UUID | Timezone | URL |
[INFO] - +--------+----------+-----+--------------------------------------+-----------------+---------------------+
[INFO] - | Dallas | 75001 | 623 | 303b4185-16ad-50a7-8088-eef4ec3d543d | America/Chicago | http://0.0.0.0:6077 |
[INFO] - +--------+----------+-----+--------------------------------------+-----------------+---------------------+
[INFO] - locast2tuner started..
[INFO] - Stream 167ebb2 - added segment "https://cdn.locastnet.org/email_confirm_src0.ts"
[INFO] - Stream 167ebb2 - added segment "https://cdn.locastnet.org/email_confirm_src1.ts"
[INFO] - Stream 167ebb2 - added segment "https://cdn.locastnet.org/email_confirm_src2.ts"
[INFO] - Stream 167ebb2 - added segment "https://cdn.locastnet.org/email_confirm_src3.ts"
[INFO] - Stream 167ebb2 - added segment "https://cdn.locastnet.org/email_confirm_src4.ts"
[INFO] - Stream 167ebb2 - added segment "https://cdn.locastnet.org/email_confirm_src5.ts"
[INFO] - Stream 167ebb2 - added segment "https://cdn.locastnet.org/email_confirm_src6.ts"
[INFO] - Stream 167ebb2 - added segment "https://cdn.locastnet.org/email_confirm_src7.ts"
[INFO] - Stream 167ebb2 - added segment "https://cdn.locastnet.org/email_confirm_src8.ts"
[INFO] - Stream 167ebb2 - added segment "https://cdn.locastnet.org/email_confirm_src9.ts"
[INFO] - Serving https://cdn.locastnet.org/email_confirm_src0.ts (6 s) in 0s
[INFO] - Stream 167ebb2 - added segment "https://cdn.locastnet.org/email_confirm_src0.ts"
[INFO] - Stream 167ebb2 - added segment "https://cdn.locastnet.org/email_confirm_src1.ts"
[INFO] - Stream 167ebb2 - added segment "https://cdn.locastnet.org/email_confirm_src2.ts"
[INFO] - Stream 167ebb2 - added segment "https://cdn.locastnet.org/email_confirm_src3.ts"
[INFO] - Stream 167ebb2 - added segment "https://cdn.locastnet.org/email_confirm_src4.ts"
[INFO] - Stream 167ebb2 - added segment "https://cdn.locastnet.org/email_confirm_src5.ts"
[INFO] - Stream 167ebb2 - added segment "https://cdn.locastnet.org/email_confirm_src6.ts"
[INFO] - Stream 167ebb2 - added segment "https://cdn.locastnet.org/email_confirm_src7.ts"
[INFO] - Stream 167ebb2 - added segment "https://cdn.locastnet.org/email_confirm_src8.ts"
[INFO] - Stream 167ebb2 - added segment "https://cdn.locastnet.org/email_confirm_src9.ts"
[INFO] - Serving https://cdn.locastnet.org/email_confirm_src0.ts (6 s) in 0s
thread 'actix-rt|system:0|arbiter:2' panicked at 'Fetching https://cdn.locastnet.org/email_confirm_src0.ts failed: Response { url: Url { scheme: "https", username: "", password: None, host: Some(Domain("cdn.locastnet.org")), port: None, path: "/email_confirm_src0.ts", query: None, fragment: None }, status: 404, headers: {"cache-control": "no-cache", "content-type": "text/html", "date": "Wed, 14 Apr 2021 20:32:00 GMT", "expires": "Wed, 14 Apr 2021 20:31:59 GMT", "server": "nginx/1.10.3 (Ubuntu)", "content-length": "580"} }', src/utils.rs:24:9`
wouterdebie commented 3 years ago

@rtm2017 interesting case! Let me investigate a bit. This should be a normal stream, however, the segments don't seem to exist. Let me see if I can replicate this.

wouterdebie commented 3 years ago

@rtm2017 I can't seem to replicate this. I created another locast account, paid the donation and then started locast2tuner. But I can just stream. It might be that they only give the email_confirm stream after a while.

If you still have the unconfirmed account, could you send me a log captured with -v2?

rtm2017 commented 3 years ago

I have already validated my email and got the entire tuner working perfectly in Plex!! So i also tried replicating it with a new account and donation and was not able to do so. I did originally take a few days each between making my locast account, paying a dotation, and then validating my email. I suspect now that Locast has some detection on how long your account has been around and stops streaming live TV until you validate your email. Ill try again over the next few days and see if i can reproduce it with better logging.

jg-24 commented 3 years ago

I'd suggest renaming this issue to "Application fails with exception overnight" so it is something that can be closed and open a new issue for the locast email validation error.

jg-24 commented 3 years ago

Updated to 0.1.18 yesterday and changed "verbose" to 2 (removed the rust_backtrace config item as you suggested), and the resulting /config is below.

Set recordings on NBC from 11:30PM until 2:00AM (not KFFV), but it looks like the same station may have been the source of what caused the application to exit again.

I thought I had an additional hour scheduled to record so the last thing being "watched/recorded" was on a different station (to see if a KFFV issue would kill the recording), but since this is only a couple minutes after the previous night's event, it seems all this replicated was the same issue. I'll see if I can set it up correctly tonight.

I also wanted to suggest a bit more text in the docs around what multiplexing does and whether there is an advantage to using it (especially with the assumption most people only care about 1 zipcode). I gauged settings in this application and in plex on observed quality and responsiveness with 4 TVs and 2 recordings active. If there are different ways to optimize the configuration, then that would probably be a good section for the docs.

Thanks.

- Jeff

config

cache_timeout = 3600
days = 8
device_firmware = "hdhomerun3_atsc"
device_model = "HDHR3-US"
device_version = "20170612"
disable_station_cache = false
force_timestamps = false
multiplex = true
port = 6077
remap = false
rust_backtrace = false
ssdp = false
tuner_count = 5
verbose = 2
2021-04-15T02:04:24 [INFO] - <internal-ip>:64165 "GET /lineup_status.json HTTP/1.1" 200 73 "-" "PlexMediaServer/1.22.2.4282-a97b03fad" 0.000031
2021-04-15T02:04:25 [DEBUG] - starting new connection: https://sea.locastnet.org/
2021-04-15T02:04:25 [DEBUG] - response '200 OK' for https://sea.locastnet.org/proxy/sea/kffv_src269746245.ts
2021-04-15T02:04:25 [INFO] - Stream ab44366 - playing: segment "https://sea.locastnet.org/proxy/sea/kffv_src269746245.ts"
2021-04-15T02:04:25 [DEBUG] - starting new connection: https://sea.locastnet.org/
2021-04-15T02:04:25 [DEBUG] - response '200 OK' for https://sea.locastnet.org/proxy/sea/variant/5rY3xn2opxUnmX4NGfgaxSvBnIGfibN6jMtxtGKbpg5xoiZrazWztAXPHuvIgwe1aYaPop7hmoj8HvNF6RGCMlLBYF6LTmwl64GZviVfbJWq.m3u8
thread 'actix-rt|system:0|arbiter:2' panicked at 'called `Result::unwrap()` on an `Err` value: Error { inner: MissingTag { tag: "#EXTM3U", input: " " } }', src/http/mod.rs:395:83
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
zsh: abort      locast2tuner -c ./config.ini
jg-24 commented 3 years ago

I've presumed since logging this issue that it is caused by the "are you there" message, which I have actually never seen on their application, but knowing how that gets triggered and responded to seems key (which of course may already be implemented but locast could have changed it).

I was looking for more information about how locast implements it, but could only find this:

https://helpcenter.locast.org/portal/en/kb/articles/are-you-still-watch

jg-24 commented 3 years ago

This is definitely related to the "are you still watching" message and response. I just left an NBC channel (KING) running for a few hours and right after I got an are you still watching message on the TV (playing through Plex), the stream stopped with the message below.

- Jeff


2021-04-15T10:32:50 [DEBUG] - starting new connection: https://sea.locastnet.org/
2021-04-15T10:32:50 [DEBUG] - response '200 OK' for https://sea.locastnet.org/proxy/sea/king_src269751327.ts
2021-04-15T10:32:50 [INFO] - Stream 32e1d10 - playing: segment "https://sea.locastnet.org/proxy/sea/king_src269751327.ts"
2021-04-15T10:32:50 [DEBUG] - starting new connection: https://sea.locastnet.org/
2021-04-15T10:32:50 [INFO] - <ip>:55558 "GET /discover.json HTTP/1.1" 200 298 "-" "PlexMediaServer/1.22.2.4282-a97b03fad" 0.000049
2021-04-15T10:32:50 [INFO] - <ip>:55558 "GET /lineup_status.json HTTP/1.1" 200 73 "-" "PlexMediaServer/1.22.2.4282-a97b03fad" 0.000019
2021-04-15T10:32:50 [DEBUG] - response '200 OK' for https://sea.locastnet.org/proxy/sea/variant/5afkQLwmhmetOsdCFTZEPMrKwafE8MX4XkLHwT6u3Zb67Pgo9UKjlCIWGwgUYEvTuxwd7rwAJJihbAaVwNeBIh8hekJUvyHSlDHbTBef9teq.m3u8
2021-04-15T10:32:50 [INFO] - Stream 32e1d10 - added segment "https://sea.locastnet.org/proxy/sea/king_src269751336.ts"
2021-04-15T10:32:50 [INFO] - Stream 32e1d10 - draining 10 segments
2021-04-15T10:32:50 [INFO] - Serving https://sea.locastnet.org/proxy/sea/king_src269751328.ts (6 s) in 5.6220703s
2021-04-15T10:32:53 [INFO] - <ip>:55558 "GET /discover.json HTTP/1.1" 200 298 "-" "PlexMediaServer/1.22.2.4282-a97b03fad" 0.000076
2021-04-15T10:32:53 [INFO] - <ip>:55558 "GET /lineup_status.json HTTP/1.1" 200 73 "-" "PlexMediaServer/1.22.2.4282-a97b03fad" 0.000037
2021-04-15T10:32:56 [DEBUG] - starting new connection: https://sea.locastnet.org/
2021-04-15T10:32:56 [DEBUG] - response '200 OK' for https://sea.locastnet.org/proxy/sea/king_src269751328.ts
2021-04-15T10:32:56 [INFO] - Stream 32e1d10 - playing: segment "https://sea.locastnet.org/proxy/sea/king_src269751328.ts"
2021-04-15T10:32:56 [DEBUG] - starting new connection: https://sea.locastnet.org/
2021-04-15T10:32:56 [INFO] - <ip>:55558 "GET /discover.json HTTP/1.1" 200 298 "-" "PlexMediaServer/1.22.2.4282-a97b03fad" 0.000049
2021-04-15T10:32:56 [INFO] - <ip>:55558 "GET /lineup_status.json HTTP/1.1" 200 73 "-" "PlexMediaServer/1.22.2.4282-a97b03fad" 0.000018
2021-04-15T10:32:56 [DEBUG] - response '200 OK' for https://sea.locastnet.org/proxy/sea/variant/5afkQLwmhmetOsdCFTZEPMrKwafE8MX4XkLHwT6u3Zb67Pgo9UKjlCIWGwgUYEvTuxwd7rwAJJihbAaVwNeBIh8hekJUvyHSlDHbTBef9teq.m3u8
thread 'actix-rt|system:0|arbiter:2' panicked at 'called `Result::unwrap()` on an `Err` value: Error { inner: MissingTag { tag: "#EXTM3U", input: " " } }', src/http/mod.rs:395:83
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
zsh: abort      locast2tuner -c ./config.ini
wouterdebie commented 3 years ago

Wow, great find! So to summarize, we have 2 issues:

jg-24 commented 3 years ago

For what its worth, here's a locast Knowledge Base entry that may point to information about the email verification (but I would also suggest making this a separate issue since there are different steps to reproduce).

https://helpcenter.locast.org/portal/en/kb/articles/verification-screen-still-appearing-after-email-address-has-been-confirmed

jg-24 commented 3 years ago

I saved off the locast browser application looking for some logic around the "are you still watching" message. I am still going through it, and hopefully this doesn't pollute the issue tracker, but these are 2 locations where I found information. There may need to be more context around the 7.js excerpt, but I thought I'd see if this sparked any ideas.

- Jeff

From main.js

"apiError.content":"Oops! Something went wrong. Please reload the page and try again.","areYouStillWatching.autoClosing":"Auto-Closing in ","areYouStillWatching.no":"No","areYouStillWatching.question":"Are You Still Watching?","areYouStillWatching.yes":"Yes"

"apiError.content":"\xa1Ups! Algo ha ido mal. Por favor, recarga la p\xe1gina e int\xe9ntalo de nuevo.","areYouStillWatching.autoClosing":"Cierra Autom\xe1tico En ","areYouStillWatching.no":"No","areYouStillWatching.question":"\xbfSigues Mirando?","areYouStillWatching.yes":"Si"

From 7.js

...
ft = Object(Q.a)({
  question: {
    id: "areYouStillWatching.question",
    defaultMessage: "Are You Still Watching?",
  },
  autoClosing: {
    id: "areYouStillWatching.autoClosing",
    defaultMessage: "Auto-Closing in ",
  },
  yes: { id: "areYouStillWatching.yes", defaultMessage: "Yes" },
  no: { id: "areYouStillWatching.no", defaultMessage: "No" },
}),
vt = Object(s.memo)(function (e) {
  var t = e.onYes,
    a = e.onNo,
    n = Object(z.a)().formatMessage,
    i = (function (e, t) {
      var a = Object(s.useState)(e),
        n = Object(f.a)(a, 2),
        i = n[0],
        r = n[1];
      return (
        Object(s.useEffect)(
          function () {
            var e = setTimeout(function () {
              i > 0 ? r(i - 1) : t();
            }, 1e3);
            return function () {
              return clearTimeout(e);
            };
          },
          [i, t]
        ),
        i
      );
    })(10, a);
  return l.a.createElement(
    "div",
    { className: "are-you-still-watching" },
    l.a.createElement(
      "div",
      { className: "modal-dialog" },
      l.a.createElement(
        "div",
        { className: "modal-content" },
        l.a.createElement(
          "div",
          { className: "modal-header" },
          l.a.createElement(
            "h5",
            { className: "modal-title" },
            n(ft.question)
          )
        ),
        l.a.createElement(
          "div",
          { className: "modal-body" },
          n(ft.autoClosing),
          " ",
          i,
          l.a.createElement(
            "div",
            { className: "buttons" },
            l.a.createElement(
              "button",
              { className: "btn btn-secondary", onClick: a },
              n(ft.no)
            ),
            l.a.createElement(
              "button",
              { className: "btn btn-warning", onClick: t },
              n(ft.yes)
            )
          )
        )
      )
    )
  );
}),
bt = function (e) {
  var t = e.refetchStream,
    a = Object(v.a)(e, ["refetchStream"]),
    n = a.streamData,
    i = a.onClose,
    r = Object(s.useState)(),
    o = Object(f.a)(r, 2),
    c = o[0],
    m = o[1],
    u = (function (e) {
      var t = e.stream,
        a = Object(s.useState)(!1),
        n = Object(f.a)(a, 2),
        i = n[0],
        r = n[1];
      return (
        Object(s.useEffect)(
          function () {
            var e;
            if (t) {
              var a = E()()
                .add(2, "hours")
                .add(49, "minutes")
                .add(Math.floor(600 * Math.random()), "seconds")
                .diff(E()(), "milliseconds");
              e = setTimeout(function () {
                return r(!0);
              }, a);
            }
            return function () {
              r(!1), clearTimeout(e);
            };
          },
          [t]
        ),
        i
      );
    })(n),
    d = Object(s.useCallback)(function (e) {
      m(e);
    }, []),
    p = l.a.createElement(vt, { onNo: i, onYes: t });
  return l.a.createElement(
    l.a.Fragment,
    null,
    l.a.createElement(
      ht,
      Object.assign({}, a, {
        onFullscreenChange: d,
        customElement: u && c ? p : null,
      })
    ),
    u ? p : null
  );
},
wouterdebie commented 3 years ago

Nice Investigation! This is all frontend code that seems to kill the stream after 2:49h and 2:59h of watching, unless the user clicks ok. My guess is that the initial m3u file that is fetched is emptied after 3 hours, but it will still be a valid file. The error you see in locast2tuner is that the requested file is empty, but still exists. I'll move the fetching of the initial m3u to a different place so we can try to fetch the new one after say 2:49h.

On Thu, Apr 15, 2021, 14:42 Jeff @.***> wrote:

I saved off the locast browser application looking for some logic around the "are you still watching" message. I am still going through it, and hopefully this doesn't pollute the issue tracker, but these are 2 locations where I found information. There may need to be more context around the 7.js excerpt, but I thought I'd see if this sparked any ideas.

  • Jeff

From main.js

"apiError.content":"Oops! Something went wrong. Please reload the page and try again.","areYouStillWatching.autoClosing":"Auto-Closing in ","areYouStillWatching.no":"No","areYouStillWatching.question":"Are You Still Watching?","areYouStillWatching.yes":"Yes"

"apiError.content":"\xa1Ups! Algo ha ido mal. Por favor, recarga la p\xe1gina e int\xe9ntalo de nuevo.","areYouStillWatching.autoClosing":"Cierra Autom\xe1tico En ","areYouStillWatching.no":"No","areYouStillWatching.question":"\xbfSigues Mirando?","areYouStillWatching.yes":"Si"

From 7.js

... ft = Object(Q.a)({ question: { id: "areYouStillWatching.question", defaultMessage: "Are You Still Watching?", }, autoClosing: { id: "areYouStillWatching.autoClosing", defaultMessage: "Auto-Closing in ", }, yes: { id: "areYouStillWatching.yes", defaultMessage: "Yes" }, no: { id: "areYouStillWatching.no", defaultMessage: "No" }, }), vt = Object(s.memo)(function (e) { var t = e.onYes, a = e.onNo, n = Object(z.a)().formatMessage, i = (function (e, t) { var a = Object(s.useState)(e), n = Object(f.a)(a, 2), i = n[0], r = n[1]; return ( Object(s.useEffect)( function () { var e = setTimeout(function () { i > 0 ? r(i - 1) : t(); }, 1e3); return function () { return clearTimeout(e); }; }, [i, t] ), i ); })(10, a); return l.a.createElement( "div", { className: "are-you-still-watching" }, l.a.createElement( "div", { className: "modal-dialog" }, l.a.createElement( "div", { className: "modal-content" }, l.a.createElement( "div", { className: "modal-header" }, l.a.createElement( "h5", { className: "modal-title" }, n(ft.question) ) ), l.a.createElement( "div", { className: "modal-body" }, n(ft.autoClosing), " ", i, l.a.createElement( "div", { className: "buttons" }, l.a.createElement( "button", { className: "btn btn-secondary", onClick: a }, n(ft.no) ), l.a.createElement( "button", { className: "btn btn-warning", onClick: t }, n(ft.yes) ) ) ) ) ) ); }), bt = function (e) { var t = e.refetchStream, a = Object(v.a)(e, ["refetchStream"]), n = a.streamData, i = a.onClose, r = Object(s.useState)(), o = Object(f.a)(r, 2), c = o[0], m = o[1], u = (function (e) { var t = e.stream, a = Object(s.useState)(!1), n = Object(f.a)(a, 2), i = n[0], r = n[1]; return ( Object(s.useEffect)( function () { var e; if (t) { var a = E()() .add(2, "hours") .add(49, "minutes") .add(Math.floor(600 * Math.random()), "seconds") .diff(E()(), "milliseconds"); e = setTimeout(function () { return r(!0); }, a); } return function () { r(!1), clearTimeout(e); }; }, [t] ), i ); })(n), d = Object(s.useCallback)(function (e) { m(e); }, []), p = l.a.createElement(vt, { onNo: i, onYes: t }); return l.a.createElement( l.a.Fragment, null, l.a.createElement( ht, Object.assign({}, a, { onFullscreenChange: d, customElement: u && c ? p : null, }) ), u ? p : null ); },

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/wouterdebie/locast2tuner/issues/34#issuecomment-820685910, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABKABRECSABQ6FYUGD2H4DTI46RXANCNFSM423SK4PA .

wouterdebie commented 3 years ago

@jg-24 I think the latest version (v0.1.21) should fix both issues. Thanks for the research and the bug report!

jg-24 commented 3 years ago

Validated.

Updated to locast2tuner 0.1.23 and saw the application make new logins ~ every hour.

Application did not exit overnight.

Apr 16 02:05:35.629 DEBG starting new connection: https://sea.locastnet.org/
Apr 16 02:05:35.744 DEBG response '200 OK' for https://sea.locastnet.org/proxy/sea/kffv_src269760656.ts
Apr 16 02:05:35.856 INFO Stream 5567d7b - playing: segment "https://sea.locastnet.org/proxy/sea/kffv_src269760656.ts"
Apr 16 02:05:35.857 DEBG starting new connection: https://sea.locastnet.org/
Apr 16 02:05:35.979 DEBG response '200 OK' for https://sea.locastnet.org/proxy/sea/variant/6DexfeD3J1BrBkTdpyaE5aHi9FtSR2AV7Pd7USfkPNpz1qWbDgk65aiRfcNdQ75VPKzIzUFyBLXGRzElNTeiwpntV42IsEpXisN2deDgA3Kq.m3u8
Apr 16 02:05:35.980 INFO Stream 5567d7b - added segment "https://sea.locastnet.org/proxy/sea/kffv_src269760665.ts"
Apr 16 02:05:35.980 INFO Serving https://sea.locastnet.org/proxy/sea/kffv_src269760657.ts (6 s) in 5.6416016s
Apr 16 02:05:36.488 INFO <ip>:56748 "GET /discover.json HTTP/1.1" 200 298 "-" "PlexMediaServer/1.22.2.4282-a97b03fad" 0.000062
Apr 16 02:05:36.490 INFO <ip>:56748 "GET /lineup_status.json HTTP/1.1" 200 73 "-" "PlexMediaServer/1.22.2.4282-a97b03fad" 0.000024
Apr 16 02:05:37.942 INFO <ip>:56748 "GET /discover.json HTTP/1.1" 200 298 "-" "PlexMediaServer/1.22.2.4282-a97b03fad" 0.000045
Apr 16 02:05:37.943 INFO <ip>:56748 "GET /lineup_status.json HTTP/1.1" 200 73 "-" "PlexMediaServer/1.22.2.4282-a97b03fad" 0.000021
Apr 16 02:05:41.625 DEBG starting new connection: https://sea.locastnet.org/
Apr 16 02:05:41.746 DEBG response '200 OK' for https://sea.locastnet.org/proxy/sea/kffv_src269760657.ts
Apr 16 02:05:41.871 INFO Stream 5567d7b - playing: segment "https://sea.locastnet.org/proxy/sea/kffv_src269760657.ts"
Apr 16 02:05:41.872 INFO <ip>:56753 "GET /watch/1572389495741 HTTP/1.1" 200 3209510620 "-" "Lavf/58.27.104" 14625.993735

Apr 16 02:10:11.834 INFO Login token expired: Mutex { is_locked: true, has_waiters: false }
Apr 16 02:10:11.834 INFO Logging in with <account>
Apr 16 02:10:11.834 DEBG starting new connection: https://api.locastnet.org/
Apr 16 02:10:12.386 DEBG response '200 OK' for https://api.locastnet.org/api/user/login
Apr 16 02:10:12.386 INFO Login succeeded!
Apr 16 02:10:12.386 DEBG starting new connection: https://api.locastnet.org/
Apr 16 02:10:12.969 DEBG response '200 OK' for https://api.locastnet.org/api/watch/epg/819?startTime=2021-04-16T00:00:00-00:00&hours=192
Apr 16 02:10:13.797 INFO Loading stations for Seattle (cache: true, cache timeout: 3600, days: 8)..

Apr 16 03:10:13.877 INFO Login token expired: Mutex { is_locked: true, has_waiters: false }
Apr 16 03:10:13.877 INFO Logging in with <account>
Apr 16 03:10:13.877 DEBG starting new connection: https://api.locastnet.org/
Apr 16 03:10:14.451 DEBG response '200 OK' for https://api.locastnet.org/api/user/login
Apr 16 03:10:14.451 INFO Login succeeded!
...
wouterdebie commented 3 years ago

Perfect! The login is different from fetching a new m3u file every 2:45h. Locast provides a login token after login that is used for subsequent requests to their API and locast2tuner refreshes this token every hour.

In the log you posted, did you stream for hours on end?

jg-24 commented 3 years ago

I did not set recordings to occur overnight since the "are you still watching" message was determined to be the cause.

I separated the log by hour (its continuous, I just added new lines), and the "are you still watching" message would have occurred just after 2AM like the previous logs when the application exited.

It's good to see the new behavior didn't cause the application to continue streaming the channel after the "are you still watching message", I was a little worried about that. I've made similar oauth token refresh routines to retain connectivity.

Thanks.

- Jeff

rtm2017 commented 3 years ago

Can confirm the please validate email stream is now shown in plex instead of crashing locast2tuner. Awesome work!