com.akdeniz.googleplaycrawler.GooglePlay.BulkDetailsResponse Java Examples

The following examples show how to use com.akdeniz.googleplaycrawler.GooglePlay.BulkDetailsResponse. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SearchWorker.java    From Raccoon with Apache License 2.0 6 votes vote down vote up
private Vector<BulkDetailsEntry> doUpdateSearch() throws Exception {
	GooglePlayAPI service = App.createConnection(archive);
	BulkDetailsResponse response = service.bulkDetails(archive.list());
	Vector<BulkDetailsEntry> ret = new Vector<BulkDetailsEntry>();
	for (BulkDetailsEntry bulkDetailsEntry : response.getEntryList()) {
		DocV2 doc = bulkDetailsEntry.getDoc();
		String pn = doc.getBackendDocid();
		int vc = doc.getDetails().getAppDetails().getVersionCode();
		if (!archive.fileUnder(pn, vc).exists()) {
			ret.add(bulkDetailsEntry);
		}
		if (fetchIcons) {
			fetchIcon(doc);
		}
	}
	return ret;
}
 
Example #2
Source File: SearchWorker.java    From Raccoon with Apache License 2.0 6 votes vote down vote up
private Vector<BulkDetailsEntry> doQuerySearch() throws Exception {
	GooglePlayAPI service = App.createConnection(archive);
	service.setLocalization(localization);
	SearchResponse response = service.search(search, offset, limit);

	List<String> apps = new Vector<String>();
	if (response.getDocCount() > 0) {
		DocV2 all = response.getDoc(0);
		for (int i = 0; i < all.getChildCount(); i++) {
			apps.add(all.getChild(i).getBackendDocid());
			if (fetchIcons) {
				fetchIcon(all.getChild(i));
			}
		}
	}
	BulkDetailsResponse bdr = service.bulkDetails(apps);
	Vector<BulkDetailsEntry> ret = new Vector<BulkDetailsEntry>();
	for (int i = 0; i < bdr.getEntryCount(); i++) {
		ret.add(bdr.getEntry(i));
	}
	return ret;
}
 
Example #3
Source File: GooglePlayAPI.java    From dummydroid with Apache License 2.0 5 votes vote down vote up
/** Equivalent of details but bulky one! */
public BulkDetailsResponse bulkDetails(List<String> packageNames) throws IOException {

	Builder bulkDetailsRequestBuilder = BulkDetailsRequest.newBuilder();
	bulkDetailsRequestBuilder.addAllDocid(packageNames);

	ResponseWrapper responseWrapper = executePOSTRequest(BULKDETAILS_URL, bulkDetailsRequestBuilder
			.build().toByteArray(), "application/x-protobuf");

	return responseWrapper.getPayload().getBulkDetailsResponse();
}
 
Example #4
Source File: UpdateAppWorker.java    From raccoon4 with Apache License 2.0 5 votes vote down vote up
private Integer update(List<AndroidApp> apps, PlayProfile profile)
		throws IOException {

	int number = 0;
	List<String> pns = new ArrayList<String>(apps.size());
	HashMap<String, AndroidApp> map = new HashMap<String, AndroidApp>();
	for (AndroidApp app : apps) {
		// Note: this check should not exist.
		if (app.getPackageName() != null && !app.getPackageName().equals("")
				&& !pns.contains(app.getPackageName())) {
			pns.add(app.getPackageName());
			map.put(app.getPackageName(), app);
		}
		System.out.println(app.getAppId()+" "+app.getPackageName());
	}
	GooglePlayAPI api = PlayManager.createConnection(profile);

	BulkDetailsResponse response = api.bulkDetails(pns);
	List<BulkDetailsEntry> bde = response.getEntryList();
	for (BulkDetailsEntry entry : bde) {
		DocV2 doc = entry.getDoc();
		AppDetails ad = entry.getDoc().getDetails().getAppDetails();
		String pn = ad.getPackageName();
		if (map.containsKey(pn)) {
			int lvc = map.get(pn).getVersionCode();
			int rvc = ad.getVersionCode();
			if (lvc < rvc) {
				globals.get(TransferManager.class).schedule(globals,
						new AppDownloadWorker(globals, doc), TransferManager.WAN);
				number++;
			}
		}
	}
	return number;
}
 
