Read the statement by Michael Teeuw here.
Need more compliments? compliments.json
-
@ryck
I am struggling with this… why am I dense?- IF I use
remoteFile="https://gist.githubusercontent.com/ryck/..."
(ie just pointing at YOUR file online), THEN things work. (but this is what I did not like in the first post of mine)
- IF I copy your compliments.json into ~/MagicMirror/modules/default/compliments/compliments.json
like I read your response, and use
remoteFile="compliments.json"
THEN all I get are the “original” compliments.
- IF I replace (ouch!) the original compliments.js (your response could be read to imply that) with your compliments.json and use
remoteFile="compliments.json"
THEN I get no compliments at all (but at least no warnings either: that’s impressive).
Right now, if I want to add my own compliments, all I can do use approach (1), but place your compliments.json into my own git, edit and point to that. Which seems awkward…
Any help would be appreciated.
-
@amanzimdwini the FILE, remote or local must be
{ "name":[" list of strings for name" ], "name2": [ ] }
test that it is a valid JSON file using one of the online validators
and name can be one of morning, afternoon, evening and anytime.
and a cron time value
-
@sdetweil
HERE is my config:{ module: "compliments", position: "lower_third", config: { remoteFile: "https://gist.githubusercontent.com/ryck/e28a69665b8839f6e9a7acd6b4acc97d/raw/be1dee8f805a433f6ee0fa3556d1927da14e7799/compliments.json", // remoteFile: "compliments.json", // remoteFile: "~/MagicMirror/modules/default/compliments/compliments.json", }, },
All I do is un-comment the remoteFile lines one at a time to test -
and the lower two remoteFiles (that are commented out) DO NOT WORK even though the compliments.json file is the one I copied from Git…I only want one (local) file; I’m not sure what I am doing wrong.
Thanks,
Karl -
@amanzimdwini when I do
the second one, “compliments.json”
(without a file)I see error in console
http://0.0.0.0:8090/modules/default/compliments/compliments.json 404 (Not Found)
if the file is empty I see
VM143:1 Uncaught SyntaxError: Unexpected end of JSON input at JSON.parse (<anonymous>) at compliments.js:44 at XMLHttpRequest.xobj.onreadystatechange (compliments.js:131)
if I have a syntax error in the file contents I see
VM298:3 Uncaught SyntaxError: Unexpected string in JSON at position 42 at JSON.parse (<anonymous>) at compliments.js:44 at XMLHttpRequest.xobj.onreadystatechange (compliments.js:131)
if the file contains this content (changed from default text to insure it works)
{ "anytime": ["Hey there sexy!"], "morning": ["Good morning, handsome!", "Enjoy your day!", "How was your sleep?"], "afternoon": ["Hello, you beauty!", "You look sexy!", "Looking good today!"], "evening": ["Wow, you look hot!", "You look nice!", "Hi, sexy!"], "....-01-01": ["Happy new year!"] }
I see displayed
Hello, you beauty!
-
@sdetweil
YUP - YOUR file works.
And NOW the copied on from Git to my local directory works too…Oh well, I guess my MM just needed to know some master was watching it!
Thanks for all the help,
Karl -
This post is deleted!