def main(): if len(argv) == 1: usage() if argv[1] == 'get': if len(argv) == 2: get() elif argv[2] in ['ubuntu', 'fedora', 'debian', 'arch']: get(argv[2]) else: usage() elif argv[1] == 'add': try: libc_file = argv[2] add_local_libc(libc_file) except: usage() elif argv[1] == 'find': try: fun_name = argv[2] fun_addr = argv[3] find(fun_name, fun_addr) except: usage() elif argv[1] == 'identify': try: libc_file = argv[2] identify(libc_file) except: usage() elif argv[1] == 'status': status() else: usage()
def search(reset=False): global maxPage, maxCount, currentPage, pageCache, lastPage, lastSearch, pageType ShowDialogWait() status("Searching...") saveUserSettings() window = GetWindow(WINDOW_ID) mainList = window.GetList(MOVIES_ID) statusLabel = window.GetLabel(STATUS_LABEL) statusLabel.SetVisible(False) if reset: currentPage = 0 pageCache.clear() lastPage = 0 try: if window.GetControl(144).HasFocus(): searchSpecified(window, mainList) else: if isNormal(): searchNormal(window, mainList) elif isPlaylist(): searchPlaylist(window, mainList) updateStatusLabel() finally: hideWaitDialog() if mainList.IsVisible(): mainList.SetFocus() lastPage = currentPage lastSearch = time.time() if maxCount == 0: mc.ShowDialogNotification("No movies matched the filters!")
def search(self, type='movie', category='free', genre='all', sort='rating', offset=0, count=100, query=''): if type not in self.genreCache.keys(): # we don't store them, we just need the cache to be updated self.getGenres(type) if not self.playlists: self.getPlaylists() # fetch em dict = {'type' : type, 'category' : category, 'genre' : genre, 'sort' : sort, 'offset' : offset, 'count' : count, 'q' : query} jsonData = _getURL(SEARCH_URL, urllib.urlencode(dict)) data = json.loads(jsonData) max = data[u'data'][u'count'] if type == 'episode': # TODO: Is this too heavy? series = {} data = _postProcess(data, series) while ((offset+count) < max) and (genre != 'all'): num = (offset / count) + 1 status("Fetching episodes", num, math.ceil(max/count)) offset += count jsonData = _getURL(SEARCH_URL % urllib.urlencode(dict)) # only GET supported d = json.loads(jsonData) _postProcess(d, series) status("Sorting TVSeries") data[u'data'][u'videos'] = series.values() data[u'data'][u'count'] = len(series) if genre != 'all': max = len(series) # 'all' because some vids are in more than one category... sigh... vids = [Movie(vid, self.genreCache['all'], self.playlists) for vid in data[u'data'][u'videos']] if type == 'episode': vids.sort(sortMethods[sort]) return max, vids
def transitive_reload(modules, visited): while moduels: next = modules.pop() status(next) tryreload(next) visited.add(next) modules.extend(x for x in next.__dict__.values() if type(x) == types.ModulesType and x not in visited)
def __init__(self): self.apklist = apkList().apks self.status = status() self.apkrepomaintainer = apkRepoMaintainer() self.apkdecompiler = apkDecompiler() self.currptr = 0 self.apk_name = ''
def playMovie(listId=MOVIES_ID): movieList = GetActiveWindow().GetList(listId) index = movieList.GetFocusedItem() movie = movieList.GetItem(index) ShowDialogWait() try: status("Playing movie %s" % movie.GetLabel()) player = mc.GetApp().GetLocalConfig().GetValue('player') url = voddlerapi.getAPI().getMovieURL(movie.GetProperty('id'), player) if not url: # revert to web-url url = movie.GetProperty('url') print "Playing %s" % url movie.SetPath(url) finally: hideWaitDialog() mc.GetPlayer().PlayWithActionMenu(movie)
def playTrailer(): ShowDialogWait() movieList = mc.GetActiveWindow().GetList(MOVIES_ID) index = movieList.GetFocusedItem() movie = movieList.GetItem(index) trailerHD = movie.GetProperty('Trailer HD') trailerSD = movie.GetProperty('Trailer SD') if trailerHD or trailerSD: status("Playing trailer for %s" % movie.GetLabel()) trailer = ListItem(ListItem.MEDIA_VIDEO_TRAILER) trailer.SetLabel("Trailer for %s" % movie.GetLabel()) if trailerHD: trailer.SetPath(trailerHD) elif trailerSD: trailer.Setpath(trailerSD) trailer.SetLabel("LQ %s" % trailer.GetLabel()) mc.GetPlayer().Play(trailer) movieList.SetFocus() hideWaitDialog()
def searchPlaylist(window, mainList): global currentPage, pageCache, pageSize, maxCount, maxPage offset = currentPage * pageSize items = ListItems() if currentPage in pageCache.keys(): items = pageCache[currentPage] else: status("Fetching page %i" % (currentPage+1)) # TODO: Support sorting? maxCount, data = voddlerapi.getAPI().getMoviesOnPlaylist(pageType, 'alphabetical') maxPage = (maxCount-1) / pageSize if maxPage < 0: maxPage = 0 itemsOnCurrentPage = min(pageSize, maxCount, maxCount - (currentPage*pageSize)) for index, movie in enumerate(data): status("Generating page %i of %i" % (currentPage+1, maxPage+1), index+1, itemsOnCurrentPage) item = ListItem(ListItem.MEDIA_VIDEO_FEATURE_FILM) movie.showOnListItem(item, offset+index) items.append(item) pageCache[currentPage] = items mainList.SetItems(items)
def searchNormal(window, mainList): global currentPage, pageCache, pageSize, maxCount, maxPage g = getGenre() s = getSorting() c = getCategory() offset = currentPage * pageSize items = ListItems() if currentPage in pageCache.keys(): items = pageCache[currentPage] else: status("Fetching page %i" % (currentPage+1)) maxCount, data = voddlerapi.getAPI().browse(pageType, c, g, s, offset, pageSize) maxPage = (maxCount-1) / pageSize if maxPage < 0: maxPage = 0 itemsOnCurrentPage = min(pageSize, maxCount, maxCount - (currentPage*pageSize)) for index, movie in enumerate(data): status("Generating page %i of %i" % (currentPage+1, maxPage+1), index+1, itemsOnCurrentPage) item = ListItem(ListItem.MEDIA_VIDEO_FEATURE_FILM) movie.showOnListItem(item, offset+index) items.append(item) pageCache[currentPage] = items mainList.SetItems(items)
def execute(self, env, path, json_writer): ''' Run the test. :path: Fully qualified test name as a string. For example, ``spec/glsl-1.30/preprocessor/compiler/keywords/void.frag``. ''' def status(msg): log(msg=msg, channel=path) # Run the test if env.execute: try: status("running") time_start = time.time() result = self.run(env) time_end = time.time() if 'time' not in result: result['time'] = time_end - time_start if 'result' not in result: result['result'] = 'fail' if not isinstance(result, TestResult): result = TestResult(result) result['result'] = 'warn' result['note'] = 'Result not returned as an instance ' \ 'of TestResult' except: result = TestResult() result['result'] = 'fail' result['exception'] = str(sys.exc_info()[0]) + \ str(sys.exc_info()[1]) result['traceback'] = \ "".join(traceback.format_tb(sys.exc_info()[2])) status(result['result']) if 'subtest' in result and len(result['subtest'].keys()) > 1: for test in result['subtest'].keys(): result['result'] = result['subtest'][test] json_writer.write_dict_item(os.path.join(path, test), result) else: json_writer.write_dict_item(path, result) else: status("dry-run")
from apkList import * from status import * from apkDecompiler import * from apkRepoMaintainer import * apklist = apkList().apks status = status() apkrepomaintainer = apkRepoMaintainer() apkdecompiler = apkDecompiler() currptr = status.getcurrptr() apk = apklist[currptr] print "prefeching " + apk apkrepomaintainer.prefetch(apk) print "decompiling" apkdecompiler.apktool(apk) apk_package = apkdecompiler.getpackage(apk) apk_entry = apkdecompiler.getentry(apk) apk_name = apkdecompiler.getname(apk) print "apkname: " + apk_name print "apkpackage: " + apk_package print "apkentry: " + apk_entry print "installing" os.popen("adb install ./ApkRepo/" + apk + " 2>/dev/null") #start simplewebcrawler os.system( "adb shell am instrument -e target " + apk_package + " -e task record -w com.liang.simpleappcrawler.test/android.support.test.runner.AndroidJUnitRunner" )