+++ /dev/null
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#
-# checkmarket.py - part of the FDroid server tools
-# Copyright (C) 2011, Ciaran Gultnieks, ciaran@ciarang.com
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-import subprocess
-
-#Read configuration...
-repo_name = None
-repo_description = None
-repo_icon = None
-repo_url = None
-execfile('config.py')
-
-subprocess.call('./run.sh ' + market_user + ' ' + market_password
- + ' ' + market_deviceid,
- cwd='marketcheck', shell=True)
-
+++ /dev/null
-\r
-import java.io.*;\r
-import java.util.*;\r
-\r
-import com.gc.android.market.api.MarketSession.Callback;\r
-import com.gc.android.market.api.MarketSession;\r
-import com.gc.android.market.api.model.Market.App;\r
-import com.gc.android.market.api.model.Market.AppsResponse;\r
-import com.gc.android.market.api.model.Market.AppsRequest;\r
-import com.gc.android.market.api.model.Market.CommentsRequest;\r
-import com.gc.android.market.api.model.Market.GetImageRequest;\r
-import com.gc.android.market.api.model.Market.GetImageResponse;\r
-import com.gc.android.market.api.model.Market.ResponseContext;\r
-import com.gc.android.market.api.model.Market.GetImageRequest.AppImageUsage;\r
-\r
-class test {\r
-\r
- /**\r
- * @param args\r
- */\r
- public static void main(String[] args) {\r
- try {\r
- if(args.length < 3) {\r
- System.out.println("Parameters :\n" +\r
- "email password deviceid");\r
- return;\r
- }\r
- String login = args[0];\r
- String password = args[1];\r
- String deviceid = args[2];\r
-\r
- // Get a list of apps we want to check - i.e. those that\r
- // we have metadata files for...\r
- File dir = new File("../metadata");\r
- List<String> apps = new ArrayList<String>();\r
- String[] metafiles = dir.list();\r
- for (int i=0; i<metafiles.length; i++) {\r
- String metafile = metafiles[i];\r
- if(metafile.endsWith(".txt")) {\r
- String pkg = metafile.substring(0,\r
- metafile.length() - 4);\r
- apps.add(pkg);\r
- }\r
- }\r
- System.out.println("Apps to check: " + apps.size());\r
-\r
- MarketSession session = new MarketSession();\r
-\r
- session.getContext().setAndroidId(deviceid);\r
- session.getContext().setDeviceAndSdkVersion("sapphire:7");\r
- System.out.println("Login...");\r
- session.login(login,password);\r
- System.out.println("Login done");\r
-\r
- MarketSession.Callback callback = new MarketSession.Callback() {\r
-\r
- @Override\r
- public void onResult(ResponseContext context, Object oresp) {\r
- try {\r
- AppsResponse response = (AppsResponse)oresp;\r
- if(response == null) {\r
- System.out.println("No response");\r
- }\r
- if(response.getAppCount() != 1) {\r
- System.out.println("Not in market, or multiple results");\r
- } else {\r
- App app = response.getAppList().get(0);\r
- String filespec = "../metadata/" + app.getPackageName() + ".txt";\r
- FileInputStream fi = new FileInputStream(filespec);\r
- InputStreamReader isr = new InputStreamReader(fi, "UTF-8");\r
- BufferedReader br = new BufferedReader(isr);\r
- StringBuilder output = new StringBuilder();\r
- boolean changed = false;\r
- boolean vercodefound = false;\r
- boolean versionfound = false;\r
- String line, newline;\r
- while (br.ready()) {\r
- line = br.readLine();\r
- if (line.startsWith("Market Version:")) {\r
- versionfound = true;\r
- newline="Market Version:" + app.getVersion();\r
- if (!newline.equals(line)) {\r
- changed = true;\r
- line = newline;\r
- }\r
- } else if (line.startsWith("Market Version Code:")) {\r
- vercodefound = true;\r
- newline="Market Version Code:" + app.getVersionCode();\r
- if (!newline.equals(line)) {\r
- changed = true;\r
- line = newline;\r
- }\r
- }\r
- output.append(line + "\n");\r
- }\r
- br.close();\r
- isr.close();\r
- fi.close();\r
- if(!versionfound) {\r
- changed = true;\r
- output.append("Market Version:" + app.getVersion() + "\n");\r
- }\r
- if(!vercodefound) {\r
- changed = true;\r
- output.append("Market Version Code:" + app.getVersionCode() + "\n");\r
- }\r
-\r
- if (changed) { \r
- System.out.println("..updating");\r
- FileOutputStream fo = new FileOutputStream(filespec);\r
- OutputStreamWriter osr = new OutputStreamWriter(fo, "UTF-8");\r
- BufferedWriter wi = new BufferedWriter(osr);\r
- wi.write(output.toString());\r
- wi.close();\r
- osr.close();\r
- fo.close();\r
- }\r
-\r
- }\r
- } catch (Exception ex) {\r
- System.out.println("...Exception");\r
- ex.printStackTrace();\r
- }\r
- }\r
-\r
- };\r
-\r
- for(String pkg : apps) {\r
- System.out.println("Checking: " + pkg);\r
- AppsRequest appsRequest = AppsRequest.newBuilder()\r
- .setQuery("pname:" + pkg)\r
- .setStartIndex(0).setEntriesCount(10)\r
- .setWithExtendedInfo(true)\r
- .build();\r
- session.append(appsRequest, callback);\r
- session.flush();\r
-\r
- // Pause to avoid rate limit...\r
- Thread.sleep(5000);\r
- }\r
-\r
- } catch(Exception ex) {\r
- ex.printStackTrace();\r
- }\r
- }\r
-\r
-}\r