Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for AmuseLabs, modify LATimes and WaPo to use AmuseLabs #184

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,8 @@ dependencies {
implementation 'com.github.franmontiel:PersistentCookieJar:v1.0.1'
implementation 'com.google.firebase:firebase-crashlytics:17.1.0'
implementation 'com.google.firebase:firebase-analytics:17.4.3'

compile 'cz.jirutka.unidecode:unidecode:1.0.1'
compile 'commons-codec:commons-codec:1.15'
}

2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
package="com.totsp.crossword.shortyz"
android:installLocation="auto"
android:versionCode="40404"
android:versionName="4.4.3">
android:versionName="4.4.4">

<supports-screens
android:anyDensity="true"
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/assets/release.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@
<a href="https://plus.google.com/b/112662859624418565027" target="_blank"><img src="gplus-32.png" style="border: none; display:inline;" /></a>
</div>

<h2>Shortyz 4.4.4</h2>
<p>
New release with AmuseLabs source support added for long broken LATimes puzzle downloads. Removed Sunday LAimes option as daily and Sunday puzzles come from the same source now.
<p>
Also changed Washington Post to use AmuseLabs downloader.
<p>
Added "The Atlantic" as a daily source also from AmuseLabs.

<h2>Shortyz 4.4.3</h2>

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.totsp.crossword.net;

import java.io.File;
import java.text.NumberFormat;
import java.util.Date;
import java.util.HashMap;

public class AtlanticAmuseLabsDownloader extends AbstractAmuseLabsDownloader {

protected static String al_atlantic_picker_url = "https://cdn3.amuselabs.com/atlantic/date-picker?set=atlantic";
protected static String al_atlantic_base_url = "https://cdn3.amuselabs.com/atlantic/crossword?&set=atlantic";
private static final String NAME = "The Atlantic";
private final HashMap<String, String> headers = new HashMap<String, String>();
NumberFormat nf = NumberFormat.getInstance();

public AtlanticAmuseLabsDownloader() {
super(al_atlantic_base_url, DOWNLOAD_DIR, NAME, al_atlantic_picker_url);
nf.setMinimumIntegerDigits(2);
nf.setMaximumFractionDigits(0);
nf.setGroupingUsed(false);
}

public int[] getDownloadDates() {
return DATE_DAILY;
}

public String getName() {
return NAME;
}

public File download(Date date) {
return download(date, this.createUrlSuffix(date), headers);
}

@Override
protected String createUrlSuffix(Date date) {
String val = "atlantic_";
return val + nf.format((1900+date.getYear()))
+ nf.format(date.getMonth() + 1) + nf.format(date.getDate());
}

}
19 changes: 14 additions & 5 deletions app/src/main/java/com/totsp/crossword/net/Downloaders.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@ public Downloaders(SharedPreferences prefs,
downloaders.add(new WSJSaturdayDownloader());
}

// Old WaPo downloader does not work
if (prefs.getBoolean("downloadWaPoPuzzler", true)) {
downloaders.add(new WaPoPuzzlerDownloader());
// downloaders.add(new WaPoPuzzlerDownloader());
downloaders.add(new WaPoAmuseLabsDownloader());
}

// if (prefs.getBoolean("downloadNYTClassic", true)) {
Expand All @@ -90,9 +92,15 @@ public Downloaders(SharedPreferences prefs,

if (prefs.getBoolean("downloadLat", true)) {
// downloaders.add(new UclickDownloader("tmcal", "Los Angeles Times", "Rich Norris", Downloader.DATE_NO_SUNDAY));
downloaders.add(new LATimesDownloader());
// downloaders.add(new LATimesDownloader());
downloaders.add(new LATimesAmuseLabsDownloader());
}

if (prefs.getBoolean("downloadAtlantic", true)) {
downloaders.add(new AtlanticAmuseLabsDownloader());
}


// if (prefs.getBoolean("downloadAvClub", true)) {
// downloaders.add(new AVClubDownloader());
// }
Expand Down Expand Up @@ -136,9 +144,10 @@ public Downloaders(SharedPreferences prefs,
"uclick LLC", Downloader.DATE_DAILY));
}

if (prefs.getBoolean("downloadLACal", true)) {
downloaders.add(new LATSundayDownloader());
}
//Sunday LATimes loaded same as other days now
//if (prefs.getBoolean("downloadLACal", true)) {
// downloaders.add(new LATSundayDownloader());
//}

