Spotify logo on Spotify cards
This commit is contained in:
BIN
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
@@ -49,6 +49,8 @@ public class CardCreator {
|
|||||||
private static final SpotifyApi spotifyApi = new SpotifyApi.Builder().setClientId(clientId)
|
private static final SpotifyApi spotifyApi = new SpotifyApi.Builder().setClientId(clientId)
|
||||||
.setClientSecret(clientSecret).build();
|
.setClientSecret(clientSecret).build();
|
||||||
private static final ClientCredentialsRequest clientCredentialsRequest = spotifyApi.clientCredentials().build();
|
private static final ClientCredentialsRequest clientCredentialsRequest = spotifyApi.clientCredentials().build();
|
||||||
|
|
||||||
|
private Image spotifyLogo;
|
||||||
|
|
||||||
public CardCreator(List<String> links) {
|
public CardCreator(List<String> links) {
|
||||||
List<Card> cards;
|
List<Card> cards;
|
||||||
@@ -64,6 +66,9 @@ public class CardCreator {
|
|||||||
File file = new File(DEST);
|
File file = new File(DEST);
|
||||||
file.getParentFile().mkdirs();
|
file.getParentFile().mkdirs();
|
||||||
|
|
||||||
|
spotifyLogo = new Image(ImageDataFactory.create("resources/Spotify_Icon_RGB_Green.png"));
|
||||||
|
spotifyLogo.setHeight(6 * mmUnit);
|
||||||
|
|
||||||
createFoldingPdf(DEST, sortCards(cards));
|
createFoldingPdf(DEST, sortCards(cards));
|
||||||
|
|
||||||
} catch (IOException | SpotifyWebApiException e) {
|
} catch (IOException | SpotifyWebApiException e) {
|
||||||
@@ -217,6 +222,16 @@ public class CardCreator {
|
|||||||
|
|
||||||
Paragraph p = new Paragraph();
|
Paragraph p = new Paragraph();
|
||||||
p.setTextAlignment(TextAlignment.CENTER);
|
p.setTextAlignment(TextAlignment.CENTER);
|
||||||
|
|
||||||
|
if (card.link.startsWith("spotify:")) {
|
||||||
|
Paragraph logoBox = new Paragraph();
|
||||||
|
logoBox.setTextAlignment(TextAlignment.CENTER);
|
||||||
|
logoBox.add(spotifyLogo);
|
||||||
|
logoBox.setMargin(3 * mmUnit);
|
||||||
|
logoBox.setPaddingBottom(-12 * mmUnit);
|
||||||
|
cell.add(logoBox);
|
||||||
|
}
|
||||||
|
|
||||||
Image qrcode = new Image(card.qrcode.createFormXObject(pdfDoc));
|
Image qrcode = new Image(card.qrcode.createFormXObject(pdfDoc));
|
||||||
qrcode.setWidth(22 * mmUnit); // Cannot set margin to 0 on QR codes and they grow with the length of the content. This is an approximation.
|
qrcode.setWidth(22 * mmUnit); // Cannot set margin to 0 on QR codes and they grow with the length of the content. This is an approximation.
|
||||||
p.setPaddingTop(22 * mmUnit - qrcode.getWidth().getValue() / 2); // mid point of QR code is 22 mm from top border
|
p.setPaddingTop(22 * mmUnit - qrcode.getWidth().getValue() / 2); // mid point of QR code is 22 mm from top border
|
||||||
@@ -273,6 +288,16 @@ public class CardCreator {
|
|||||||
|
|
||||||
Paragraph p = new Paragraph();
|
Paragraph p = new Paragraph();
|
||||||
p.setTextAlignment(TextAlignment.CENTER);
|
p.setTextAlignment(TextAlignment.CENTER);
|
||||||
|
|
||||||
|
if (card.link.startsWith("spotify:")) {
|
||||||
|
Paragraph logoBox = new Paragraph();
|
||||||
|
logoBox.setTextAlignment(TextAlignment.CENTER);
|
||||||
|
logoBox.add(spotifyLogo);
|
||||||
|
logoBox.setMargin(3 * mmUnit);
|
||||||
|
logoBox.setPaddingBottom(-12 * mmUnit);
|
||||||
|
cell.add(logoBox);
|
||||||
|
}
|
||||||
|
|
||||||
Image qrcode = new Image(card.qrcode.createFormXObject(pdfDoc));
|
Image qrcode = new Image(card.qrcode.createFormXObject(pdfDoc));
|
||||||
qrcode.setWidth(22 * mmUnit); // Cannot set margin to 0 on QR codes and they grow with the length of the content. This is an approximation.
|
qrcode.setWidth(22 * mmUnit); // Cannot set margin to 0 on QR codes and they grow with the length of the content. This is an approximation.
|
||||||
p.setPaddingTop(22 * mmUnit - qrcode.getWidth().getValue() / 2); // mid point of QR code is 22 mm from top border
|
p.setPaddingTop(22 * mmUnit - qrcode.getWidth().getValue() / 2); // mid point of QR code is 22 mm from top border
|
||||||
@@ -323,83 +348,7 @@ public class CardCreator {
|
|||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
|
|
||||||
List<String> links = Arrays.asList(
|
List<String> links = Arrays.asList(
|
||||||
// Josefine
|
/* "https://ih1.redbubble.net/image.859117621.1102/ra,unisex_tshirt,x2200,101010:01c5ca27c6,front-c,267,146,1000,1000-bg,f8f8f8.u6.jpg|German: ÄäÖöÜüß, Russian: ЯБГДЖЙ, Polish: ŁĄŻĘĆŃŚŹ, Japanese: Kanji: てすと (te-su-to), Hankaku: アイウエオカキクケコサシスセソタチツテ",
|
||||||
// "/INTERNAL/Astrid Lindgren - Die Kinder aus der Krachmacherstraße",
|
|
||||||
// "/INTERNAL/Astrid Lindgren - Lotta zieht um",
|
|
||||||
// "/INTERNAL/Astrid Lindgren - Michel bringt die Welt in Ordnung",
|
|
||||||
// "/INTERNAL/Astrid Lindgren - Wir Kinder aus Büllerbü",
|
|
||||||
// "/INTERNAL/Der Grüffelo und Das Grüffelokind",
|
|
||||||
// "/INTERNAL/Der Räuber Hotzenplotz/CD 1",
|
|
||||||
// "/INTERNAL/Der Räuber Hotzenplotz/CD 2",
|
|
||||||
// "/INTERNAL/Janosch - Das Beste von Tiger & Bär",
|
|
||||||
// "/INTERNAL/Sing mit mir Kinderlieder/Sing mit mir Kinderlieder",
|
|
||||||
// "/INTERNAL/Sing mit mir Kinderlieder/Sing mit mir Kinderlieder 2",
|
|
||||||
// "/INTERNAL/Sonst noch was",
|
|
||||||
|
|
||||||
// "spotify:album:6QpCsN1do9sWdzxMzP6vAm",
|
|
||||||
// "spotify:album:0zDRwoqvJYhvfhcvQYzfcZ",
|
|
||||||
// "spotify:album:5qvokPibHLO3e47oV4wyhz",
|
|
||||||
// "spotify:album:4ErYqkUdfkAmsgltEPJKH7",
|
|
||||||
// "spotify:album:2ZQKn9GVeJalLEuh3BvuOB",
|
|
||||||
// "spotify:album:66YZOif5ogyl1O0rFT28HM",
|
|
||||||
// "spotify:album:2UNXd8SieHWtTM5g0VMeGv",
|
|
||||||
// "spotify:album:3ixBUKtl7HtxSZECC3YnNb",
|
|
||||||
// "spotify:album:6NkPN8kGJftA5ZURbZTKve",
|
|
||||||
// "spotify:album:7o6y1qwFIJolo0ZKUpPTR9",
|
|
||||||
// "spotify:album:1bK1QqLOaESZgs2pXYY4J6",
|
|
||||||
// "spotify:album:5Dlq8pYslsD1dstLQR7NFw",
|
|
||||||
// "spotify:album:5nCCuIqR5MsRi3tI90Vu4T",
|
|
||||||
// "spotify:album:2xo9X40JoJuDO64Iy5mpNY",
|
|
||||||
// "spotify:album:7A5GQZrirxYgjWCTGpbnbs",
|
|
||||||
// "spotify:album:4ghoOGAttLAGG5LHZ2TyJI",
|
|
||||||
// "spotify:album:1ateqhraMBgvZdaYeMuIok",
|
|
||||||
// "spotify:album:5bt9jrIAYM5pCxX41xBuq2",
|
|
||||||
// "spotify:album:4IzmCaIX0eEgRb7xsQFkfv",
|
|
||||||
// "spotify:album:7iQo6EXjMtLPorNrw2vlXW",
|
|
||||||
// "spotify:album:6K5a3qRU976BpPIEG9mZnb",
|
|
||||||
// "spotify:album:4ix6YihDNef0CrY6yqAZAp",
|
|
||||||
// "spotify:album:6Jv639ZVhVhh3BNVPkBbTx",
|
|
||||||
// "spotify:album:76ZUfDiykUU2cf6CHoQ1f0",
|
|
||||||
// "spotify:album:53dBXzbp9pMtV3CDIQHg42",
|
|
||||||
// "spotify:album:17r2Acz7jO4CK7HH8vPB2k",
|
|
||||||
// "spotify:album:4NHm49J138o8iOADgQfLwk",
|
|
||||||
// "spotify:album:4fAxKCklCcMxl7LAxBeGDD",
|
|
||||||
// "spotify:album:2qffSlb9FcXLjuAmVmxusg",
|
|
||||||
// "spotify:playlist:0Edvyr1N6rCXdlaXJXFTRm",
|
|
||||||
// "spotify:playlist:1MHhoAAkJtenHSc2auRjik",
|
|
||||||
// "spotify:playlist:6F2ndy14LlaUhCoMNUCmS0",
|
|
||||||
// "spotify:album:6xEB4R8xiXssXH8dSYoQAS",
|
|
||||||
// "spotify:album:1pmyleYQz8MWZszsFvr7xj",
|
|
||||||
// "spotify:album:3dhTDo27zieo3NKG9yWDOm",
|
|
||||||
// "spotify:album:7fj4TDf4T2thg5BuFUluNY",
|
|
||||||
// "spotify:album:0gBwfz0Li2PAs6RtcC34Sf",
|
|
||||||
// "spotify:album:3TNwLmVlMD5FH9lfreRTop",
|
|
||||||
// "spotify:album:6VuNMt3hjDKuO0JPu1U8KC",
|
|
||||||
// "spotify:album:1MawyFXVs44JGcgDm7sNRF",
|
|
||||||
// "spotify:album:6dUE7mRlGLJriQtHxM7LZN",
|
|
||||||
// "spotify:album:1Wstoinsm4CGJ4ybpWg8iH",
|
|
||||||
// "spotify:album:721jCM2jOWLTF90qAXsm4j",
|
|
||||||
// "spotify:album:7Auu9enkXXr2Cb7LM3ZZBg",
|
|
||||||
// "spotify:album:57nolXNzaxSbmcQ25xUado",
|
|
||||||
// "spotify:album:7MmGDWg8mBqZmxgQfAFaGx",
|
|
||||||
// "spotify:album:2U3tr7tB5kvIobxriuwY4K",
|
|
||||||
// "spotify:album:21Vw0oLYsqJVGlibJ08mRE",
|
|
||||||
// "spotify:album:3o1p0dVvbb4BIKAfP8xVVL",
|
|
||||||
// "spotify:album:1Xx4o41IUa37w2nB0tOReT",
|
|
||||||
// "spotify:album:3HIGYfO3lJLnRXFz4RnIrw",
|
|
||||||
// "spotify:album:0AfOsu9wcvDu8Cn57xynoh",
|
|
||||||
// "spotify:album:2BmQu8dBAJHd8i1P8suRm4",
|
|
||||||
// "spotify:album:24edFfeEP7oy8BWGatc5CQ",
|
|
||||||
// "spotify:album:66Rt4KLkF7jhSPMLi223Zv",
|
|
||||||
// "spotify:album:2upvzA60OLbOW9M0QKQ0hO",
|
|
||||||
// "spotify:album:00XbTSVi9wVH1jYiYr2Vc9",
|
|
||||||
// "spotify:album:6ZsR4Vx24b1E1PkiGSUQSE",
|
|
||||||
// "spotify:album:7wGBvXA1TKtlqyJq6Mtsl5",
|
|
||||||
// "spotify:album:6AdTIgvKhY5knelEsDWJx8",
|
|
||||||
// ENDE Josefine
|
|
||||||
|
|
||||||
|
|
||||||
"https://ih1.redbubble.net/image.859117621.1102/ra,unisex_tshirt,x2200,101010:01c5ca27c6,front-c,267,146,1000,1000-bg,f8f8f8.u6.jpg|German: ÄäÖöÜüß, Russian: ЯБГДЖЙ, Polish: ŁĄŻĘĆŃŚŹ, Japanese: Kanji: てすと (te-su-to), Hankaku: アイウエオカキクケコサシスセソタチツテ",
|
|
||||||
"https://upload.wikimedia.org/wikipedia/commons/thumb/4/4b/Radio_Teddy_Logo.svg/1200px-Radio_Teddy_Logo.svg.png|Radio Teddy|http://streamtdy.ir-media-tec.com/live/mp3-128/web/play.mp3",
|
"https://upload.wikimedia.org/wikipedia/commons/thumb/4/4b/Radio_Teddy_Logo.svg/1200px-Radio_Teddy_Logo.svg.png|Radio Teddy|http://streamtdy.ir-media-tec.com/live/mp3-128/web/play.mp3",
|
||||||
"NAS/share/Astrid Lindgren - Die Kinder aus der Krachmacherstraße",
|
"NAS/share/Astrid Lindgren - Die Kinder aus der Krachmacherstraße",
|
||||||
"NAS/share/Astrid Lindgren - Lotta zieht um",
|
"NAS/share/Astrid Lindgren - Lotta zieht um",
|
||||||
@@ -570,9 +519,9 @@ public class CardCreator {
|
|||||||
"NAS/share/Drachenreiter - Das Hörspiel",
|
"NAS/share/Drachenreiter - Das Hörspiel",
|
||||||
"NAS/share/Das große Abenteuer Musik",
|
"NAS/share/Das große Abenteuer Musik",
|
||||||
"spotify:album:7tfjSYq5aWFwKlYWRzmPMc", // Das kleine Gespenst
|
"spotify:album:7tfjSYq5aWFwKlYWRzmPMc", // Das kleine Gespenst
|
||||||
"spotify:album:4kGTkO7CP063Bk0j14829K", // Der Räuber Hotzenplotz und die Mondrakete
|
"spotify:album:4kGTkO7CP063Bk0j14829K", // Der Räuber Hotzenplotz und die Mondrakete*/
|
||||||
"spotify:album:4tzPsEeFw4kR42NE4NqJvX", // Immer lustig in Bullerbü
|
"spotify:album:4tzPsEeFw4kR42NE4NqJvX", // Immer lustig in Bullerbü
|
||||||
"spotify:album:1zuWVjkOPIK5OHFnlgDQcf" // Die Häschenschule */
|
"spotify:album:1zuWVjkOPIK5OHFnlgDQcf" // Die Häschenschule
|
||||||
);
|
);
|
||||||
|
|
||||||
new CardCreator(links);
|
new CardCreator(links);
|
||||||
|
|||||||
Reference in New Issue
Block a user