Skip to content

Commit cf987fd

Browse files
authored
Merge branch 'master' into development
2 parents d1158ac + 5e90b89 commit cf987fd

4 files changed

Lines changed: 57 additions & 7 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Set config to '...'
16+
2. Run or send notification '...'
17+
3. See error '...'
18+
19+
**Expected behavior**
20+
A clear and concise description of what you expected to happen.
21+
22+
**Screenshots**
23+
If applicable, add screenshots to help explain your problem.
24+
25+
**System (please complete the following information):**
26+
- OS: [e.g. Raspberry Pi OS]
27+
28+
**Additional context**
29+
Add any other context about the problem here.

MMM-StyledSlideshow.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Module.register("MMM-StyledSlideshow", {
44
imageFolder: "example_images",
55
scrollInterval: 30000,
66
width: 20,
7-
height: 20
7+
height: 20,
88
},
99

1010
start() {
@@ -38,8 +38,9 @@ Module.register("MMM-StyledSlideshow", {
3838
getDom() {
3939
const wrapper = document.createElement("div");
4040
const image = document.createElement("img");
41-
image.style.width = this.width + "%"
42-
image.style.height = this.height + "%"
41+
image.style.width = this.width + "%";
42+
image.style.height = this.height + "%";
43+
image.style.objectFit = "cover";
4344
image.src = this.file(this.imagePath);
4445
image.alt = this.imagePath + " error loading";
4546
wrapper.appendChild(image);
@@ -53,6 +54,11 @@ getDom() {
5354
console.log("[MMM-StyledSlideshow] - Changing Image")
5455
},
5556

57+
refresh() {
58+
this.sendSocketNotification("GET_PATHS", this.imageFolder)
59+
this.updateDom(10000)
60+
},
61+
5662
/**
5763
* This is the place to receive notifications from other modules or the system.
5864
*

README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
# MMM-StyledSlideshow
22

3+
*MMM-StyledSlideshow* is a module for [MagicMirror²](https://github.com/MagicMirrorOrg/MagicMirror) that displays a slideshow of images at a regular interval.
4+
# MMM-StyledSlideshow
5+
36
*MMM-StyledSlideshow* is a module for [MagicMirror²](https://github.com/MagicMirrorOrg/MagicMirror) that displays a slideshow of images at a regular interval.
47

58
## Screenshot
69

10+
![Example of MMM-StyledSlideshow](./example_1.png)
711
![Example of MMM-StyledSlideshow](./example_1.png)
812

913
## Installation
@@ -15,6 +19,7 @@ In your terminal, go to the modules directory and clone the repository:
1519
```bash
1620
cd ~/MagicMirror/modules
1721
git clone https://github.com/Lbork45/MMM-StyledSlideshow.git
22+
git clone https://github.com/Lbork45/MMM-StyledSlideshow.git
1823
```
1924

2025
### Update
@@ -38,13 +43,17 @@ Minimal configuration to use the module:
3843
{
3944
module: 'MMM-StyledSlideshow',
4045
position: 'middle_center'
46+
module: 'MMM-StyledSlideshow',
47+
position: 'middle_center'
4148
},
4249
```
4350

4451
Configuration with all options:
4552

4653
```js
4754
{
55+
module: 'MMM-StyledSlideshow',
56+
position: 'middle_center',
4857
module: 'MMM-StyledSlideshow',
4958
position: 'middle_center',
5059
config: {
@@ -62,14 +71,18 @@ Option|Possible values|Default|Description
6271
------|------|------|-----------
6372
`imageFolder`|`string`|`example_images`|The folder to draw images from. MUST be a subfolder of MMM-StyledSlideshow.
6473
`scrollInterval`|`integer`|`30000`|The rotation interval, in milliseconds
65-
`width`|`integer`|`20`|The width of the image, in % of screen width
66-
`height`|`integer`|`20`|The height of the image, in % of screen height
74+
`refreshInterval`|`integer`|`360000`|The interval on which the program reloads all pictures from the folder
75+
`width`|`integer`|`20`|The width of all pictures, in % of screen width
76+
`height`|`integer`|`20`|The height of all pictures, in % of screen height
77+
78+
> As of now, the refreshInterval is a placeholder because of a bug I haven't figured out yet. If anyone wants to try, please fork the repo and once fixed, I will merge it.
6779
6880
## Sending notifications to the module
6981

7082
Notification|Description
7183
------|-----------
7284
CHANGE_IMAGE|Change the current image
85+
CHANGE_IMAGE|Change the current image
7386

7487
## License
7588

node_helper.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@ module.exports = NodeHelper.create({
2525
this.currentIndex = (this.currentIndex + 1) % this.imagePaths.length;
2626
}
2727
else if (notification == "GET_PATHS"){
28-
this.cycleFiles(payload);
28+
this.getFiles(payload);
2929
}
3030
},
31-
cycleFiles: function(folderPath){
31+
32+
getFiles: function(folderPath){
33+
this.imagePaths = []
3234
const modulePath = path.join(__dirname, folderPath);
3335
fs.readdir(modulePath, (err, files) => {
3436
if (err) return console.error(err);

0 commit comments

Comments
 (0)