// if (prefs.getBoolean("downloadISwear", true)) {
// downloaders.add(new ISwearDownloader());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.totsp.crossword.net;

import java.io.File;
import java.text.NumberFormat;
import java.util.Date;
import java.util.HashMap;

public class LATimesAmuseLabsDownloader extends AbstractAmuseLabsDownloader {

protected static String al_lat_picker_url = "https://cdn4.amuselabs.com/lat/date-picker?set=latimes";
protected static String al_lat_base_url = "https://cdn4.amuselabs.com/lat/crossword?&set=latimes";
private static final String NAME = "Los Angeles Times";
private final HashMap<String, String> headers = new HashMap<String, String>();
NumberFormat nf = NumberFormat.getInstance();

public LATimesAmuseLabsDownloader() {
super(al_lat_base_url, DOWNLOAD_DIR, NAME, al_lat_picker_url);
nf.setMinimumIntegerDigits(2);
nf.setMaximumFractionDigits(0);
}

public int[] getDownloadDates() {
return LATimesDownloader.DATE_DAILY;

}

public String getName() {
return NAME;
}

public File download(Date date) {
return download(date, this.createUrlSuffix(date), headers);
}

@Override
protected String createUrlSuffix(Date date) {
String val = "tca";
return val + nf.format((date.getYear() - 100))
+ nf.format(date.getMonth() + 1) + nf.format(date.getDate());
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.totsp.crossword.net;

import java.io.File;
import java.text.NumberFormat;
import java.util.Date;
import java.util.HashMap;

public class WaPoAmuseLabsDownloader extends AbstractAmuseLabsDownloader {

protected static String al_wapo_picker_url = "https://cdn1.amuselabs.com/wapo/wp-picker?set=wapo-eb";
protected static String al_wapo_base_url = "https://cdn1.amuselabs.com/wapo/crossword?set=wapo-eb";

private static final String NAME = "Washington Post";
private final HashMap<String, String> headers = new HashMap<String, String>();
NumberFormat nf = NumberFormat.getInstance();

public WaPoAmuseLabsDownloader() {
super(al_wapo_base_url, DOWNLOAD_DIR, NAME, al_wapo_picker_url);
nf.setMinimumIntegerDigits(2);
nf.setMaximumFractionDigits(0);
}

public int[] getDownloadDates() {
return DATE_DAILY;

}

public String getName() {
return NAME;
}

public File download(Date date) {
return download(date, this.createUrlSuffix(date), headers);
}

@Override
protected String createUrlSuffix(Date date) {
String val = "ebirnholz_";
return val + nf.format((date.getYear() - 100))
+ nf.format(date.getMonth() + 1) + nf.format(date.getDate());
}

}
14 changes: 9 additions & 5 deletions app/src/main/res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@
android:defaultValue="true"
android:summary="Updates Monday-Saturday"
android:key="downloadUSAToday" />
<androidx.preference.CheckBoxPreference
android:title="The Atlantic"
android:defaultValue="false"
android:key="downloadAtlantic" />
</androidx.preference.PreferenceScreen>
<androidx.preference.PreferenceScreen
android:title="Weekly Crosswords"
Expand Down Expand Up @@ -123,11 +127,11 @@
android:defaultValue="true"
android:summary="Updates Fridays (Currently Biweekly)"
android:key="downloadCHE" />
<androidx.preference.CheckBoxPreference
android:title="LAT Sunday Calendar"
android:defaultValue="true"
android:summary="Updates Sundays"
android:key="downloadLACal" />
<!--<androidx.preference.CheckBoxPreference-->
<!--android:title="LAT Sunday Calendar"-->
<!--android:defaultValue="true"-->
<!--android:summary="Updates Sundays"-->
<!--android:key="downloadLACal" /> -->
<!--<androidx.preference.CheckBoxPreference-->
<!--android:title="Philadelphia Inquirer"-->
<!--android:defaultValue="true"-->
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ allprojects {
url 'https://oss.sonatype.org/content/groups/public'
}
maven {
url "http://dl.bintray.com/jenzz/maven"
url "https://maven.fabric.io/public"
}
}
gradle.projectsEvaluated {
Expand Down