Example #5
Source File: Unwrap.java    From raccoon4 with Apache License 2.0 5 votes vote down vote up
public static BulkDetailsResponse bulkDetailsResponse(ResponseWrapper rw) {
	Payload pl = payload(rw);
	if (pl.hasBulkDetailsResponse()) {
		return pl.getBulkDetailsResponse();
	}
	return BulkDetailsResponse.getDefaultInstance();
}
 
Example #6
Source File: GooglePlayAPI.java    From raccoon4 with Apache License 2.0 5 votes vote down vote up
/** Equivalent of details but bulky one! */
public BulkDetailsResponse bulkDetails(List<String> packageNames)
		throws IOException {

	Builder bulkDetailsRequestBuilder = BulkDetailsRequest.newBuilder();
	bulkDetailsRequestBuilder.addAllDocid(packageNames).setIncludeDetails(true);

	ResponseWrapper responseWrapper = executePOSTRequest(BULKDETAILS_URL,
			bulkDetailsRequestBuilder.build().toByteArray(),
			"application/x-protobuf");

	return responseWrapper.getPayload().getBulkDetailsResponse();
}
 
Example #7
Source File: GooglePlayAPI.java    From Raccoon with Apache License 2.0 5 votes vote down vote up
/** Equivalent of details but bulky one! */
public BulkDetailsResponse bulkDetails(List<String> packageNames) throws IOException {

	Builder bulkDetailsRequestBuilder = BulkDetailsRequest.newBuilder();
	bulkDetailsRequestBuilder.addAllDocid(packageNames);

	ResponseWrapper responseWrapper = executePOSTRequest(BULKDETAILS_URL, bulkDetailsRequestBuilder
			.build().toByteArray(), "application/x-protobuf");

	return responseWrapper.getPayload().getBulkDetailsResponse();
}
 
Example #8
Source File: Play.java    From raccoon4 with Apache License 2.0 4 votes vote down vote up
public static void updateApps() {
	DatabaseManager dbm = getDatabase();
	PlayAppOwnerDao pad = dbm.get(PlayAppOwnerDao.class);
	List<AndroidApp> apps = pad.list(getProfile());
	List<String> pns = new ArrayList<String>(apps.size());
	HashMap<String, AndroidApp> map = new HashMap<String, AndroidApp>();
	for (AndroidApp app : apps) {
		// Note: this check should not exist.
		if (app.getPackageName() != null && !app.getPackageName().equals("")
				&& !pns.contains(app.getPackageName())) {
			pns.add(app.getPackageName());
			map.put(app.getPackageName(), app);
		}
	}
	GooglePlayAPI api = createConnection();
	try {
		BulkDetailsResponse response = api.bulkDetails(pns);
		List<BulkDetailsEntry> bde = response.getEntryList();
		for (BulkDetailsEntry entry : bde) {
			AppDetails ad = entry.getDoc().getDetails().getAppDetails();
			String pn = ad.getPackageName();
			int rvc = ad.getVersionCode();
			if (map.containsKey(pn)) {
				int lvc = map.get(pn).getVersionCode();
				if (lvc < rvc) {
					System.out.println("^\t" + pn + "\t" + lvc + "\t->\t" + rvc);
					downloadApp(pn, rvc, 1);
				}
				else {
					System.out.println("=\t" + pn + "\t" + lvc + "\t->\t" + rvc);
				}
			}
			else {
				System.out.println("?\t" + pn + "\t0\t->\t" + rvc);
			}
		}
	}
	catch (IOException e) {
		Router.fail(e.getMessage());
		e.printStackTrace();
	}
}