Skip to content

Commit

Permalink
First release
Browse files Browse the repository at this point in the history
  • Loading branch information
KoblerS committed Dec 28, 2024
1 parent b5098b6 commit 1e4fcce
Show file tree
Hide file tree
Showing 25 changed files with 1,008 additions and 56 deletions.
Binary file added .github/Example_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/Example_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/Example_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/Example_4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/Example_5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/Example_6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/Example_7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions .github/workflows/branch-push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Branch push
on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
permissions:
# Required to request the OIDC JWT Token
id-token: write
# Required when GH token is used to authenticate with private repo
contents: write

steps:
- uses: actions/checkout@v4

- name: Draft release
uses: KoblerS/release-drafter@v1
with:
version-prefix: ''
29 changes: 29 additions & 0 deletions .github/workflows/release-published.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Release published
on:
release:
types:
- released

jobs:
build:
runs-on: ubuntu-latest
permissions:
# Required to request the OIDC JWT Token
id-token: write
# Required when GH token is used to authenticate with private repo
contents: write

steps:
- uses: actions/checkout@v4

- name: Update version in package.json
run: |
jq ".version = \"${{ github.event.release.tag_name}}\"" package.json > tmp.json && mv tmp.json package.json
- name: Commit changes
run: |
git config --global user.name 'github-actions'
git config --global user.email '[email protected]'
git add package.json
git commit -m "Update version to ${{ github.event.release.tag_name}}"
git push
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# https://git-scm.com/docs/gitignore
# https://help.github.com/articles/ignoring-files
# Example .gitignore files: https://github.com/github/gitignore
/bower_components/
/node_modules/
66 changes: 66 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
module.exports = function(grunt) {
require("time-grunt")(grunt);
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
eslint: {
options: {
configFile: ".eslintrc.json"
},
target: ["*.js"]
},
stylelint: {
simple: {
options: {
configFile: ".stylelintrc"
},
src: ["*.css"]
}
},
jsonlint: {
main: {
src: ["package.json", "translations/*.json"],
options: {
reporter: "jshint"
}
}
},
markdownlint: {
all: {
options: {
config: {
"default": true,
"line-length": false,
"blanks-around-headers": false,
"no-duplicate-header": false,
"no-inline-html": false,
"MD010": false,
"MD001": false,
"MD031": false,
"MD040": false,
"MD002": false,
"MD029": false,
"MD041": false,
"MD032": false,
"MD036": false,
"MD037": false,
"MD009": false,
"MD018": false,
"MD012": false,
"MD026": false,
"MD038": false
}
},
src: ["README.md", "CHANGELOG.md", "LICENSE.txt"]
}
},
yamllint: {
all: [".travis.yml"]
}
});
grunt.loadNpmTasks("grunt-eslint");
grunt.loadNpmTasks("grunt-stylelint");
grunt.loadNpmTasks("grunt-jsonlint");
grunt.loadNpmTasks("grunt-yamllint");
grunt.loadNpmTasks("grunt-markdownlint");
grunt.registerTask("default", ["eslint", "stylelint", "jsonlint", "markdownlint", "yamllint"]);
};
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Simon Kobler

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
125 changes: 69 additions & 56 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,63 @@ MagicMirror² Module to monitor public transport (U-Bahn, Tram, Bus, S-Bahn) in
> [!CAUTION]
> This magic mirror module is an independent project and is not affiliated with, endorsed by, or associated with MVG (Münchner Verkehrsgesellschaft mbH), the Munich public transportation company. Any use of data or information related to MVG services is for personal, non-commercial purposes and should comply with their terms of use.
## Example
## Installation
1. Clone the module into your MagicMirror module folder and execute `npm install` in the module's directory.
```bash
cd ~/MagicMirror/modules
git clone https://github.com/KoblerS/MMM-MVG
cd MMM-MVG
npm install
```

## Configuration

To display the module insert it in the config.js file.

### Simple configuration
```javascript
{
module: "MMM-MVG",
position: "bottom_left",
header: "MVG",
config: {
station: "Hauptbahnhof",
maxEntries: 10, // 10 items on screen
updateInterval: 60000, // 60 s
showIcons: true, // Show transport type icon
transportTypesToShow: {
"ubahn": true, // show ubahn route
"sbahn": true, // show sbahn route
"bus": true, // show bus route
"regional_bus": true, // show regional bus route
"tram": true // show tram route
},
ignoreStations: [], // lines with destination to which should not be shown
lineFiltering: {
"active": true, // set this to active if filtering should be used
"filterType": "whitelist", // whitelist = only specified lines will be displayed, blacklist = all lines except specified lines will be displayed
"lineNumbers": ["U1", "U3", "X50"] // lines that should be on the white-/blacklist
},
timeToWalk: 10, // 10 min walking time to station. Default is 0
showWalkingTime: false, // if the walking time should be included and the starting time is displayed
showTrainDepartureTime: true, // show tran departure time
trainDepartureTimeFormat: "relative", // format of the train departure time
walkingTimeFormat: "relative", // format of the walking time
showInterruptions: true, // show interruptions as gray-out rows
showInterruptionsDetails: false, // show details of interruptions in next line
countInterruptionsAsItemShown: false, // count interruptions details lines as a line shown
}
}
```

## Examples

