tellytv / telly

An IPTV proxy
MIT License
769 stars 107 forks source link

Every time I upload a edited copy of telly.config.toml the file gets erased and rewritten #288

Open robertjamesm opened 2 years ago

robertjamesm commented 2 years ago

I'm running telly from a Synology docker container

chazlarson commented 2 years ago

Telly doesn't write to its config file, so not sure what might be happening here. If you make that mount read only in the docker setup, does the behavior change?

robertjamesm commented 2 years ago

Negative, it keeps removing the changes I made and goes into this loop.

PANI[2022-05-29T04:56:09Z] fatal error while reading config file: error="While parsing config: (14, 3): never reached"
panic: (*logrus.Entry) (0xc7c2c0,0xc0002ca0e0)

goroutine 1 [running]:
github.com/sirupsen/logrus.Entry.log(0x139b4a0, 0xc000204870, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/go/pkg/mod/github.com/sirupsen/logrus@v1.4.1/entry.go:239 +0x2ce
github.com/sirupsen/logrus.(Entry).Log(0xc0002ca070, 0x0, 0xc00011dc88, 0x1, 0x1)
/go/pkg/mod/github.com/sirupsen/logrus@v1.4.1/entry.go:268 +0xed
github.com/sirupsen/logrus.(
Entry).Logln(0xc0002ca070, 0x0, 0xc00011dde8, 0x1, 0x1)
/go/pkg/mod/github.com/sirupsen/logrus@v1.4.1/entry.go:359 +0xd3
github.com/sirupsen/logrus.(Entry).Panicln(...)
/go/pkg/mod/github.com/sirupsen/logrus@v1.4.1/entry.go:397
main.main()
/app/main.go:139 +0x1235
PANI[2022-05-29T04:56:10Z] fatal error while reading config file: error="While parsing config: (14, 3): never reached"
panic: (
logrus.Entry) (0xc7c2c0,0xc00023afc0)

robertjamesm commented 2 years ago

I'm editing the path /etc/telly/ and it keeps defaulting back to this.

[Discovery]
Device-Auth = "telly123"
Device-ID = 12345678
Device-UUID = ""
Device-Firmware-Name = "hdhomeruntc_atsc"
Device-Firmware-Version = "20150826"
Device-Friendly-Name = "telly"
Device-Manufacturer = "Silicondust"
Device-Model-Number = "HDTC-2US"
SSDP = true

[IPTV]
Streams =
Starting-Channel = 10000
XMLTV-Channels = true

[Log]
Level = "info"
Requests = true

[Web]
Base-Address = ""
Listen-Address = "0.0.0.0:6077"

[[Source]]
Provider = "Custom"
M3U = ""
EPG = ""
Filter = ""
FilterKey = "group-title"
FilterRaw = false
Sort = "group-title"

Documentation at: https://github.com/tellytv/telly/wiki/Running-Telly%3A-Config-File

chazlarson commented 2 years ago

It's creating a file with that documentation link in it?

I have never seen this behavior and cannot reproduce it in a non-synology docker environment. I'm going to use this test script:

#!/bin/bash

docker run -d \
  --name='telly-robertjamesm' \
  --net='bridge' \
  -e TZ="America/Chicago" \
  -p '6077:6077/tcp' \
  -v ${PWD}:/etc/telly \
  --restart unless-stopped \
  tellytv/telly:dev-ffmpeg

docker logs -f telly-robertjamesm

If I have no valid config file in that dir:

 $./docker-robertjamesm.sh
537bde3bacd8c11824153a1ad6ef14d93c4cf3c900e29be2cefe9892188740d5
time="2022-05-31T04:44:14Z" level=info msg="telly is preparing to go live (version=1.1.0.6, branch=dev, revision=741108cd2100cf9f4d3a13f771d1ebe5132baae6)"
time="2022-05-31T04:44:14Z" level=warning msg="There is no source element in the configuration, the config file is likely missing."
time="2022-05-31T04:44:14Z" level=info msg="telly is live and on the air!"
time="2022-05-31T04:44:14Z" level=info msg="Broadcasting from http://localhost:6077/"
time="2022-05-31T04:44:14Z" level=info msg="EPG URL: http://localhost:6077/epg.xml"

That error is as expected and no default config file is created.

If I give it a telly.config.toml with a bad M3U URL:

 $ ./docker-robertjamesm.sh
e2697da91862f156d6a383ea5260354d90f7eb309a5da5926df2d1387db967cc
time="2022-05-31T04:45:37Z" level=info msg="telly is preparing to go live (version=1.1.0.6, branch=dev, revision=741108cd2100cf9f4d3a13f771d1ebe5132baae6)"
time="2022-05-31T04:45:37Z" level=info msg="Loading M3U from http://mag.REDACTED.com/get.php?username=REDACTED&password=REDACTED&type=m3u_plus&output=mpegts"
time="2022-05-31T04:45:38Z" level=error msg="unable to parse m3u file" error="malformed M3U provided"
time="2022-05-31T04:45:38Z" level=error msg="error when preparing provider" error="malformed M3U provided"
time="2022-05-31T04:45:38Z" level=error msg="error when processing provider" error="malformed M3U provided"
time="2022-05-31T04:45:38Z" level=info msg="telly is live and on the air!"
time="2022-05-31T04:45:38Z" level=info msg="Broadcasting from http://0.0.0.0:6077/"
time="2022-05-31T04:45:38Z" level=info msg="EPG URL: http://0.0.0.0:6077/epg.xml"

Another expected error, and the config file is left untouched.

Then with a valid M3U URL:

 $ ./docker-robertjamesm.sh
63d4136db18cf4bd69bf9f133441f805138f6ec1283d66594ee0ea51b56c1329
time="2022-05-31T04:52:59Z" level=info msg="telly is preparing to go live (version=1.1.0.6, branch=dev, revision=741108cd2100cf9f4d3a13f771d1ebe5132baae6)"
time="2022-05-31T04:52:59Z" level=info msg="Loading M3U from URL_REDACTED"
time="2022-05-31T04:53:00Z" level=info msg="Loaded 98 channels into the lineup from robertjamesm"
time="2022-05-31T04:53:00Z" level=info msg="telly is live and on the air!"
time="2022-05-31T04:53:00Z" level=info msg="Broadcasting from http://0.0.0.0:6077/"
time="2022-05-31T04:53:00Z" level=info msg="EPG URL: http://0.0.0.0:6077/epg.xml"

Runs fine as expected, again config is untouched.

Finally, with a random file in place of the M3U:

 $ cp docker.sh telly.config.toml

 $ ./docker-robertjamesm.sh
331a5f7d8ef15c3297fc1ba79909887f15ed427272333a8e0bccda1fbfb4ad2c
time="2022-05-31T04:54:42Z" level=panic msg="fatal error while reading config file:" error="While parsing config: (3, 8): was expecting token =, but got \"run\" instead"
panic: (*logrus.Entry) (0xc7d5e0,0xc0002e60e0)

ERROR_TRACE_REDACTED

I get the expected error since the config file cannot be parsed as YAML.

After that error, the config file is still the random file i copied on top of it

 $ cat telly.config.toml
#!/bin/bash

docker run -d \
  --name='telly-rockydares' \
  --net='bridge' \
  -e TZ="America/Chicago" \
  -p '6077:6077/tcp' \
  -v ${PWD}/telly.config.toml:/etc/telly/telly.config.toml \
  -v ${PWD}:/etc/telly \
  --restart unless-stopped \
  tellytv/telly:dev-ffmpeg

docker logs -f telly-rockydares

I can't get it to overwrite the config file under any circumstances.

EDIT: I went and looked to verify just now, and telly only contains code to READ the config file, not write it. This really seems like it's something in the synology config.