-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
1,178 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,52 @@ | |||
from apk_wrapper import APKWrapper, APKWrapperError | |||
from common import Utils | |||
from optparse import OptionParser | |||
|
|||
import helper_analyzer | |||
|
|||
import os | |||
import shutil | |||
|
|||
def renameApp(theApp, theSdkPath): | |||
apk = APKWrapper(theApp, theSdkPath) | |||
|
|||
newName = '%s/%s-%s.apk' % (apk.getApkPath(), apk.getPackage(), apk.getMd5Hash()) | |||
print '- Rename from %s to %s' % (theApp, newName) | |||
shutil.move(theApp, newName) | |||
|
|||
def main(): | |||
# Get directory | |||
parser = OptionParser(usage='usage: %prog [options] dir targetDir') | |||
parser.add_option('-m', '--mode', metavar='#', default=0) | |||
parser.add_option('', '--sdkPath', metavar='<path>', default='', help='Set path to Android SDK') | |||
(options, args) = parser.parse_args() | |||
|
|||
if len(args) < 1: | |||
raise ValueError('Provide a directory') | |||
aDir = args[0] | |||
targetDir = None | |||
if len(args) > 1: | |||
targetDir = args[1] | |||
|
|||
# Get app names | |||
if int(options.mode) == 0: | |||
appNameList = Utils._getAppListInDirectory(aDir) | |||
print 'Get APK Wrapper of %d apps' % len(appNameList) | |||
for appName in appNameList: | |||
renameApp(appName, options.sdkPath) | |||
|
|||
# Goodware | |||
if int(options.mode) == 1: | |||
if targetDir is None: | |||
raise ValueError('Provide a target directory') | |||
analyzer = helper_analyzer.Analyzer([aDir], theSdkPath=options.sdkPath) | |||
analyzer.baseAppDir = '/home/daniel/Documents/MarketApps/apps' | |||
appList = analyzer.generateList() | |||
for app in appList: | |||
oldName = os.path.join('/home/daniel/Documents/MarketApps/apps', app[1].getApkFileName()) | |||
newName = os.path.join(targetDir, app[0]) | |||
print '- Copy app form %s to %s' % (oldName, newName) | |||
shutil.copy2(oldName, newName) | |||
|
|||
if __name__ == '__main__': | |||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.