-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
899 additions
and
2,085 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
const mediaCard = require("../cards/MediaCard"); | ||
const cType = require("../cards/CardType"); | ||
const util = require('util'); | ||
const axios = require("axios"); | ||
const { CardTypeEnum } = require("../cards/CardType"); | ||
|
||
/** | ||
* @desc Used to get a list of custom pictures | ||
*/ | ||
class Links { | ||
constructor() { } | ||
|
||
/** | ||
* @desc Custom link slide array | ||
*/ | ||
async GetAllLinks(linksArray) { | ||
let allLinkCards = []; | ||
// get link cards | ||
for (const linkURL of linksArray) { | ||
const linkSet = await this.GetLinkCard(linkURL); | ||
if(linkSet.length !== 0) { | ||
allLinkCards = allLinkCards.concat(linkSet); | ||
} | ||
} | ||
|
||
let now = new Date(); | ||
if (allLinkCards.length == 0) { | ||
console.log( | ||
now.toLocaleString() + " No links found"); | ||
} else { | ||
console.log( | ||
now.toLocaleString() + " Links added"); | ||
} | ||
return allLinkCards; | ||
} | ||
|
||
|
||
/** | ||
* @desc Custom link card | ||
*/ | ||
async GetLinkCard(url) { | ||
let linkCards = []; | ||
// reutrn an empty array if no results | ||
if (url !== null) { | ||
// move through results and populate media cards | ||
const medCard = new mediaCard(); | ||
medCard.cardType = cType.CardTypeEnum.WebURL; | ||
medCard.mediaType = "WebURL"; | ||
medCard.linkUrl = url; | ||
medCard.posterAR = 0; | ||
medCard.theme = ""; | ||
medCard.posterURL = ""; | ||
medCard.posterArtURL = ""; | ||
//console.log(medCard); | ||
linkCards.push(medCard); | ||
} | ||
|
||
let now = new Date(); | ||
//console.log(linkCards); | ||
return linkCards; | ||
} | ||
} | ||
|
||
module.exports = Links; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.