QR-Code encoding ISO-8859-15 for 'ß'
This commit is contained in:
@@ -4,10 +4,12 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import com.itextpdf.barcodes.BarcodeQRCode;
|
||||
import com.itextpdf.barcodes.qrcode.EncodeHintType;
|
||||
import com.itextpdf.io.image.ImageDataFactory;
|
||||
import com.itextpdf.kernel.colors.ColorConstants;
|
||||
import com.itextpdf.kernel.geom.PageSize;
|
||||
@@ -75,12 +77,15 @@ public class CardCreator {
|
||||
|
||||
protected List<Card> fetchCardData(List<String> links) throws SpotifyWebApiException, IOException {
|
||||
List<Card> cards = new LinkedList<Card>();
|
||||
HashMap<EncodeHintType, Object> hints = new HashMap<EncodeHintType, Object>();
|
||||
hints.put(EncodeHintType.CHARACTER_SET, "ISO-8859-15");
|
||||
|
||||
for (String link : links) {
|
||||
System.out.println(link);
|
||||
|
||||
Card card = new Card(link);
|
||||
card.qrcode = new BarcodeQRCode(link);
|
||||
card.qrcode.setHints(hints);
|
||||
cards.add(card);
|
||||
|
||||
if (link.startsWith("spotify:album:")) {
|
||||
@@ -106,8 +111,10 @@ public class CardCreator {
|
||||
}
|
||||
else {
|
||||
// FIXME dirty cover retrieval hack
|
||||
// "share/Kinder/Astrid Lindgren - Lotta zieht um"
|
||||
String path = "/run/user/1000/gvfs/smb-share:server=cubon,share=hidrive/Media/Audio" + link.substring(link.indexOf("/")) + "/cover.jpg";
|
||||
// "/run/user/1000/gvfs/sftp:host=qudio.local,user=volumio/data/INTERNAL"
|
||||
// "/run/user/1000/gvfs/smb-share:server=cubon,share=hidrive/Media/Audio"
|
||||
String path = "/run/user/1000/gvfs/sftp:host=qudio.local,user=volumio/data" + link.substring(link.indexOf("/")) + "/cover.jpg";
|
||||
System.out.println(path);
|
||||
|
||||
File f = new File(path);
|
||||
if (f.exists()) {
|
||||
@@ -186,7 +193,7 @@ public class CardCreator {
|
||||
|
||||
Paragraph p = new Paragraph();
|
||||
p.setTextAlignment(TextAlignment.CENTER);
|
||||
p.setPaddingTop(43.62f);
|
||||
p.setPaddingTop(43.62f); // top padding is 15.387 mm
|
||||
Image qrcode = new Image(card.qrcode.createFormXObject(pdfDoc));
|
||||
qrcode.setWidth(10 / 25.4f * 72);
|
||||
p.add(qrcode);
|
||||
@@ -221,7 +228,7 @@ public class CardCreator {
|
||||
cell.add(p);
|
||||
}
|
||||
|
||||
table.addCell(cell);
|
||||
table.addCell(cell); // cell.setRotationAngle(Math.PI)
|
||||
}
|
||||
|
||||
table.setMinHeight(105 / 25.4f * 72);
|
||||
@@ -265,7 +272,7 @@ public class CardCreator {
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
List<String> links = Arrays.asList(
|
||||
"spotify:album:1X2HXE2lAqdmD8VjiBX8Tn",
|
||||
/* "spotify:album:1X2HXE2lAqdmD8VjiBX8Tn",
|
||||
"spotify:album:5nCA2mAr3rFzk1A6LZXDYm",
|
||||
"spotify:album:1Vc2BZntRGIdv3Ul8AM6cz",
|
||||
"spotify:album:0H3rE11E9DrD3j2gEvQJ5R",
|
||||
@@ -287,7 +294,38 @@ public class CardCreator {
|
||||
"spotify:album:6FGyqglqi0oS3tl4SxyZxf",
|
||||
"spotify:album:3iBX3uryCaJl9xWUeOBOFv",
|
||||
"spotify:album:0FuEZWTzqOJ4hOlUoAJ6wY",
|
||||
"spotify:album:6sTefktQuhIHCWjVYMS6h5"
|
||||
"spotify:album:6sTefktQuhIHCWjVYMS6h5"*/
|
||||
"/INTERNAL/Astrid Lindgren/Die Kinder aus der Krachmacherstraße",
|
||||
"/INTERNAL/Astrid Lindgren/Lotta kann Radfahren",
|
||||
"/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/Elke Heidenreich/Nero Corleone",
|
||||
"/INTERNAL/Elke Heidenreich/Nero Corleone kehrt zurück",
|
||||
"/INTERNAL/Elke Heidenreich/Sonst noch was",
|
||||
"/INTERNAL/Große Oper für kleine Hörer/CD 01 - Die Zauberflöte",
|
||||
"/INTERNAL/Große Oper für kleine Hörer/CD 02 - Der Freischütz",
|
||||
"/INTERNAL/Große Oper für kleine Hörer/CD 03 - Tristan Und Isolde",
|
||||
"/INTERNAL/Große Oper für kleine Hörer/CD 04 - Hänsel und Gretel",
|
||||
"/INTERNAL/Große Oper für kleine Hörer/CD 05 - Die Hochzeit des Figaro",
|
||||
"/INTERNAL/Große Oper für kleine Hörer/CD 06 - Carmen",
|
||||
"/INTERNAL/Große Oper für kleine Hörer/CD 07 - Aida",
|
||||
"/INTERNAL/Große Oper für kleine Hörer/CD 08 - La Bohème",
|
||||
"/INTERNAL/Große Oper für kleine Hörer/CD 09 - Fidelio",
|
||||
"/INTERNAL/Große Oper für kleine Hörer/CD 10 - Der Barbier von Sevilla",
|
||||
"/INTERNAL/Große Oper für kleine Hörer/CD 11 - La Traviata",
|
||||
"/INTERNAL/Große Oper für kleine Hörer/CD 12 - Madame Butterfly",
|
||||
"/INTERNAL/Große Oper für kleine Hörer/CD 13 - Liesel und Franz",
|
||||
"/INTERNAL/Karlchen-Geschichten",
|
||||
"/INTERNAL/Neue Karlchen-Geschichten",
|
||||
"/INTERNAL/Oh wie schön ist Panama (Väter sprechen Janosch - Folge 1 Till Schweiger)",
|
||||
"/INTERNAL/Pettersson kriegt Weihnachtsbesuch",
|
||||
"/INTERNAL/Pettersson und Findus - Eine Geburtstagstorte für die Katze und andere Geschichten",
|
||||
"/INTERNAL/Pettersson und Findus - Pettersson zeltet",
|
||||
"/INTERNAL/Post für den Tiger (Väter sprechen Janosch - Folge 2 Günther Jauch)",
|
||||
"/INTERNAL/Rabe Socke - Alles Gefunden",
|
||||
"/INTERNAL/Rabe Socke - Alles Rabenstark!"
|
||||
);
|
||||
|
||||
new CardCreator(links);
|
||||
|
||||
Reference in New Issue
Block a user