From 6e6738ef9a7db48891006d93fd047dc7d1ecb575 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radim=20Karni=C5=A1?= Date: Thu, 22 Jul 2021 23:47:35 +0200 Subject: [PATCH 1/2] Fix running puppeteer without defined tor ports --- node-idos.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/node-idos.js b/node-idos.js index 7271779..5f6692e 100644 --- a/node-idos.js +++ b/node-idos.js @@ -4,7 +4,7 @@ * * By elrubio https://github.com/soyrubio * MIT Licensed. - * + * * This is a web scraper for the MMM-idos module * The data is scraped from https://idos.idnes.cz/vlakyautobusymhdvse/odjezdy/ */ @@ -44,7 +44,7 @@ function parse_body(body) { } output.sort(getSortOrder("departurewdelay")); - + return output; } @@ -72,7 +72,7 @@ function getDepartureWDelay(dep, delay) { async function scrape(options, callback) { try { - var port_arg; + var port_arg = ''; if (options.ports.length > 0) { const randomPort = options.ports[Math.floor(Math.random() * options.ports.length)]; port_arg = '--proxy-server=socks5://127.0.0.1:' + randomPort; From 0f71db82218fdfeb859bb07b396f92238cb4b29b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radim=20Karni=C5=A1?= Date: Thu, 22 Jul 2021 23:48:27 +0200 Subject: [PATCH 2/2] Fix czech language --- MMM-idos.js | 2 +- README.md | 10 +++++----- translations/{cz.json => cs.json} | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) rename translations/{cz.json => cs.json} (54%) diff --git a/MMM-idos.js b/MMM-idos.js index bab3e5b..1c26b46 100644 --- a/MMM-idos.js +++ b/MMM-idos.js @@ -28,7 +28,7 @@ Module.register('MMM-idos', { return { en: "translations/en.json", sk: "translations/sk.json", - cz: "translations/sk.json", + cs: "translations/cs.json", } }, diff --git a/README.md b/README.md index 59ecc99..6e95b3b 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ real time estimated departures for public transport in the Czech Republic. ## Installation Clone this module into your Magic Mirror modules folder. -1. Go into Magic Mirror's `modules` folder +1. Go into Magic Mirror's `modules` folder 2. Execute `git clone https://github.com/soyrubio/MMM-idos.git`. ## Using the module @@ -23,9 +23,9 @@ var config = { modules: [ { module: 'MMM-idos', - header: 'Praha Masarykovo n.', // no header will be displayed if ommited + header: 'Praha Masarykovo n.', // no header will be displayed if ommited position: 'top_right', // position of the module - + config: { stopId: 'Praha%20Masarykovo%20n.', // "https://idos.idnes.cz/vlakyautobusymhdvse/odjezdy/vysledky/?f=the_stop torPorts: ['9050', '9052'], // tor won't be used if ommited @@ -36,7 +36,7 @@ var config = { } ``` -If Tor ports are selected, the module will randomly choose one to access to the idos.cz website. +If Tor ports are selected, the module will randomly choose one to access to the idos.cz website. If you want to set up Tor for anonymous access, and don't know how to, [you can read this article](https://levelup.gitconnected.com/anonymous-web-scrapping-with-node-js-tor-apify-and-cheerio-3b36ec6a45dc). ## Configuration options @@ -45,7 +45,7 @@ If you want to set up Tor for anonymous access, and don't know how to, [you can |--------------------- |------------ | `stopId` | *Required* Id of the stop (parameter "z" in stop's livetable url).

**Type:** `int`
**Default value:** `none` | `maximumEntries` | *Optional* The maximum entries shown.

**Type:** `int`
**Default value:** `10` -| `refreshInterval` | *Optional* How often to check for the next lines.

**Type:** `int`
**Default value:** `30000` milliseconds (60 seconds) +| `refreshInterval` | *Optional* How often to check for the next lines.

**Type:** `int`
**Default value:** `60000` milliseconds (60 seconds) | `fade` | *Optional* Fade the future lines to black. (Gradient)

**Type:** `boolean`
**Default value:** `true` | `fadePoint` | *Optional* Where to start fade?

**Type:** `float`
**Default value:** `0.25` (start on the 1/4 th of the list) | `blink` | *Optional* Whether departures should blink when departure time is <1 min.

**Type:** `boolean`
**Default value:** `true` diff --git a/translations/cz.json b/translations/cs.json similarity index 54% rename from translations/cz.json rename to translations/cs.json index db98426..a62d60b 100644 --- a/translations/cz.json +++ b/translations/cs.json @@ -1,4 +1,4 @@ { - "IDOS_NO_LINES": "Žádné odchody", + "IDOS_NO_LINES": "Aktuálně žádné spoje", "IDOS_FETCH_ERROR": "Nepodařilo se stáhnout data" }