| | |
| --- | --- |
| **Stations names with arrival time** | ![](.github/Example_1.png) |
```
```javascript
config: {
haltestelle: "Hauptbahnhof",
station: "Hauptbahnhof",
maxEntries: 10, // 10 items on screen
updateInterval: 60000, // 60 s
showIcons: false, // Show transport type icon
Expand All @@ -31,13 +80,13 @@ config: {
walkingTimeFormat: "relative", // format of the walking time
}
```

| | |
| --- | --- |
| **Stations names with icons and arrival time** | ![](.github/Example_3.png) |

```
```javascript
config: {
haltestelle: "Karlsplatz",
station: "Karlsplatz",
maxEntries: 15, // 10 items on screen
updateInterval: 60000, // 60 s
showIcons: true, // Show transport type icon
Expand All @@ -56,12 +105,13 @@ config: {
walkingTimeFormat: "relative" // format of the walking time
}
```

| | |
| --- | --- |
| **Stations names with icons, arrival time and walking time** | ![](.github/Example_4.png) |
```
```javascript
config: {
haltestelle: "Karlsplatz",
station: "Karlsplatz",
maxEntries: 15, // 10 items on screen
updateInterval: 60000, // 60 s
showIcons: true, // Show transport type icon
Expand All @@ -84,9 +134,9 @@ config: {
| | |
| --- | --- |
| **Stations names with icons, arrival time and disruption marking** | ![](.github/Example_5.png) |
```
```javascript
config: {
haltestelle: "Harras",
station: "Harras",
maxEntries: 10, // 10 items on screen
updateInterval: 60000, // 60 s
showIcons: true, // Show transport type icon
Expand All @@ -106,14 +156,15 @@ config: {
showInterruptions: true,
showInterruptionsDetails: false,
countInterruptionsAsItemShown: false
}
```

| | |
| --- | --- |
| **Stations names with icons, arrival time, disruption marking and disruptions details** (disruption details are not counted as new lines)| ![](.github/Example_6.png) |
```
```javascript
config: {
haltestelle: "Harras",
station: "Harras",
maxEntries: 10, // 10 items on screen
updateInterval: 60000, // 60 s
showIcons: true, // Show transport type icon
Expand All @@ -133,14 +184,15 @@ config: {
showInterruptions: true,
showInterruptionsDetails: true,
countInterruptionsAsItemShown: false
}
```

| | |
| --- | --- |
| **Stations names with icons, arrival time, disruption marking and disruptions details** (disruption details are counted as new lines) | ![](.github/Example_7.png) |
```
```javascript
config: {
haltestelle: "Harras",
station: "Harras",
maxEntries: 10, // 10 items on screen
updateInterval: 60000, // 60 s
showIcons: true, // Show transport type icon
Expand All @@ -160,56 +212,17 @@ config: {
showInterruptions: true,
showInterruptionsDetails: true,
countInterruptionsAsItemShown: true
}
```

## Dependencies
* instance of [MagicMirror²](https://github.com/MichMich/MagicMirror)
* urlencode (linux: npm install urlencode)

## Installation
1. Clone this repository in your MagicMirror installation into the folder modules.
2. Rename plugin foler from 'MMM-mvg' to 'mvg'
3. Install dependencies in main MagicMirror folder
4. Add configuration block to your config.js:
```
{
module: "mvg",
position: "bottom_left",
header: "MVG",
config: {
haltestelle: "Hauptbahnhof",
maxEntries: 10, // 10 items on screen
updateInterval: 60000, // 60 s
showIcons: true, // Show transport type icon
transportTypesToShow: {
"ubahn": true, // show ubahn route
"sbahn": true, // show sbahn route
"bus": true, // show bus route
"regional_bus": true, // show regional bus route
"tram": true // show tram route
},
ignoreStations: [], // lines with destination to which should not be shown
lineFiltering: {
"active": true, // set this to active if filtering should be used
"filterType": "whitelist", // whitelist = only specified lines will be displayed, blacklist = all lines except specified lines will be displayed
"lineNumbers": ["U1", "U3", "X50"] // lines that should be on the white-/blacklist
},
timeToWalk: 10, // 10 min walking time to station. Default is 0
showWalkingTime: false, // if the walking time should be included and the starting time is displayed
showTrainDepartureTime: true, // show tran departure time
trainDepartureTimeFormat: "relative", // format of the train departure time
walkingTimeFormat: "relative", // format of the walking time
showInterruptions: true, // show interruptions as gray-out rows
showInterruptionsDetails: false, // show details of interruptions in next line
countInterruptionsAsItemShown: false, // count interruptions details lines as a line shown
}
},
```
* Nothing else, module is small and simple! 🙌

## Config Options
| **Option** | **Description** |
| --- | --- |
| `haltestelle` | Station for which you want to display data. <br> **Default:** `Hauptbahnhof` <br> **Source:** http://www.mvg-live.de/MvgLive/MvgLive.jsp |
| `station` | Station for which you want to display data. <br> **Default:** `Hauptbahnhof` <br> **Source:** https://www.mvg.de/meinhalt.html |
| `maxEntries` | Number of items shown in table. <br> **Default:** `8` |
| `updateInterval` | Update interval <br> **Default:** `60000` |
| `ubahn` | Show data for U-Bahn. <br> **Possible values:** `true` or `false` <br> **Default:** `true` |
Expand Down
Loading

0 comments on commit 1e4fcce

Please sign in to comment.