Index: /other-projects/is-sheet-music-encore/trunk/Makefile
===================================================================
--- /other-projects/is-sheet-music-encore/trunk/Makefile	(revision 33046)
+++ /other-projects/is-sheet-music-encore/trunk/Makefile	(revision 33047)
@@ -15,4 +15,13 @@
 	cd java-gen-corpus; java TabRndListGen _test_hathiFullIDList-MU.txt 50 _test_hathiValidIDList-MU-50.txt
 
+gen-100-MU:
+	cd java-gen-corpus; javac *.java
+	cd java-gen-corpus; java javaGenFullIDList hathiFull.txt gen-100-MU-hathiFullIDList-MU.txt MU
+	cd java-gen-corpus; java javaGenValidIDList gen-100-MU-hathiFullIDList-MU.txt 100 gen-100-MU-hathiValidIDList-MU.txt
+	cd java-gen-corpus; rm compact_metadata_temp.xml
+	cd java-gen-corpus; rm metadata_temp.xml
+	./COMPX520-DOWNLOADER-PNG.sh java-gen-corpus/gen-100-MU-hathiValidIDList-MU.txt 6
 
 
+
+
Index: /other-projects/is-sheet-music-encore/trunk/java-gen-corpus/javaGenFullIDList.java
===================================================================
--- /other-projects/is-sheet-music-encore/trunk/java-gen-corpus/javaGenFullIDList.java	(revision 33047)
+++ /other-projects/is-sheet-music-encore/trunk/java-gen-corpus/javaGenFullIDList.java	(revision 33047)
@@ -0,0 +1,70 @@
+//NAME:Caleb Bird
+//ID: 1289680
+//??References??
+
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.io.FileWriter;
+
+//Creates textfile of all records tagged with XX (MU for example)
+//Used on the textfile that contains every record in hathiTrust
+public class javaGenFullIDList {
+    public static void main(String[] args) {
+		try{
+				
+				
+			if (args.length != 3) {
+				System.out.println("Usage: TabProcTextGen <inputFilename> <outputFilename> <inputType>");
+			}
+			else {
+				String inputFilename = args[0];
+				String outputFilename = args[1];
+				String inputType = args[2];
+				    
+
+				System.out.println("Processing: " + inputFilename);
+				
+				FileReader fileReader = new FileReader(inputFilename);
+				BufferedReader buf = new BufferedReader(fileReader);
+				//FileWriter fw = new FileWriter("HathiDocIDList.txt");
+				FileWriter fw = new FileWriter(outputFilename);
+				String line = null;
+				String[] item;
+
+				//Splits into each record, since readLine splits by "\n"
+				int line_num = 0;
+
+				while ((line = buf.readLine()) != null) {
+					line_num++;
+					if (line_num%100000 == 0) {
+					System.out.print(".");
+					System.out.flush();
+					}
+
+					//Splits by tab, leaves "" for every blank entry
+					item = line.split("\t", -1);
+					//Check items to be equal
+					if(	item[1].equals("allow") && 
+					item[2].equals("pd") && 
+					item[19].equals(inputType) && 
+					(item[24].equals("open")||item[24].equals("page"))){
+						//Encode id
+						String idEncoded = item[0];
+						//idEncoded = idEncoded.replaceAll(":", "+").replaceAll("/", "=");
+						//Write item to file
+						fw.write(idEncoded + "\n");
+					}
+				}		
+				buf.close();
+				fw.close();
+			}
+		}catch(Exception e){
+			e.printStackTrace();
+		}
+    }
+}
+
+//REFERNECES 
+//https://www.javatpoint.com/java-filewriter-class
+//https://docs.oracle.com/javase/8/docs/api/index.html?java/io/FileWriter.html
+//Email from supervisor (Compx520 ID Error Apr 24)
Index: /other-projects/is-sheet-music-encore/trunk/java-gen-corpus/javaGenValidIDList.java
===================================================================
--- /other-projects/is-sheet-music-encore/trunk/java-gen-corpus/javaGenValidIDList.java	(revision 33047)
+++ /other-projects/is-sheet-music-encore/trunk/java-gen-corpus/javaGenValidIDList.java	(revision 33047)
@@ -0,0 +1,125 @@
+//NAME:Caleb Bird
+//ID: 1289680
+//??References??
+
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.*;
+import java.util.*;
+
+
+public class javaGenValidIDList {
+    public static void main(String[] args) {
+	try{
+	    if (args.length != 3){
+		System.out.println("Usage: TabRndListGen <inputFilename> <outputCount> <outputFilename>");
+	    }
+	    else{
+		//|||PART1|||
+		String inputFilename = args[0];
+		int outputCount  = Integer.parseInt(args[1]);
+		String outputFilename = args[2];	
+		BufferedReader buf = new BufferedReader(new FileReader(inputFilename));
+		FileWriter fw = new FileWriter(outputFilename);
+		ArrayList<String> list = new ArrayList<String>();
+		String line = null;
+		String[] item;
+
+		//Add items to Array
+		while ((line = buf.readLine()) != null) {			
+		    //Split line by tab
+		    item = line.split("\t", -1);
+		    //Add first element (ID)					
+		    list.add(item[0]);								    
+		}
+		//randomize list
+		Collections.shuffle(list);						
+		
+		//||||PART2||||
+		//Go thru list, check if ID has more than 10 pages,
+		//Keep looping until spesified outputCount has been meet. 
+		
+		int countMatchingCrit = 0;
+		int j = 0;
+		ArrayList<String> subList = new ArrayList<String>();
+	    
+		while(countMatchingCrit < outputCount){
+		    System.out.println("Processing item: " + j);
+			//current ID being processed
+		    String idCurr = list.get(j);
+		    //name of bashscript and the arguement				
+		    String cmd = "./download_metadata_temp.sh " + idCurr;
+		    //run download script		
+		    Process p = Runtime.getRuntime().exec(cmd);				
+
+		    p.waitFor();
+		    int exitStatus = p.exitValue();
+		    //if script execution was successful
+		    if(exitStatus == 0){
+			//Get numpage value for idCurr
+			int numpages = getNumPages(idCurr);
+			//if numpages greater than 10 then add this recorded to sublist
+	       		if(numpages >= 10){
+			    System.out.println("Successful items: " + countMatchingCrit);
+			    countMatchingCrit++;
+			    subList.add(idCurr);						
+			}
+		    }
+		    else{
+			System.err.println("failed to run:" + cmd);
+			System.exit(exitStatus);
+		    }
+		    j++;
+		    if(j >= list.size()){break;}
+		}
+	
+		//Write these to new file
+		for(int i =0; i < subList.size(); i++){
+		    fw.write(subList.get(i) + '\n');
+		}
+			
+		buf.close();
+		fw.close();
+	    }
+	}catch(Exception e){
+	    e.printStackTrace();
+	}
+    }
+    //Isolate numpages value in the downloaded xml file (script downloaded this)
+    private static int getNumPages(String id){
+    	String numpages = null;
+	try{
+	    //Variables
+	    String inputFilename = "metadata_temp.xml";
+	    FileReader fileReader = new FileReader(inputFilename);
+	    BufferedReader buf = new BufferedReader(fileReader);
+	    String line = null;
+	    String[] item;
+
+	    //Splits into each record
+	    while ((line = buf.readLine()) != null) {						
+		if(line.contains("<htd:numpages>")){
+		    //Iscolate and store the page number
+		    numpages = line.substring(line.indexOf(">")+1, line.lastIndexOf("<"));										
+		}											
+	    }
+	    buf.close();	
+	}catch(Exception e){
+	    e.printStackTrace();
+	}
+	return Integer.parseInt(numpages);
+    }
+}
+// Returns 42474
+
+//REFERNECES
+//https://stackoverflow.com/questions/12892665/how-to-capture-the-exit-status-of-a-shell-command-in-java
+//https://www.javatpoint.com/java-filewriter-class
+//https://docs.oracle.com/javase/8/docs/api/index.html?java/io/FileWriter.html
+//https://www.geeksforgeeks.org/randomly-select-items-from-a-list-in-java/
+//https://codereview.stackexchange.com/questions/146551/picking-10-distinct-words-randomly-from-list-of-unique-words
+//http://www.linuxforums.org/forum/programming-scripting/65117-c-c-system-function-analog-java.html
+
+//USE RUN-LIST.txt (modify file it reads using $1 (terminal entry variable (filename))
+
