Read the statement by Michael Teeuw here.
8kb "compliments module" works. 204kb "compliments module" fails to display. how to fix?
-
ok so the original size of the /modules/compliments/compliments.js is 8kb.
im trying to display portions of a book. having trouble. the file is now 204kb
everything except the book loads on the npm start command.
how can i create 4 seprate files to call? basically i want to try and break the compliments modules 4 sections of the day into 4 files i can call that way the module will boot up… the total size of the files will be maybe 40kb each which last i checked worked i think. so maybe if i lower the amount of stuff in the actual module and just call upon separate files from the module things will work out well?how can i do this?
-
@steed You can outsource all data you want to show into one .json file and use day times as sections. It’s described in the readme of the module.
E.g. I created a .json with random citations just including them all into one file in the anytime section{ "anytime" : [ ] }
-
i have been trying my best but i cant seem to link the file.
heres what i got.
compliments.js >
odule.register(“compliments”, {// Module config defaults. defaults: { compliments: { anytime: [ "Don't forget to laugh often, and smile always!" ], morning: [ "Good morning!", "Enjoy your day!", "Rise and shine, the early bird gets the worm!", "You are loved!", "Each and every day brings it's own blessings!" ], afternoon: [ "All work and no play? Must be the middle of the day!", "Live, Laugh, Love!", "Mirror, Mirror on the wall...", "Looking good today!" ], evening: [ "Another day is coming to a close!", "Dinner time!", "Bed time is the best time of the day!" ] }, updateInterval: 30000, remoteFile: "~/home/pi/MagicMirror/modules/default/compliments/remote_compliments.json", fadeSpeed: 4000, morningStartTime: 3, morningEndTime: 12, afternoonStartTime: 12, afternoonEndTime: 17 },
‘’‘’‘’
the program is just ignoring the .json file and doing the regular compliments.
i have the book broken into 4 sections anytime morning afternnon and evening.when i delete the default compliments up there ^^^^ it says undefined. even without comments in the compliments.js the remote_compliments still isnt being called.
i spend a lot of time putting 1590 lines of a book into quotations and stuff so i dont want to give up.
-
@steed - You should not be modifying the
compliments.js
file. Any compliments you wish to insert into the module should be specified in theconfig.js
file. In your case, you want to modify theconfig.js
file to point to your large compliments JSON file.Roughly:
{ module: "compliments", position: "lower_third", config: { remoteFile:'/home/pi/bookCompliments.json' } }
-
@steed Although I think your way should have worked out if not for a small error (below), @bhepler 's advice is much better, because otherwise you will have a problem as soon as you want to update the mirror software.
The module’s own .js files themselves are part of the git workflow, if you change them locally and are not common to using git, you’ll be in a fine mess later on and will not know what to do.
Therefore, it’s ideal to use the config.js or custom.css for changes because they will be ignored by the git workflow.However in your approach you have only one small mistake
remoteFile: "~/home/pi/MagicMirror/modules/default/compliments/remote_compliments.json",
should read
remoteFile: "/home/pi/MagicMirror/modules/default/compliments/remote_compliments.json",
The “~” leads to your home/pi directory therefore it was redundant and the system was looking for /home/pi/home/pi/…
OR just use this
remoteFile: "remote_compliments.json",
-
@lavolp3 thanks! got it working
-
Glad to hear it!