Closed elgeorgie closed 10 months ago
Thank you for your input. Note that the Amazon Photos URL you have is to access the pictures in an Amazon Photos fashion, meaning with picture previews etc. In the background Amazon Photos uses Amazon Drive. Therefore you can change your URL to https://amazon.com/clouddrive/share/xxxxx
and should see the Amazon Drive page for the files you shared.
As for the configuration, the imageUrls
is an array of strings:
{
module: 'mmm-amazon-photos',
// position is important
position: 'fullscreen_below',
config: {
imageUrls: [ "https://amazon.com/clouddrive/share/xxxxx" ],
backgroundSize: 'contain',
slideshowSpeed: 30000, //milliseconds
// see below for configurable options
},
},
Hope that helps and let me know if we can close this issue.
No sure what I'm doing wrong but pasting the unique key to the clouddrive url is not working. Also, for some reason on my Amazon Drive I don't see the shared album link I create on amazon photos. I'll continue to troubleshoot that, and report back if I crack it. Thanks!
When you share photos or full albums on Amazon you can always use the URL and try to open it in a new tab. You can then try to change "photos" in the URL to "clouddrive" and see if you can still open a website successfully
I fought with this for a few hours. Finally saw some comments here that helped.
If you choose to use the amazon photos website - upload photos - create albums, that's ok, just don't use the share links there. Once you have your photos and albums set -> go to the amazon cloud drive link that keeps getting referred to. My location ended up being pictures directory -> Web directory -> photos are all listed here. I went back to Web directory and clicked the square to the left to highlight the Web directory. Then click the share button that pops up top. Using this link solved my issues, so if you don't see amazon.com/clouddrive/...... then it might not work for you. I tried everywhere to change url to use the photos but it just won't show no matter what I change in the code.
{ module: 'mmm-amazon-photos', // position is important position: 'fullscreen_below', config: { imageUrls: [ "https://www.amazon.com/clouddrive/share/....Your.Share.ID.Goes.Here...." ], backgroundSize: 'contain', slideshowSpeed: 8000, //milliseconds // see below for configurable options }, },
Sorry to hear that the setup was troublesome but thank you for sharing your experience and glad you were able to solve it
I fought with this for a few hours. Finally saw some comments here that helped.
If you choose to use the amazon photos website - upload photos - create albums, that's ok, just don't use the share links there. Once you have your photos and albums set -> go to the amazon cloud drive link that keeps getting referred to. My location ended up being pictures directory -> Web directory -> photos are all listed here. I went back to Web directory and clicked the square to the left to highlight the Web directory. Then click the share button that pops up top. Using this link solved my issues, so if you don't see amazon.com/clouddrive/...... then it might not work for you. I tried everywhere to change url to use the photos but it just won't show no matter what I change in the code.
{ module: 'mmm-amazon-photos', // position is important position: 'fullscreen_below', config: { imageUrls: [ "https://www.amazon.com/clouddrive/share/....Your.Share.ID.Goes.Here...." ], backgroundSize: 'contain', slideshowSpeed: 8000, //milliseconds // see below for configurable options }, },
That's defintely a workaround. However, the photos used in the shared album I want to use on the MM come from various devices, so not all original photos are on the same clouddrive folder. It would be nice if the shared album created on Amazon photos is visible on clouddrive or if Amazon releases an API to link directly to amazon photos. Thanks!
After setting mine up, I am seeing the following in electron and not seeing any pictures being display on my MM (oddly enough, it flashes when I click in the MM window, whether remote via a browser, or on the console itself on my RPI 4)
[04.05.2022 13:48.51.819] [INFO] No previously cached file found Error: ENOENT: no such file or directory, stat '/home/jberk1984/MagicMirror/modules/mmm-amazon-photos/images/photo.jpg'
at statSync (node:fs:1536:3)
at Object.e.statSync (node:electron/js2c/asar_bundle:5:4527)
at Class.socketNotificationReceived (/home/jberk1984/MagicMirror/modules/mmm-amazon-photos/node_helper.js:127:26)
at Socket.<anonymous> (/home/jberk1984/MagicMirror/js/node_helper.js:109:11)
at Socket.emit (node:events:390:28)
at Socket.emitUntyped (/home/jberk1984/MagicMirror/node_modules/socket.io/dist/typed-events.js:69:22)
at /home/jberk1984/MagicMirror/node_modules/socket.io/dist/socket.js:466:39
at processTicksAndRejections (node:internal/process/task_queues:78:11) {
errno: -2,
syscall: 'stat',
code: 'ENOENT',
path: '/home/jberk1984/MagicMirror/modules/mmm-amazon-photos/images/photo.jpg'
}
followed by this a little bit later on
[04.05.2022 14:30.17.996] [LOG] Error: Request failed with status code 404
at createError (/home/jberk1984/MagicMirror/node_modules/axios/lib/core/createError.js:16:15)
at settle (/home/jberk1984/MagicMirror/node_modules/axios/lib/core/settle.js:17:12)
at Unzip.handleStreamEnd (/home/jberk1984/MagicMirror/node_modules/axios/lib/adapters/http.js:322:11)
at Unzip.emit (node:events:390:28)
at endReadableNT (node:internal/streams/readable:1343:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
config: {
transitional: {
silentJSONParsing: true,
forcedJSONParsing: true,
clarifyTimeoutError: false
},
adapter: [Function: httpAdapter],
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
timeout: 0,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
maxBodyLength: -1,
validateStatus: [Function: validateStatus],
headers: {
Accept: 'application/json, text/plain, */*',
'User-Agent': 'axios/0.26.1'
},
method: 'get',
url: 'https://www.amazon.com/drive/v1/shares/SHARE_ID/folder/FOLDER_ID?shareId=SHARE_ID/folder/FOLDER_ID&resourceVersion=V2&ContentType=JSON',
data: undefined
},
request: <ref *1> ClientRequest {
_events: [Object: null prototype] {
abort: [Function (anonymous)],
aborted: [Function (anonymous)],
connect: [Function (anonymous)],
error: [Function (anonymous)],
socket: [Function (anonymous)],
timeout: [Function (anonymous)],
prefinish: [Function: requestOnPrefinish]
},
_eventsCount: 7,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
destroyed: true,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
maxRequestsOnConnectionReached: false,
_defaultKeepAlive: true,
useChunkedEncodingByDefault: false,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: 0,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
_closed: true,
socket: TLSSocket {
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
secureConnecting: false,
_SNICallback: null,
servername: 'www.amazon.com',
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object: null prototype],
_eventsCount: 9,
connecting: false,
_hadError: false,
_parent: null,
_host: 'www.amazon.com',
_readableState: [ReadableState],
_maxListeners: undefined,
_writableState: [WritableState],
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: null,
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: [Circular *1],
write: [Function: writeAfterFIN],
[Symbol(res)]: null,
[Symbol(verified)]: true,
[Symbol(pendingSession)]: null,
[Symbol(async_id_symbol)]: 2908,
[Symbol(kHandle)]: null,
[Symbol(kSetNoDelay)]: false,
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kCapture)]: false,
[Symbol(kBytesRead)]: 536,
[Symbol(kBytesWritten)]: 335,
[Symbol(connect-options)]: [Object],
[Symbol(RequestTimeout)]: undefined
},
_header: 'GET /drive/v1/shares/SHARE_ID/folder/FOLDER_ID?shareId=SHARE_ID/folder/FOLDER_ID&resourceVersion=V2&ContentType=JSON HTTP/1.1\r\n' +
'Accept: application/json, text/plain, */*\r\n' +
'User-Agent: axios/0.26.1\r\n' +
'Host: www.amazon.com\r\n' +
'Connection: close\r\n' +
'\r\n',
_keepAliveTimeout: 0,
_onPendingData: [Function: nop],
agent: Agent {
_events: [Object: null prototype],
_eventsCount: 2,
_maxListeners: undefined,
defaultPort: 443,
protocol: 'https:',
options: [Object: null prototype],
requests: [Object: null prototype] {},
sockets: [Object: null prototype] {},
freeSockets: [Object: null prototype] {},
keepAliveMsecs: 1000,
keepAlive: false,
maxSockets: Infinity,
maxFreeSockets: 256,
scheduling: 'lifo',
maxTotalSockets: Infinity,
totalSocketCount: 0,
maxCachedSessions: 100,
_sessionCache: [Object],
[Symbol(kCapture)]: false
},
I followed the approach listed by @street883 by creating a sharable link at the folder level of an album I wanted to share, in the cloud drive location. No luck....
Please make sure you use the latest version from the master branch. The first error, while not nice, is expected as no cached image exists at the beginning. As for the second error, please try to reproduce it by building and calling the intermittent URLs generated in the module and see if the response matches what the node_modules script expects. Then please share at which step the processing fails and feel free to provide a pull request with a possible solution.
About the flashing bit. It seems that Magic Mirror or the module itself is not very good with being open on two devices at the same time. There's a refresh every second to see if the display is still active, which seemingly tries a reload of the image. This is necessary so the image gets refreshed after the set time, even when the display becomes inactive. Which is important in my case as I use an external tablet to display MM, which goes into hibernate after 15-30 minutes.
Thank you for the response! Note that today was my first time installing the module, so assuming when I did the git clone command it pulled from said master branch (git clone https://github.com/sthuber90/mmm-amazon-photos )?
There seem to be 2 different intermittent URLs listed in Electron when the module is attempting to work...
First intermittent folder I see in Electron
Going to that URL in my browser results in the following
If I try to go to the next URL shown in Electron by prepending https://www.amazon.com/clouddrive to it, it takes me to the root of my cloud drive, and not the URL of the actual folder I shared and what is in my config.js
What would you like for me to check exactly in the nodes_modules script?
If this is the URL for the folder I am sharing, should I use that in my config.js?
Which results in the below:
at statSync (node:fs:1536:3)
at Object.e.statSync (node:electron/js2c/asar_bundle:5:4527)
at Class.socketNotificationReceived (/home/jberk1984/MagicMirror/modules/mmm-amazon-photos/node_helper.js:127:26)
at Socket.<anonymous> (/home/jberk1984/MagicMirror/js/node_helper.js:109:11)
at Socket.emit (node:events:390:28)
at Socket.emitUntyped (/home/jberk1984/MagicMirror/node_modules/socket.io/dist/typed-events.js:69:22)
at /home/jberk1984/MagicMirror/node_modules/socket.io/dist/socket.js:466:39
at processTicksAndRejections (node:internal/process/task_queues:78:11) {
errno: -2,
syscall: 'stat',
code: 'ENOENT',
path: '/home/jberk1984/MagicMirror/modules/mmm-amazon-photos/images/photo.jpg'
}
[04.05.2022 15:58.54.359] [INFO] Notification: GET_PIHOLE Payload: [object Object]
[04.05.2022 15:58.55.773] [INFO] Calendar-Fetcher: Broadcasting 4 events.
[04.05.2022 15:58.55.961] [INFO] Newsfeed-Fetcher: Broadcasting 10 items.
[04.05.2022 15:58.56.020] [INFO] Newsfeed-Fetcher: Broadcasting 20 items.
[04.05.2022 15:58.56.166] [INFO] Newsfeed-Fetcher: Broadcasting 50 items.
[04.05.2022 15:58.56.300] [INFO] Calendar-Fetcher: Broadcasting 0 events.
[04.05.2022 15:58.56.368] [INFO] Newsfeed-Fetcher: Broadcasting 10 items.
[04.05.2022 15:58.59.510] [LOG] Get photo from Wedding Photos
[04.05.2022 15:58.59.599] [INFO] Newsfeed-Fetcher: Broadcasting 20 items.
[04.05.2022 15:58.59.890] [ERROR] Whoops! There was an uncaught exception...
[04.05.2022 15:58.59.892] [ERROR] [Error: EACCES: permission denied, open '/home/jberk1984/MagicMirror/modules/mmm-amazon-photos/images/photo.jpg'] {
errno: -13,
code: 'EACCES',
syscall: 'open',
path: '/home/jberk1984/MagicMirror/modules/mmm-amazon-photos/images/photo.jpg'
}
[04.05.2022 15:58.59.893] [ERROR] MagicMirror² will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
[04.05.2022 15:58.59.894] [ERROR] If you think this really is an issue, please open an issue on GitHub: https://gi
thub.com/MichMich/MagicMirror/issues
What's up w with permission denied error?
or navigate in the folder to grab the fuller URL for my config.js?
Which results in the longer set of messages I sent above, with the intermittent URLs
Then you use the latest version 👍
From the URL you use, you should use the one that contains the images and not a folder containing images. Recursive image lookup is currently not supported AFAIK. Please try with creating a public URL for your "Wedding Photos > Wedding Photos" folder. There should not be a folder
in the URL path parameter.
URL structure:
{your localized Amazon URL}/clouddrive/share/{share ID}
For the URLs to try out, have a look into: https://github.com/sthuber90/mmm-amazon-photos/blob/main/node_helper.js#L43-L71
|--- `${baseUrl}/drive/v1/shares/${shareId}?shareId=${shareId}&resourceVersion=V2&ContentType=JSON`
|--- `${baseUrl}/drive/v1/nodes/${res.data.nodeInfo.id}/children?asset=ALL&limit=1&searchOnFamily=false&tempLink=true&shareId=${shareId}&offset=0&resourceVersion=V2&ContentType=JSON`
|--- `${baseUrl}/drive/v1/nodes/${intermediateRes.data.data[0].id}/children?asset=ALL&limit=1&searchOnFamily=false&sort=%5B%27contentProperties.contentDate+ASC%27%5D&tempLink=true&shareId=${shareId}&resourceVersion=V2&ContentType=JSON`
|--- (depending on response kind) `${baseUrl}/drive/v1/nodes/${res.data.nodeInfo.id}/children?asset=ALL&limit=1&searchOnFamily=false&sort=%5B%27contentProperties.contentDate+ASC%27%5D&tempLink=true&shareId=${shareId}&resourceVersion=V2&ContentType=JSON`
=> amazonPhotosData.data[0].tempLink (image download URL)
At which stage do you receive your "UnknownOperationException"?
For your "EACCES" error, I am certain this is unrelated to the module itself, rather than to the permissions your MM runs with and the way you run it.
So, trying the first format you listed from the node_helper.js with my share ID, in my local browser, shows a status code of 200
https://www.amazon.com/drive/v1/shares/{shareID}?shareId={shareID}&resourceVersion=V2&ContentType=JSON
Which looks promising and I don't see any errors in Electron other than the ones mentioned before (cache and perms denied), but no image displays in the MM
(Note: I created a new MM-Photos folder with just 1 picture in it for this testing and created a shareable link in Amazon Drive)
I will keep playing around but I have tried so many different combinations of the shareable URL now, my head is starting to spin : )
Not sure how others were able to get it working so easily.
As an update, I created a new shared folder in Amazon drive and updated the config.js accordingly. I used 2 URLs to cover my bases (one is the exact link I copied from Amazon Drive, and another uses the ${baseUrl}/drive/v1/shares/${shareId}?shareId=${shareId}&resourceVersion=V2&ContentType=JSON
separated by a ,
I modified the perms of /home/jberk1984/MagicMirror/modules/mmm-amazon-photos/images folder and no longer see the permissions denied error in Electron when running MM, just the no previously cached file found error now, but still, no image is being displayed:
I have seen the vsync parameters error before, but in this case, seems to be related to the news feed module and not the amazon photos module
Glad you resolved the permissions denied error. Do you receive any other errors know that indicate that the picture is not loading?
Did you go through the entire chain of URLs and saw a jpg picture in the end in your browser or downloaded one?
If there are no errors in the logs, does that mean you have a photo.jpg in your folder?
I'm sorry for the inconveniences and the difficulties in the setup. My personal setup is on an older device for which I need to transpile the code into an earlier JS version and I haven't gotten through to do add it to this project.
I am trying to work through them but was not sure of some of the items...
What goes in {res.data.nodeInfo.id}
, {intermediateRes.data.data[0].id}
in the below and where does that info come from?
|--- `${baseUrl}/drive/v1/shares/${shareId}?shareId=${shareId}&resourceVersion=V2&ContentType=JSON`
|--- `${baseUrl}/drive/v1/nodes/${res.data.nodeInfo.id}/children?asset=ALL&limit=1&searchOnFamily=false&tempLink=true&shareId=${shareId}&offset=0&resourceVersion=V2&ContentType=JSON`
|--- `${baseUrl}/drive/v1/nodes/${intermediateRes.data.data[0].id}/children?asset=ALL&limit=1&searchOnFamily=false&sort=%5B%27contentProperties.contentDate+ASC%27%5D&tempLink=true&shareId=${shareId}&resourceVersion=V2&ContentType=JSON`
|--- (depending on response kind) `${baseUrl}/drive/v1/nodes/${res.data.nodeInfo.id}/children?asset=ALL&limit=1&searchOnFamily=false&sort=%5B%27contentProperties.contentDate+ASC%27%5D&tempLink=true&shareId=${shareId}&resourceVersion=V2&ContentType=JSON`
=> amazonPhotosData.data[0].tempLink (image download URL)
There are no other errors in the logs and a photo.jpg is never makes it to my /home/jberk1984/MagicMirror/modules/mmm-amazon-photos/images folder.
Are you on Discord by chance? If you are willing, maybe that would make troubleshooting easier.
@sthuber90 I got this module working this morning. It was a permissions with my mmm-amazon-photos directory. A chmod
fixed it :) Appreciate all your responses
Providing a template/example of the configuration would be helpful. I tried pasting the URL but not sure if I'm using the right format. Below is how I used it in my config file, but no photos are loading.