MCPcopy Create free account
hub / github.com/buggins/coolreader / loadOPDSCatalogs

Method loadOPDSCatalogs

android/src/org/coolreader/crengine/CRDB.java:543–577  ·  view source on GitHub ↗
(FileInfo parent)

Source from the content-addressed store, hash-verified

541 }
542
543 synchronized public boolean loadOPDSCatalogs(FileInfo parent) {
544 Log.i("cr3", "loadOPDSCatalogs()");
545 boolean found = false;
546 Cursor rs = null;
547 try {
548 String sql = "SELECT id, name, url FROM opds_catalog";
549 rs = mDB.rawQuery(sql, null);
550 if ( rs.moveToFirst() ) {
551 // remove existing entries
552 parent.clear();
553 // read DB
554 do {
555 Long id = rs.getLong(0);
556 String name = rs.getString(1);
557 String url = rs.getString(2);
558 FileInfo opds = new FileInfo();
559 opds.isDirectory = true;
560 opds.pathname = FileInfo.OPDS_DIR_PREFIX + url;
561 opds.filename = name;
562 opds.isListed = true;
563 opds.isScanned = true;
564 opds.parent = parent;
565 opds.id = id;
566 parent.addDir(opds);
567 found = true;
568 } while (rs.moveToNext());
569 }
570 } catch (Exception e) {
571 Log.e("cr3", "exception while loading list of OPDS catalogs", e);
572 } finally {
573 if ( rs!=null )
574 rs.close();
575 }
576 return found;
577 }
578
579 public void removeOPDSCatalog(Long id) {
580 Log.i("cr3", "removeOPDSCatalog(" + id + ")");

Callers 2

addOPDSRootMethod · 0.80

Calls 6

addDirMethod · 0.80
iMethod · 0.65
eMethod · 0.65
clearMethod · 0.45
getStringMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected