Updates for 1.1.3
This commit is contained in:
parent
463e30b561
commit
b9089f8653
9 changed files with 111 additions and 40 deletions
|
@ -506,7 +506,7 @@ public class Audible implements IQueueListener<Book> {
|
|||
public ArrayList<Book> toDownload() {
|
||||
ArrayList<Book> list = new ArrayList<>();
|
||||
for (Book b : getBooks()) {
|
||||
if (!hasAAX(b) && !hasMP3(b))
|
||||
if (!hasAAX(b) && !hasMP3(b) && downloadQueue.canAdd(b))
|
||||
list.add(b);
|
||||
}
|
||||
return list;
|
||||
|
@ -515,7 +515,7 @@ public class Audible implements IQueueListener<Book> {
|
|||
public ArrayList<Book> toConvert() {
|
||||
ArrayList<Book> list = new ArrayList<>();
|
||||
for (Book b : getBooks()) {
|
||||
if (hasAAX(b) && !hasMP3(b))
|
||||
if (hasAAX(b) && !hasMP3(b) && convertQueue.canAdd(b))
|
||||
list.add(b);
|
||||
|
||||
}
|
||||
|
|
|
@ -461,6 +461,7 @@ public class AudibleScraper {
|
|||
int pageNum = 0;
|
||||
HtmlElement next = null;
|
||||
String prev = "";
|
||||
LibraryParser.instance.howToListenFound=false;
|
||||
|
||||
while (true) {
|
||||
progress.throwCanceled();
|
||||
|
@ -526,8 +527,18 @@ public class AudibleScraper {
|
|||
}
|
||||
}
|
||||
|
||||
if (newBooks == 0)
|
||||
if (newBooks == 0) {
|
||||
|
||||
if (LibraryParser.instance.howToListenFound)
|
||||
{
|
||||
LOG.error("Looks like your settings need changing. Using your browser, go to Audible: Account: Settings. Then disable: Check for Audible Download Manager ");
|
||||
throw new AudibleSettingsError();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
next = LibraryParser.instance.getNextPage(page);
|
||||
if (next == null)
|
||||
break;
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
package org.openaudible.audible;
|
||||
|
||||
public class AudibleSettingsError extends Exception {
|
||||
public AudibleSettingsError() {
|
||||
super("Software Verification must be turned off in Audible:Account:Settings");
|
||||
}
|
||||
}
|
|
@ -20,6 +20,7 @@ public enum LibraryParser {
|
|||
private static final Log LOG = LogFactory.getLog(LibraryParser.class);
|
||||
boolean debug = false;
|
||||
|
||||
boolean howToListenFound = false;
|
||||
|
||||
|
||||
// Expected Columns:
|
||||
|
@ -100,10 +101,22 @@ public enum LibraryParser {
|
|||
for (HtmlTableRow r : table.getRows()) {
|
||||
|
||||
rindex++;
|
||||
if (rindex == 1) continue; // skip header row.
|
||||
if (rindex == 1)
|
||||
continue; // skip header row.
|
||||
Book b = parseLibraryRow(r);
|
||||
if (b != null && b.isOK())
|
||||
list.add(b);
|
||||
|
||||
if (b != null)
|
||||
{
|
||||
String chk = b.checkBook();
|
||||
if (chk.isEmpty())
|
||||
{
|
||||
list.add(b);
|
||||
} else
|
||||
{
|
||||
LOG.info("Warning, problem parsing book: "+b+" error: "+chk);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
LOG.info("Library page contains: " + list.size() + " book(s)");
|
||||
|
@ -112,7 +125,7 @@ public enum LibraryParser {
|
|||
}
|
||||
|
||||
|
||||
String debugString = "BK_PENG_003023xxx";
|
||||
String debugString = "OR_ORIG";
|
||||
|
||||
|
||||
private Book parseLibraryRow(HtmlTableRow r) {
|
||||
|
@ -120,7 +133,11 @@ public enum LibraryParser {
|
|||
String xml = Util.cleanString(r.asXml());
|
||||
if (r.getCells().size() == 0)
|
||||
return null; // empty row.
|
||||
|
||||
if (xml.contains("/howtolisten"))
|
||||
{
|
||||
// this is a problem.. settings need to be changed.
|
||||
howToListenFound = true;
|
||||
}
|
||||
|
||||
if (r.getCells().size() != BookColumns.size()) {
|
||||
LOG.error("wrong number of columns found: " + r.getCells().size() + " != " + BookColumns.size());
|
||||
|
@ -136,8 +153,11 @@ public enum LibraryParser {
|
|||
b.setAsin(asin);
|
||||
|
||||
|
||||
int count = Util.substringCount(debugString, xml);
|
||||
LOG.info("Found " + count + " product_id");
|
||||
if (!debugString.isEmpty()) {
|
||||
int count = Util.substringCount(debugString, xml);
|
||||
if (count>0)
|
||||
LOG.info("Found debugString: " + count + " "+debugString);
|
||||
}
|
||||
|
||||
if (debug) HTMLUtil.debugNode(r, "cur_row");
|
||||
List<HtmlElement> cells = r.getElementsByTagName("td");
|
||||
|
|
|
@ -13,9 +13,12 @@ import org.openaudible.desktop.swt.manager.menu.CommandCenter;
|
|||
import org.openaudible.desktop.swt.util.shop.LayoutShop;
|
||||
import org.openaudible.desktop.swt.util.shop.PaintShop;
|
||||
import org.openaudible.util.Platform;
|
||||
import org.openaudible.util.SimpleProcess;
|
||||
import org.openaudible.util.SimpleProcess.Results;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public abstract class GUI implements ITranslatable {
|
||||
/**
|
||||
|
@ -162,34 +165,44 @@ public abstract class GUI implements ITranslatable {
|
|||
|
||||
public static void explore(File m) {
|
||||
|
||||
String mac = "open ";
|
||||
|
||||
|
||||
String cmd = null;
|
||||
ArrayList<String>cmdLine = new ArrayList<>();
|
||||
|
||||
switch(Platform.getPlatform())
|
||||
{
|
||||
|
||||
case mac:
|
||||
cmd = "open ";
|
||||
if (!m.isDirectory()) cmd += "-R ";
|
||||
cmdLine.add("open");
|
||||
|
||||
if (!m.isDirectory())
|
||||
{
|
||||
cmdLine.add("-R");
|
||||
}
|
||||
break;
|
||||
case win:
|
||||
cmd = "Explorer /select, ";
|
||||
cmdLine.add("Explorer ");
|
||||
cmdLine.add("/select,");
|
||||
|
||||
break;
|
||||
case linux:
|
||||
cmd = "gnome-open PATH ";
|
||||
cmdLine.add("gnome-open");
|
||||
cmdLine.add("PATH");
|
||||
break;
|
||||
}
|
||||
if (cmdLine.isEmpty()) return;
|
||||
|
||||
try {
|
||||
cmdLine.add(m.getAbsolutePath());
|
||||
|
||||
SimpleProcess p = new SimpleProcess(cmdLine);
|
||||
p.run();
|
||||
|
||||
Results r = p.getResults();
|
||||
|
||||
|
||||
if (cmd != null) {
|
||||
cmd += "\"" + m.getAbsolutePath() + "\"";
|
||||
System.err.println(cmd);
|
||||
try {
|
||||
Runtime.getRuntime().exec(cmd);
|
||||
} catch (IOException e) {
|
||||
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -337,10 +337,25 @@ public class AudibleGUI implements BookListener, ConnectionListener {
|
|||
|
||||
MessageBoxFactory.showGeneral(null, 0, "Log in via web browser...", "Unable to connect right now.\n\nTry logging on to Audible from this web page and try again.\n\nIf this keeps ");
|
||||
|
||||
} catch (Throwable e) {
|
||||
} catch(AudibleSettingsError ase){
|
||||
String msg = "OpenAudible detected a problem trying to get your book list.\n\n";
|
||||
msg += "Please change your settings in "+audible.getAudibleURL()+".\n"+
|
||||
"Log into your audible account, click on the Account link, then settings.\n" +
|
||||
" "+browseSettings()+"\n"+
|
||||
"Uncheck (disable) the setting marked: Check for Audible Download Manager\n\n"+
|
||||
"After changing the setting, try again. \n"+
|
||||
"(You may also want to check for an update or other known problems.)";
|
||||
|
||||
MessageBoxFactory.showError(null, "Audible settings need to be changed", msg);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
LOG.info("Error refreshing library", e);
|
||||
if (!wasCanceled())
|
||||
if (!wasCanceled()) {
|
||||
|
||||
|
||||
showError(e, "refreshing library");
|
||||
}
|
||||
|
||||
} finally {
|
||||
audible.setProgress(null);
|
||||
}
|
||||
|
@ -778,8 +793,14 @@ public class AudibleGUI implements BookListener, ConnectionListener {
|
|||
}
|
||||
|
||||
|
||||
public String browseSettings() {
|
||||
return audible.getAudibleURL() + "/account/settings";
|
||||
}
|
||||
|
||||
|
||||
public void browse(final String url) {
|
||||
|
||||
|
||||
SWTAsync.run(new SWTAsync("browse") {
|
||||
@Override
|
||||
public void task() {
|
||||
|
|
|
@ -3,7 +3,7 @@ package org.openaudible.desktop.swt.manager;
|
|||
public interface Version {
|
||||
|
||||
String appName = "OpenAudible";
|
||||
String appVersion = "1.1.2";
|
||||
String appVersion = "1.1.3";
|
||||
boolean appDebug = false;
|
||||
String appLink = "http://openaudible.org";
|
||||
String versionLink = "http://openaudible.org/swt_version.json";
|
||||
|
|
|
@ -4,8 +4,6 @@ import org.apache.commons.logging.Log;
|
|||
import org.apache.commons.logging.LogFactory;
|
||||
import org.eclipse.jface.dialogs.Dialog;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.MouseAdapter;
|
||||
import org.eclipse.swt.events.MouseEvent;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
|
@ -196,7 +194,7 @@ public class Preferences extends Dialog {
|
|||
String loc = Directories.getDir(Directories.META).getAbsolutePath();
|
||||
String name = Directories.META.displayName();
|
||||
Label l = new Label(c, SWT.NONE);
|
||||
l.setText(name+": "+loc);
|
||||
l.setText(name + ": " + loc);
|
||||
|
||||
GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
|
||||
|
||||
|
@ -212,7 +210,7 @@ public class Preferences extends Dialog {
|
|||
|
||||
private void createAccountGroup(GridComposite c) {
|
||||
|
||||
Group group = c.newGroup("Audible Account", 3);
|
||||
Group group = c.newGroup("Audible Account", 2);
|
||||
group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
|
||||
GridData gd;
|
||||
|
||||
|
@ -221,13 +219,12 @@ public class Preferences extends Dialog {
|
|||
region.add(r.displayName());
|
||||
}
|
||||
gd = new GridData();
|
||||
gd.widthHint = 250;
|
||||
gd.widthHint = 200;
|
||||
region.setLayoutData(gd);
|
||||
|
||||
new Label(group, 0);
|
||||
// new Label(group, 0);
|
||||
|
||||
email = GridComposite.newTextPair(group, "Audible Email");
|
||||
new Label(group, 0);
|
||||
gd = new GridData();
|
||||
gd.widthHint = 250;
|
||||
email.setLayoutData(gd);
|
||||
|
@ -240,10 +237,10 @@ public class Preferences extends Dialog {
|
|||
gd.widthHint = 50;
|
||||
|
||||
|
||||
gd = new GridData();
|
||||
gd.widthHint = 150;
|
||||
region.setLayoutData(gd);
|
||||
|
||||
// gd = new GridData();
|
||||
// gd.widthHint = 150;
|
||||
// region.setLayoutData(gd);
|
||||
//
|
||||
// key.setEditable(false);
|
||||
}
|
||||
|
||||
|
|
|
@ -86,7 +86,9 @@ public class SimpleProcess {
|
|||
|
||||
|
||||
} finally {
|
||||
if (is!=null)
|
||||
is.finish();
|
||||
if (err!=null)
|
||||
err.finish();
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue