Updates for version 1.1.2
This commit is contained in:
parent
12e7a2d2d4
commit
3776ed5071
13 changed files with 218 additions and 92 deletions
|
@ -50,8 +50,6 @@ public class AudibleClient extends WebClient {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
CookieManager cm = this.getCookieManager();
|
|
||||||
|
|
||||||
|
|
||||||
this.waitForBackgroundJavaScript(15000);
|
this.waitForBackgroundJavaScript(15000);
|
||||||
if (!maxDebug) {
|
if (!maxDebug) {
|
||||||
|
|
|
@ -63,27 +63,6 @@ public class AudibleScraper {
|
||||||
this.page = page;
|
this.page = page;
|
||||||
LOG.info("pageLoaded:" + page.getUrl() + " " + page.getTitleText());
|
LOG.info("pageLoaded:" + page.getUrl() + " " + page.getTitleText());
|
||||||
|
|
||||||
|
|
||||||
if (page != null && debugCust) {
|
|
||||||
String xml = page.asXml();
|
|
||||||
int i1 = xml.indexOf("cust_id");
|
|
||||||
|
|
||||||
int i2 = xml.indexOf("order_number");
|
|
||||||
String s1 = "", s2 = "";
|
|
||||||
if (i1 != -1) {
|
|
||||||
s1 = xml.substring(i1 - 300, i1 + 300);
|
|
||||||
}
|
|
||||||
if (i2 != -1) {
|
|
||||||
s2 = xml.substring(i2 - 300, i2 + 300);
|
|
||||||
}
|
|
||||||
if (s1.length() > 0 || s2.length() > 0) {
|
|
||||||
LOG.info("Found cust_id:s1=" + s1 + "\ns2=" + s2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// progress.setSubTask("page.getTitleText());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLoggedIn() {
|
public boolean isLoggedIn() {
|
||||||
|
@ -109,7 +88,7 @@ public class AudibleScraper {
|
||||||
} else {
|
} else {
|
||||||
if (page != null) {
|
if (page != null) {
|
||||||
String u = page.getUrl().toString();
|
String u = page.getUrl().toString();
|
||||||
ConnectionNotifier.getInstance().setLastURL(u);
|
ConnectionNotifier.getInstance().loginFailed(u, page.asXml());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -232,12 +211,24 @@ public class AudibleScraper {
|
||||||
|
|
||||||
if (getProgress() != null)
|
if (getProgress() != null)
|
||||||
getProgress().setTask("Submitting credentials...");
|
getProgress().setTask("Submitting credentials...");
|
||||||
|
HTMLUtil.debugNode(page, "submitting-credentials");
|
||||||
|
|
||||||
setPage(submit.click());
|
setPage(submit.click());
|
||||||
boolean ok = checkLoggedIn();
|
boolean ok = checkLoggedIn();
|
||||||
|
|
||||||
if (!ok)
|
if (!ok)
|
||||||
HTMLUtil.debugNode(page, "login submitted");
|
{
|
||||||
|
HTMLUtil.debugNode(page, "login failed");
|
||||||
|
LOG.info(page.getUrl());
|
||||||
|
|
||||||
|
LOG.info("Login failed, see html files at:"+HTMLUtil.debugFile("submitting-credentials").getAbsolutePath()+" and "+HTMLUtil.debugFile("login failed").getAbsolutePath());
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HTMLUtil.debugFile("submitting-credentials").delete();
|
||||||
|
}
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
@ -455,30 +446,6 @@ public class AudibleScraper {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
private DomDocumentFragment getLibraryFragment(int pageNum, int items) throws IOException, SAXException {
|
|
||||||
EventTimer evt = new EventTimer();
|
|
||||||
String url = getAudibleBase()+"/lib-ajax";
|
|
||||||
WebRequest webRequest = new WebRequest(new URL(url), HttpMethod.POST);
|
|
||||||
webRequest.setRequestBody("progType=all&timeFilter=all&itemsPerPage=" + items + "&searchTerm=&searchType=&sortColumn=&sortType=down&page=" + pageNum + "&mode=normal&subId=&subTitle=");
|
|
||||||
WebResponse webResponse = getWebClient().getWebConnection().getResponse(webRequest);
|
|
||||||
String content = webResponse.getContentAsString();
|
|
||||||
DomDocumentFragment frag = new DomDocumentFragment(page);
|
|
||||||
HTMLParser.parseFragment(frag, content);
|
|
||||||
LOG.info(evt.reportString("get Library Page:" + pageNum));
|
|
||||||
return frag;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public Collection<Book> fetchFirstLibraryPage() throws Exception {
|
|
||||||
if (page == null)
|
|
||||||
home();
|
|
||||||
LOG.info("Accessing audible library...");
|
|
||||||
HashSet<Book> results = new HashSet<>();
|
|
||||||
lib();
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
public Collection<Book> fetchLibraryQuick(HashMap<String, Book> books) throws Exception {
|
public Collection<Book> fetchLibraryQuick(HashMap<String, Book> books) throws Exception {
|
||||||
return _fetchLibrary(books);
|
return _fetchLibrary(books);
|
||||||
|
@ -487,7 +454,7 @@ public class AudibleScraper {
|
||||||
public Collection<Book> _fetchLibrary(HashMap<String, Book> existingBooks) throws Exception {
|
public Collection<Book> _fetchLibrary(HashMap<String, Book> existingBooks) throws Exception {
|
||||||
if (page == null)
|
if (page == null)
|
||||||
home();
|
home();
|
||||||
LOG.info("Accessing audible library...");
|
// LOG.info("Accessing audible library...");
|
||||||
HashSet<Book> results = new HashSet<>();
|
HashSet<Book> results = new HashSet<>();
|
||||||
// getWebClient().setJavascriptEnabled(false);
|
// getWebClient().setJavascriptEnabled(false);
|
||||||
progress.setTask("Scanning your library to get your list of books...", "");
|
progress.setTask("Scanning your library to get your list of books...", "");
|
||||||
|
@ -511,21 +478,8 @@ public class AudibleScraper {
|
||||||
if (next == null) {
|
if (next == null) {
|
||||||
assert (pageNum == 1);
|
assert (pageNum == 1);
|
||||||
setURL("/lib", "Reading Library...");
|
setURL("/lib", "Reading Library...");
|
||||||
|
setPageFilter();
|
||||||
|
|
||||||
DomElement purchaseDateFilter = page.getElementByName("purchaseDateFilter");
|
|
||||||
if (purchaseDateFilter!=null)
|
|
||||||
{
|
|
||||||
DomNodeList<DomNode> nodes = purchaseDateFilter.getChildNodes();
|
|
||||||
for (DomNode n:nodes)
|
|
||||||
{
|
|
||||||
if (n instanceof HtmlOption)
|
|
||||||
{
|
|
||||||
// "all" is first option..
|
|
||||||
((HtmlOption) n).click();
|
|
||||||
break ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// getProgress().setTask("Getting a list of your library. );
|
// getProgress().setTask("Getting a list of your library. );
|
||||||
EventTimer evt = new EventTimer();
|
EventTimer evt = new EventTimer();
|
||||||
|
@ -555,7 +509,7 @@ public class AudibleScraper {
|
||||||
int newBooks = 0;
|
int newBooks = 0;
|
||||||
|
|
||||||
for (Book b : list) {
|
for (Book b : list) {
|
||||||
LOG.info(b.toString());
|
// LOG.info(b.toString());
|
||||||
if (b.partial())
|
if (b.partial())
|
||||||
continue;
|
continue;
|
||||||
if (results.contains(b)) {
|
if (results.contains(b)) {
|
||||||
|
@ -577,11 +531,56 @@ public class AudibleScraper {
|
||||||
next = LibraryParser.instance.getNextPage(page);
|
next = LibraryParser.instance.getNextPage(page);
|
||||||
if (next == null)
|
if (next == null)
|
||||||
break;
|
break;
|
||||||
|
//LOG.info("next page:"+next);
|
||||||
}
|
}
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setPageFilter()
|
||||||
|
{
|
||||||
|
DomElement purchaseDateFilter = page.getElementByName("purchaseDateFilter");
|
||||||
|
if (purchaseDateFilter!=null && purchaseDateFilter instanceof HtmlSelect)
|
||||||
|
{
|
||||||
|
HtmlSelect h = (HtmlSelect)purchaseDateFilter;
|
||||||
|
int i = h.getSelectedIndex();
|
||||||
|
if (i!=0)
|
||||||
|
{
|
||||||
|
HtmlOption all = h.getOption(0);
|
||||||
|
String url = all.getAttribute("data-url");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (url!=null && !url.isEmpty())
|
||||||
|
{
|
||||||
|
//LOG.info("url: "+ url);
|
||||||
|
String newURL = url+ "&purchaseDateFilter=all&programFilter=all&sortBy=PURCHASE_DATE.dsc";
|
||||||
|
page = (HtmlPage) setURL(newURL, "Setting view filter");
|
||||||
|
LOG.info("new URL: "+ page.getUrl());
|
||||||
|
}
|
||||||
|
h = (HtmlSelect) page.getElementByName("purchaseDateFilter");
|
||||||
|
i = h.getSelectedIndex();
|
||||||
|
if (i!=0)
|
||||||
|
{
|
||||||
|
LOG.error("Expected filter to be set to 0, not "+i);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e)
|
||||||
|
{
|
||||||
|
LOG.error("Error setting filter.. update may be required.",e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
LOG.info("warning: did not find library filter htmlSelect.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Collection<Book> fetchLibrary() throws Exception {
|
public Collection<Book> fetchLibrary() throws Exception {
|
||||||
return _fetchLibrary(null);
|
return _fetchLibrary(null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ import org.openaudible.AudibleAccountPrefs;
|
||||||
*/
|
*/
|
||||||
public interface ConnectionListener {
|
public interface ConnectionListener {
|
||||||
void connectionChanged(boolean connected);
|
void connectionChanged(boolean connected);
|
||||||
|
|
||||||
AudibleAccountPrefs getAccountPrefs(AudibleAccountPrefs in);
|
AudibleAccountPrefs getAccountPrefs(AudibleAccountPrefs in);
|
||||||
|
void loginFailed(String url, String html);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,17 +53,25 @@ public class ConnectionNotifier extends EventNotifier<ConnectionListener> implem
|
||||||
return getState() == State.Disconnected;
|
return getState() == State.Disconnected;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLastURL(String u) {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// not connected is unknown.
|
// not connected is unknown.
|
||||||
// connected means in account
|
// connected means in account
|
||||||
// disconnected means a password is being asked for.
|
// disconnected means a password is being asked for.
|
||||||
enum State {
|
enum State {
|
||||||
Not_Connected, Connected, Disconnected
|
Not_Connected, Connected, Disconnected
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void loginFailed(String url, String html)
|
||||||
|
{
|
||||||
|
for (ConnectionListener l : getListeners()) {
|
||||||
|
l.loginFailed(url, html);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -247,6 +247,10 @@ public enum LibraryParser {
|
||||||
|
|
||||||
HashMap<String, String> args = Util.urlGetArgs(url);
|
HashMap<String, String> args = Util.urlGetArgs(url);
|
||||||
for (String k : args.keySet()) {
|
for (String k : args.keySet()) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BookElement elem = BookElement.findByName(k);
|
BookElement elem = BookElement.findByName(k);
|
||||||
if (elem != null) {
|
if (elem != null) {
|
||||||
b.set(elem, args.get(k));
|
b.set(elem, args.get(k));
|
||||||
|
|
|
@ -10,7 +10,26 @@ public enum BookElement {
|
||||||
try {
|
try {
|
||||||
return BookElement.valueOf(s);
|
return BookElement.valueOf(s);
|
||||||
} catch (Throwable th) {
|
} catch (Throwable th) {
|
||||||
|
switch(s)
|
||||||
|
{
|
||||||
|
case "title":
|
||||||
|
return shortTitle;
|
||||||
|
case "DownloadType":
|
||||||
|
break;
|
||||||
|
case "domain":
|
||||||
|
break;
|
||||||
|
case "awtype":
|
||||||
|
break;
|
||||||
|
case "transfer_player":
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
//
|
||||||
System.out.println("No BookElement:" + s);
|
System.out.println("No BookElement:" + s);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,10 @@ import org.openaudible.desktop.swt.manager.menu.AppMenu;
|
||||||
import org.openaudible.desktop.swt.manager.menu.CommandCenter;
|
import org.openaudible.desktop.swt.manager.menu.CommandCenter;
|
||||||
import org.openaudible.desktop.swt.util.shop.LayoutShop;
|
import org.openaudible.desktop.swt.util.shop.LayoutShop;
|
||||||
import org.openaudible.desktop.swt.util.shop.PaintShop;
|
import org.openaudible.desktop.swt.util.shop.PaintShop;
|
||||||
|
import org.openaudible.util.Platform;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
public abstract class GUI implements ITranslatable {
|
public abstract class GUI implements ITranslatable {
|
||||||
/**
|
/**
|
||||||
|
@ -156,6 +160,39 @@ public abstract class GUI implements ITranslatable {
|
||||||
return (isWindows() || isSolaris() || isMac());
|
return (isWindows() || isSolaris() || isMac());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void explore(File m) {
|
||||||
|
|
||||||
|
String mac = "open ";
|
||||||
|
|
||||||
|
|
||||||
|
String cmd = null;
|
||||||
|
switch(Platform.getPlatform())
|
||||||
|
{
|
||||||
|
|
||||||
|
case mac:
|
||||||
|
cmd = "open ";
|
||||||
|
if (!m.isDirectory()) cmd += "-R ";
|
||||||
|
break;
|
||||||
|
case win:
|
||||||
|
cmd = "Explorer /select, ";
|
||||||
|
break;
|
||||||
|
case linux:
|
||||||
|
cmd = "gnome-open PATH ";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cmd != null) {
|
||||||
|
cmd += "\"" + m.getAbsolutePath() + "\"";
|
||||||
|
System.err.println(cmd);
|
||||||
|
try {
|
||||||
|
Runtime.getRuntime().exec(cmd);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public abstract String getAppName();
|
public abstract String getAppName();
|
||||||
|
|
||||||
public abstract String getAppNameAndVersion();
|
public abstract String getAppNameAndVersion();
|
||||||
|
|
|
@ -7,7 +7,9 @@ import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.eclipse.jface.window.Window;
|
import org.eclipse.jface.window.Window;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.widgets.Display;
|
||||||
import org.eclipse.swt.widgets.FileDialog;
|
import org.eclipse.swt.widgets.FileDialog;
|
||||||
|
import org.eclipse.swt.widgets.MessageBox;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.openaudible.Audible;
|
import org.openaudible.Audible;
|
||||||
import org.openaudible.AudibleAccountPrefs;
|
import org.openaudible.AudibleAccountPrefs;
|
||||||
|
@ -565,20 +567,8 @@ public class AudibleGUI implements BookListener, ConnectionListener {
|
||||||
Book b = onlyOneSelected();
|
Book b = onlyOneSelected();
|
||||||
File m = audible.getMP3FileDest(b);
|
File m = audible.getMP3FileDest(b);
|
||||||
if (m.exists()) {
|
if (m.exists()) {
|
||||||
String mac = "open -R ";
|
GUI.explore(m);
|
||||||
String win = "Explorer /select, ";
|
|
||||||
|
|
||||||
String cmd = null;
|
|
||||||
if (Platform.isMac())
|
|
||||||
cmd = mac;
|
|
||||||
if (Platform.isWindows())
|
|
||||||
cmd = win;
|
|
||||||
// TODO: Support linux.
|
|
||||||
if (cmd != null) {
|
|
||||||
cmd += "\"" + m.getAbsolutePath() + "\"";
|
|
||||||
System.err.println(cmd);
|
|
||||||
Runtime.getRuntime().exec(cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Desktop.getDesktop().open(m.getParentFile());
|
// Desktop.getDesktop().open(m.getParentFile());
|
||||||
}
|
}
|
||||||
|
@ -1161,6 +1151,23 @@ public class AudibleGUI implements BookListener, ConnectionListener {
|
||||||
MessageBoxFactory.showError(getShell(), e.getMessage());
|
MessageBoxFactory.showError(getShell(), e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void loginFailed(String url, String html)
|
||||||
|
{
|
||||||
|
|
||||||
|
SWTAsync.slow(new SWTAsync("Login problem...") {
|
||||||
|
public void task() {
|
||||||
|
String message = "There was a problem logging in... Try to view the page in the OpenAudible Browser?";
|
||||||
|
boolean ok = MessageBoxFactory.showGeneralYesNo(null, "Trouble logging in", message);
|
||||||
|
if (ok)
|
||||||
|
browse(url);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -3,7 +3,7 @@ package org.openaudible.desktop.swt.manager;
|
||||||
public interface Version {
|
public interface Version {
|
||||||
|
|
||||||
String appName = "OpenAudible";
|
String appName = "OpenAudible";
|
||||||
String appVersion = "1.1.1";
|
String appVersion = "1.1.2";
|
||||||
boolean appDebug = false;
|
boolean appDebug = false;
|
||||||
String appLink = "http://openaudible.org";
|
String appLink = "http://openaudible.org";
|
||||||
String versionLink = "http://openaudible.org/swt_version.json";
|
String versionLink = "http://openaudible.org/swt_version.json";
|
||||||
|
|
|
@ -258,19 +258,38 @@ public class AudibleBrowser {
|
||||||
new BrowserFunction(browser, "cookieCallback") {
|
new BrowserFunction(browser, "cookieCallback") {
|
||||||
@Override
|
@Override
|
||||||
public Object function(Object[] objects) {
|
public Object function(Object[] objects) {
|
||||||
|
|
||||||
ArrayList<Cookie> list = new ArrayList<>();
|
ArrayList<Cookie> list = new ArrayList<>();
|
||||||
String u = browser.getUrl();
|
String u = browser.getUrl();
|
||||||
|
|
||||||
if (u.contains("audible.")) {
|
if (u.contains("audible.")) {
|
||||||
|
// Get host from url.
|
||||||
|
// https://www.audible.com/
|
||||||
|
String host = "www.audible.com";
|
||||||
|
|
||||||
|
if (u.startsWith("http"))
|
||||||
|
{
|
||||||
|
String[] parts = u.split("/");
|
||||||
|
if (parts!=null && parts.length>2)
|
||||||
|
{
|
||||||
|
if (parts[2].contains("audible"))
|
||||||
|
host = parts[2];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Object[] keyValuePairs = (Object[]) objects[0];
|
Object[] keyValuePairs = (Object[]) objects[0];
|
||||||
for (Object o : keyValuePairs) {
|
for (Object o : keyValuePairs) {
|
||||||
Object arr[] = (Object[]) o;
|
Object arr[] = (Object[]) o;
|
||||||
Cookie c = new Cookie("www.audible.com", arr[0].toString(), arr[1].toString());
|
Cookie c = new Cookie(host, arr[0].toString(), arr[1].toString());
|
||||||
list.add(c);
|
list.add(c);
|
||||||
}
|
}
|
||||||
cookies = list;
|
cookies = list;
|
||||||
} else
|
} else
|
||||||
logger.info("Expected url to include audible, instead: " + u);
|
logger.info("Expected url to include audible, instead: " + u);
|
||||||
|
|
||||||
|
logger.info("cookieCallback: " + list.size());
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -279,8 +298,8 @@ public class AudibleBrowser {
|
||||||
new BrowserFunction(browser, "pageInfoCallback") {
|
new BrowserFunction(browser, "pageInfoCallback") {
|
||||||
@Override
|
@Override
|
||||||
public Object function(Object[] objects) {
|
public Object function(Object[] objects) {
|
||||||
ArrayList<Cookie> list = new ArrayList<>();
|
String u = browser.getUrl();
|
||||||
|
logger.info("pageInfoCallback: " + u);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,6 +4,8 @@ import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.eclipse.jface.dialogs.Dialog;
|
import org.eclipse.jface.dialogs.Dialog;
|
||||||
import org.eclipse.swt.SWT;
|
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.SelectionAdapter;
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
import org.eclipse.swt.layout.GridData;
|
import org.eclipse.swt.layout.GridData;
|
||||||
|
@ -12,6 +14,7 @@ import org.openaudible.Audible;
|
||||||
import org.openaudible.AudibleAccountPrefs;
|
import org.openaudible.AudibleAccountPrefs;
|
||||||
import org.openaudible.AudibleRegion;
|
import org.openaudible.AudibleRegion;
|
||||||
import org.openaudible.Directories;
|
import org.openaudible.Directories;
|
||||||
|
import org.openaudible.desktop.swt.gui.GUI;
|
||||||
import org.openaudible.desktop.swt.gui.MessageBoxFactory;
|
import org.openaudible.desktop.swt.gui.MessageBoxFactory;
|
||||||
import org.openaudible.desktop.swt.manager.AudibleGUI;
|
import org.openaudible.desktop.swt.manager.AudibleGUI;
|
||||||
|
|
||||||
|
@ -179,6 +182,7 @@ public class Preferences extends Dialog {
|
||||||
createAccountGroup(c);
|
createAccountGroup(c);
|
||||||
createDirectoryGroup(c);
|
createDirectoryGroup(c);
|
||||||
createAutomationGroup(c);
|
createAutomationGroup(c);
|
||||||
|
createPrefsLocation(c);
|
||||||
|
|
||||||
this.getShell().setText("Preferences");
|
this.getShell().setText("Preferences");
|
||||||
populate();
|
populate();
|
||||||
|
@ -186,6 +190,26 @@ public class Preferences extends Dialog {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void createPrefsLocation(GridComposite c) {
|
||||||
|
c = new GridComposite(c, SWT.NONE, 2, false, GridData.FILL_HORIZONTAL);
|
||||||
|
|
||||||
|
String loc = Directories.getDir(Directories.META).getAbsolutePath();
|
||||||
|
String name = Directories.META.displayName();
|
||||||
|
Label l = new Label(c, SWT.NONE);
|
||||||
|
l.setText(name+": "+loc);
|
||||||
|
|
||||||
|
GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
|
||||||
|
|
||||||
|
Button b = c.newButton(SWT.PUSH, "Show");
|
||||||
|
b.addSelectionListener(new SelectionAdapter() {
|
||||||
|
@Override
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
GUI.explore(Directories.getDir(Directories.META));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private void createAccountGroup(GridComposite c) {
|
private void createAccountGroup(GridComposite c) {
|
||||||
|
|
||||||
Group group = c.newGroup("Audible Account", 3);
|
Group group = c.newGroup("Audible Account", 3);
|
||||||
|
|
|
@ -144,5 +144,12 @@ public class StatusPanel extends GridComposite implements BookListener, Connecti
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void loginFailed(String url, String html)
|
||||||
|
{
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,6 +90,11 @@ public class HTMLUtil {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static File debugFile(String what)
|
||||||
|
{
|
||||||
|
return new File(Directories.getTmpDir(), what);
|
||||||
|
}
|
||||||
|
|
||||||
public static String debugNode(DomNode p, String what) {
|
public static String debugNode(DomNode p, String what) {
|
||||||
String xml = "";
|
String xml = "";
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue