Skip to content

Commit

Permalink
enable executable jar production, default outdir to tts dir
Browse files Browse the repository at this point in the history
  • Loading branch information
erieflin committed May 14, 2019
1 parent c4bccbb commit f6f07bb
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 8 deletions.
3 changes: 3 additions & 0 deletions src/main/java/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: core.Main

23 changes: 16 additions & 7 deletions src/main/java/core/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,33 @@ public class Main
{
public static void main(String[] args) throws IOException
{
if(args.length != 2)
if(args.length < 2)
{
throw new IOException("Pass your TappedOut Username & Password!");
System.err.println("Usage: java -jar TTSDeckImporter.jar tappedOutUsername tappedOutPassword [deckUrl[deckName]]");
System.exit(1);
}

String user = args[0];
String pass = args[1];


//TODO: Elliots decks
//String someTappedOutUrl = "https://tappedout.net/mtg-decks/gliristofacts/";
String someTappedOutUrl = "https://tappedout.net/mtg-decks/test-card-bin";
//String deckUrl = "https://tappedout.net/mtg-decks/gliristofacts/";
//String deckUrl = "https://tappedout.net/mtg-decks/test-card-bin" ;
String deckUrl = "https://tappedout.net/mtg-decks/gliristofacts-v2-wip/";
//TODO: Chris's decks
//String someTappedOutUrl = "http://tappedout.net/mtg-decks/testing-area/";
//String deckUrl = "http://tappedout.net/mtg-decks/testing-area/";
//"http://tappedout.net/mtg-decks/mayael-the-anima-irl/";

URL url = new URL(someTappedOutUrl);
String deckName = "gliristofacts";
if(args.length==4){
deckUrl = args[3];
deckName = args[4];
}
URL url = new URL(deckUrl);
TappedOutImporter importer = new TappedOutImporter(new Credentials(user, pass), new Scryfall(), url);
EDH deck = new EDH(importer);
deck.setName("cardBinTestDeck");
deck.setName(deckName);

System.out.println("Importing Deck " + deck.getName());
deck.importDeck();
Expand Down
17 changes: 16 additions & 1 deletion src/main/java/importObjects/deck/AbstractDeck.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@
import importObjects.Token;
import importers.deckImporter.AbstractDeckImporter;

import javax.swing.filechooser.FileSystemView;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
Expand All @@ -23,11 +26,23 @@ public abstract class AbstractDeck
private List<Card> cardList;
private List<Token> tokenList;
private URL sleeveImageUrl;
private static final String DECKFOLDER = "DeckOutput";
private static final String DECKFOLDER = getDeckDirPath();
private double imageOutCompressionLevel = .25; // default output image compression config for this deck
private List<String> hostedImageUrls = new ArrayList<String>();
private HashMap<String, List<TTS_Card>> ttsDeckMap = new HashMap<String, List<TTS_Card>>();
private File backImage = getDeckImageFile();
String documents = FileSystemView.getFileSystemView().getDefaultDirectory().getPath();
private static String getDeckDirPath() {
String documents = FileSystemView.getFileSystemView().getDefaultDirectory().getPath();
Path path = Paths.get(documents, "My Games", "Tabletop Simulator", "Saves", "Saved Objects", "decks");
String deckDir = path.toString() + File.separator;
File f = path.toFile();
if (!f.exists()) {
f.mkdirs();

}
return deckDir;
}

private File getDeckImageFile(){
File f = new File(Constants.DEFAULT_SLEEVE_IMAGE_FILE_PATH);
Expand Down

0 comments on commit f6f07bb

Please sign in to comment.