Skip to content

Commit

Permalink
Fixes #27
Browse files Browse the repository at this point in the history
  • Loading branch information
linanqiu committed Aug 13, 2013
1 parent 9a0f52d commit a3001de
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,5 @@ tmtags
[Bb]in
[Ii]nclude
[Ll]ib
[Ss]cripts
[Ss]cripts
/properties.xml
Binary file modified bin/transcript/TranscriptUploader$AlphanumComparator.class
Binary file not shown.
Binary file not shown.
Binary file modified bin/transcript/TranscriptUploader.class
Binary file not shown.
20 changes: 15 additions & 5 deletions src/transcript/TranscriptUploader.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Properties;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
Expand All @@ -34,14 +35,22 @@ public class TranscriptUploader {
private ArrayList<File> txts;

public static final String CAPTION_FEED_URL_FORMAT = "http://gdata.youtube.com/feeds/api/videos/%s/captions";
public static final String DEVELOPER_KEY = "AI39si5Sfx7cQ-LXq6ERi31r5K19y1x5w94Cnirtp1Vza30kDELcLFCr6LjoYDfplqlpRia19SBYn8ZUffQMXtwGbjuc2ezq0w";
public static final String CLIENT_ID = "ol-youtube";
public static final String CAPTION_FAILURE_TAG = "Caption Upload Failed";
public static final String PLAYLIST_FEED_URL_FORMAT = "http://gdata.youtube.com/feeds/api/users/%s/playlists";

public TranscriptUploader(String username, String password)
throws MalformedURLException, IOException, ServiceException {

Properties properties = new Properties();
try {
properties.loadFromXML(new FileInputStream("properties.xml"));
} catch (FileNotFoundException e) {
System.out.println("No properties file found.");
}

String DEVELOPER_KEY = properties.getProperty("DEVELOPER_KEY");
String CLIENT_ID = properties.getProperty("CLIENT_ID");

transcripts = new ArrayList<String>();
videoIds = new ArrayList<String>();

Expand Down Expand Up @@ -157,15 +166,16 @@ public ArrayList<String> getVideoIds() {
return videoIds;
}

public boolean uploadAll(String contentLanguage) throws MalformedURLException, IOException,
ServiceException {
public boolean uploadAll(String contentLanguage)
throws MalformedURLException, IOException, ServiceException {

boolean allSuccess = false;

if (videoIds.size() == transcripts.size()) {
allSuccess = true;
for (int i = 0; i < videoIds.size(); i++) {
if (!uploadCaption(videoIds.get(i), transcripts.get(i), contentLanguage)) {
if (!uploadCaption(videoIds.get(i), transcripts.get(i),
contentLanguage)) {
allSuccess = false;
}

Expand Down

0 comments on commit a3001de

Please sign in to comment.