[LAST_COMMIT]*add links *add BadLinkCheck *rm checkHttpsOnly var link

This commit is contained in:
antonl05 2022-06-05 22:22:56 +05:30
parent dea2204d10
commit 1d73fafb9a
5 changed files with 37 additions and 21 deletions

View file

@ -1,25 +1,28 @@
{
"pnimrp": [
"ANTENNE BAYERN Top 40",
"mp3channels.webradio.antenne.de:80/top-40",
"s6-webradio.antenne.de/top-40/stream",
"Yes! 91.2",
"http://5.9.17.142:8024/;7stream.nsv",
"ChartHits FM",
"95.141.24.3:80",
"5.9.17.142:8024/;7stream.nsv",
"Al Arabiya 99 - العربية",
"stream.radiojar.com/s1mygd1frxquv",
"Dublins KISS",
"uk4.internet-radio.com:15476",
"Dublins KISS FM",
"daniel.torontocast.com:2985/stream",
"Hit Station FM",
"46.163.124.61:8450",
"M Radio Francais -data",
"mfm.ice.infomaniak.ch/mfm-64.aac",
"Radio France Mouv",
"stream.radiofrance.fr/mouv/mouv_hifi.m3u8",
"Megahit Radio",
"87.118.122.45:30710",
"38.96.175.97:5216/;",
"Raute Musik",
"rautemusik-de-hz-fal-stream12.radiohost.de/charthits",

View file

@ -1,7 +1,7 @@
{
"pnimrp": [
"Idobi Howl",
"69.46.88.27:80",
"idobihowl.idobi.com/",
"Metal Only",
"178.77.127.105:4400",

View file

@ -31,7 +31,10 @@
"66.225.205.8:8020",
"ΣΚΑΪ",
"https://skai.live24.gr/skai1003",
"skai.live24.gr/skai1003",
"Radio France FranceInfo",
"stream.radiofrance.fr/franceinfo/franceinfo_hifi.m3u8",
"detour TALK",
"arizona.thedetour.us:8000/;",

View file

@ -2,20 +2,22 @@
pnimrp
======
this is a simple, portable terminal-based radio/music station player.
this is a simple, portable terminal-based radio/music station
player. this project was meant to be a rewrite of pmrp, as a
learning exercise.
this project was meant to be a rewrite of pmrp, as a learning exercise,
but its pretty serious now.
.. warning ::
this project is not maintained anymore, it may be unarchived
and remaintained later in fhe future. it is time to move on.
| see doc/user.rst for a basic level user usage documentation.
| see doc/dev.rst for library-level exaplanations and documentation.
| see doc/installation.rst for installation instructions.
| see doc/model.rst for application model for implementers.
Note
----
All of the out-of-code Documentation is written in RST, so these can be viewed in a
typical text editor or can be used to generate HTML source by running::
All of the out-of-code Documentation is written in RST, so
these can be viewed in a typical text editor or can be used
to generate HTML source by running::
nim rst2html file.rst
then use a web browser to open htmldocs/file.html

View file

@ -205,7 +205,8 @@ proc cleanLink(linke: string): string =
proc httpOrHttps(https: bool): string =
if https: "https://" else: "http://"
proc checkHttpsOnly(link: var string): bool =
proc checkHttpsOnly(linke: string): bool =
var link = linke
try:
var client = newHttpClient()
link = cleanLink link
@ -237,7 +238,9 @@ proc getCurrentSong(linke: string; https = false): string =
){"icestats"}{"source"}[1]{"yp_currently_playing"},
string
)
except HttpRequestError: return "bad"
except: return ""
except: return ""
proc call*(sub:string; sect = ""; stat,linke:string):Natural {.discardable.} =
var link = linke
@ -268,9 +271,14 @@ proc call*(sub:string; sect = ""; stat,linke:string):Natural {.discardable.} =
var currentSong =
if isHttps: getCurrentSong link, https = true
else: getCurrentSong link
if currentSong != "":
sayPos 4, "Now Playing: " & currentSong
else: nowPlayingExcept = true
case currentSong:
of "": nowPlayingExcept = true
of "bad":
warn "Bad Link?"
if not isPaused:
terminateDestroy ctx
break
else: sayPos 4, "Now Playing: " & currentSong
sayPos 4, "Playing"
cursorUp()
echoPlay = false