コード例 #1
0
 def updater(self):
     self.getControl(100).setLabel(self.data['torrentName'])
     import transmission
     while self.updaterFlag:
         data = transmission.get(self.data['transmissionUrl'],
                                 [self.data['hashString']])[0]
         if data['percentDone'] == 1:
             break
         eta = 'Unknown'
         if data['eta'] > 0:
             eta = time.strftime('%H:%M:%S', time.gmtime(data['eta']))
         completed = util.color('Completed: ', 'blue') + str(
             int(float(data['percentDone']) * 100)) + '%'
         completed = completed + '     ' + util.color(
             'Remaining Time: ', 'blue') + eta
         self.getControl(110).setLabel(completed)
         details = util.color('Size: ', 'blue') + str(
             round((float(data["totalSize"]) /
                    (1024 * 1024 * 1024)), 2)) + 'Gb'
         details = details + '     ' + util.color('Seeds: ', 'blue') + str(
             data['peersSendingToUs'])
         details = details + '     ' + util.color('Rate: ', 'blue') + str(
             round(
                 (float(data["rateDownload"]) / (1024 * 1024)), 2)) + 'Mbps'
         self.getControl(111).setLabel(details)
         time.sleep(self.updaterDelay)
     self.close()
コード例 #2
0
ファイル: event.py プロジェクト: lmanul/sak
 def get_displayed_time(self, d, timezone="UTC"):
     color = "dim" if is_past(d) else "white"
     tz = timezones.TIMEZONES[timezone]
     d_with_tz = d.astimezone(pytz.timezone(tz))
     return util.color(str(d_with_tz.hour).zfill(2) + ":"
                       "" + str(d_with_tz.minute).zfill(2),
                       color)
コード例 #3
0
ファイル: menu.py プロジェクト: herooutman/Kanraoke
	def start(self):
		while True:
			with color("blue"):
				print "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
				print  """        __ __                             __      """
				print  """       / //_/___ _____  _________ _____  / /_____ """
				print  """      / ,< / __ `/ __ \/ ___/ __ `/ __ \/ //_/ _ \\"""
				print  """     / /| / /_/ / / / / /  / /_/ / /_/ / ,< /  __/"""
				print  """    /_/ |_\__,_/_/ /_/_/   \__,_/\____/_/|_|\___/ """
				print  """                                                  """
				print
			with color('yellow'):
				print "输入首字母搜索   (B)浏览歌曲   (V)原唱/伴唱   (N)下一首   (P)暂停/继续"
			print "\n\n\n\n"
			cmd = readline("Kanraoke > ")
			cmd = cmd.strip()
			if cmd:
				if cmd == "quit" or cmd == "q":
					break
				else:
					self._process_cmd(cmd)
コード例 #4
0
def pretty_print_single_day(events,
                            filter_method,
                            title,
                            color,
                            timezone="UTC"):
    events = [e for e in events if filter_method(e.start, timezone)]
    if len(events):
        print(util.color(title + "\n" + ("-" * len(title)), color))
    for e in events:
        e.print(timezone)
    if len(events):
        print("")
コード例 #5
0
 def start(self):
     while True:
         with color("blue"):
             print "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
             print """        __ __                             __      """
             print """       / //_/___ _____  _________ _____  / /_____ """
             print """      / ,< / __ `/ __ \/ ___/ __ `/ __ \/ //_/ _ \\"""
             print """     / /| / /_/ / / / / /  / /_/ / /_/ / ,< /  __/"""
             print """    /_/ |_\__,_/_/ /_/_/   \__,_/\____/_/|_|\___/ """
             print """                                                  """
             print
         with color('yellow'):
             print "输入首字母搜索   (B)浏览歌曲   (V)原唱/伴唱   (N)下一首   (P)暂停/继续"
         print "\n\n\n\n"
         cmd = readline("Kanraoke > ")
         cmd = cmd.strip()
         if cmd:
             if cmd == "quit" or cmd == "q":
                 break
             else:
                 self._process_cmd(cmd)
コード例 #6
0
ファイル: event.py プロジェクト: lmanul/sak
def format_timedelta(minutes, prefix, suffix, highlight_color):
    color = "white"
    prefix = "(" + prefix + " "
    suffix = suffix + ")"
    if minutes > 24 * 60:
        color = "dim"
        infix = "> 1 day"
    elif minutes > 60:
        hours = int(minutes / 60)
        remaining_minutes = minutes - hours * 60
        infix = str(hours) + " h " + str(remaining_minutes) + " mn"
    elif minutes < 60:
        infix = str(minutes) + " mn"
        if minutes < 30:
            color = highlight_color
    else:
        infix = str(minutes) + " mn"
    return util.color(prefix + infix + suffix, color)
コード例 #7
0
def listPlaylists(content):
    xbmcplugin.setContent(_handleId, 'movies')
    for data in content:
        name = data["name"] + ' [' + str(data["count"]) + ']'
        if data['privacy'] == 'Private':
            name = util.color(name, 'orange')
        item = xbmcgui.ListItem(name)
        item.setArt({
            'thumb': data["thumb"],
            'poster': data["thumb"],
            'fanart': data["thumb"]
        })
        item.setProperty("IsPlayable", "false")
        params = {'handler': 'PlaylistVideos', 'id': data["id"]}
        xbmcplugin.addDirectoryItem(handle=_handleId,
                                    url=_baseUrl + '?' +
                                    urllib.urlencode(params),
                                    isFolder=True,
                                    listitem=item)
コード例 #8
0
 def _select(self, selection, t, param):
     if t == "song":
         song = selection
         if song and util.add_to_playlist(self.player, song):
             with color('yellow'):
                 sys.stdout.write("\nSong added: ")
                 Library.display_song(song)
                 print
                 sleep(.5)
         else:
             print "Song not found!"
     elif t == "artist":
         artist = selection
         if artist:
             aid = artist["id"]
             songs = self.lib.get_song_by_artist(aid)
             return self.display_list(songs, "song")
     elif t == "menu":
         if selection:
             return selection[1](param)
コード例 #9
0
ファイル: menu.py プロジェクト: herooutman/Kanraoke
	def _select(self, selection, t, param):
		if t == "song":
			song = selection
			if song and util.add_to_playlist(self.player, song):
				with color('yellow'):
					sys.stdout.write("\nSong added: ")
					Library.display_song(song)
					print
					sleep(.5)
			else:
				print "Song not found!"
		elif t == "artist":
			artist = selection
			if artist:
				aid = artist["id"]
				songs = self.lib.get_song_by_artist(aid)
				return self.display_list(songs, "song")
		elif t == "menu":
			if selection:
				return selection[1](param)
コード例 #10
0
ファイル: database.py プロジェクト: DevMTBZ/byob
    def __init__(self, **kwargs):

        """
        connect to MySQL and setup the BYOB database

            kwargs:

                host        hostname/IP address of MySQL host machine
                            
                user        authorized account username
                    
                password    authorized account password

        """
        super(Database, self).__init__(**kwargs)
        self.config(**kwargs)
        self.logger = util.logger()
        self.tasks  = {}
        self._debug = debug
        self._query = self.cursor(dictionary=True)
        self._queue = Queue.Queue()
        self._color = util.color()
        self._setup(setup)
コード例 #11
0
ファイル: main.py プロジェクト: sblagodatny/kodiplus
def listAlbums(albums):
    for data in albums:
        name = data["name"] + ' [' + str(data['photosCount']) + ']'
        if data['owner'] == 'Stas Blagodatny':  ## Change to dynamic
            if data['sharedKey'] is not None:
                name = util.color(name, 'orange')
        else:
            name = name + ' (' + data['owner'] + ')'
        item = xbmcgui.ListItem(name)
        item.setArt({
            'thumb': data["thumb"],
            'poster': data["thumb"],
            'fanart': data["thumb"]
        })
        params = {
            'handler': 'ListAlbum',
            'id': data["id"],
            'sharedKey': data['sharedKey']
        }
        xbmcplugin.addDirectoryItem(handle=_handleId,
                                    url=_baseUrl + '?' +
                                    urllib.urlencode(params),
                                    isFolder=True,
                                    listitem=item)
コード例 #12
0
 def display_list(self, l, operation_type, param=None):
     if l:
         size = len(l)
         max_page = int(math.ceil(size / 10.0))
         page = 0
         to_main = False
         while not to_main:
             if operation_type == "menu":
                 print "===================="
             else:
                 print "\n" * 50 + "========= PAGE: %d/%d ===========" % (
                     page + 1, max_page)
             for i in range(10):
                 if page * 10 + i >= size:
                     break
                 item = l[page * 10 + i]
                 prefix = i + 1 if i < 9 else 0
                 if operation_type == "song":
                     Library.display_song(item, prefix)
                 elif operation_type == "artist":
                     Library.display_artist(item, prefix)
                 elif operation_type == "menu":
                     Menu.display_menu(item, prefix)
             print "===================="
             print "(Nums)选择   (N)下一页   (P)上一页   (B)后退   (M)主菜单\n"
             valid_selection = False
             sys.stdout.write("please select > ")
             while not valid_selection:
                 select = getch()
                 if select == "b":
                     return
                 if select == "m":
                     return True
                 elif select == "n":
                     new_page = min(page + 1, max_page - 1)
                     if page != new_page:
                         page = new_page
                         valid_selection = True
                     continue
                 elif select == "p":
                     new_page = max(page - 1, 0)
                     if page != new_page:
                         page = new_page
                         valid_selection = True
                     continue
                 elif select.isdigit():
                     choice_str = select
                     select = int(select)
                     select = select - 1 if select > 0 else 9
                     idx = page * 10 + select
                     if idx < size:
                         res = l[idx]
                         print choice_str
                         to_main = self._select(res, operation_type, param)
                         valid_selection = True
                     else:
                         continue
                 else:
                     pass
         return True
     else:
         with color("pink"):
             print "\n"
             print "\tMMMMMMMMMMMMMMMMMMMMMWNK0kxdooooooodxk0XNWMMMMMMMMMMMMMMMMMM"
             print "\tMMMMMMMMMMMMMMMWWNKkoc;'...............,:lx0NWMMMMMMMMMMMMMM"
             print "\tMMMMMMMMMMMMWNX0d:'.........................;lkXWMMMMMMMMMMM"
             print "\tMMMMMMMMMMWNKkl,........,:clodddddooc:,'.......;d0WMMMMMMMMM"
             print "\tMMMMMMMMWXKkc'......;ldOKXXXXXXXXXXXXXKOxl;......'l0WMMMMMMM"
             print "\tMMMMMMWXKOo'.....'lkKXXXXXXXXXXXXXXXXXXXXXKko;.....,dXMMMMMM"
             print "\tMMMMWNX0k:.....,oOXXXXXXXXXXXXXXXXK0KXXXXXXXX0d;.....:0WMMMM"
             print "\tMMMWNK0x;.....cOXXXXXXK00XXXXXXXKx:':xKXXXXXXXX0o,....,kWMMM"
             print "\tMMMNKKk;....'oKXXXXXXKo,,lOXXXNX0l....:xKXXXXXXXXk:....'xWMM"
             print "\tMMNKKO:....'dKXXXXXXKo...,xXXXXXXKx;....:kKXXXXXXXOc....,OWM"
             print "\tMWKK0o.....oKXXXXXX0l...'dKXXXXXXXX0l'....ckKXXXXXXO:....:KM"
             print "\tWXKKk;....:0XXXXXX0c....lKXXXXXXXXXXKk:....'oKXXXXXXk,....dN"
             print "\tWXKKd'....dXXXXXXO:....c0XXXXXXXXXXXXX0o,..'xXXXXXXXKl....:K"
             print "\tNKK0l....,kXXXXXXOc...;OXXXXXXXXXXXXXXXXOc;dKXXXXXXXXx'...'k"
             print "\tNKK0l....;OXXXXXXX0d,,xXXXXXXXXXXXXXXXXXXK0XXXXXXXXXXk;....d"
             print "\tNKK0l....;OXXXXXXXXXOOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXO;....o"
             print "\tNKK0o....'xXXXXXXXXXXXXXXXXXKKK00OOkkxddollclkXXXXXXXk,....d"
             print "\tWKKKx,....lKXXXXXXXOdoollc::;,,,''..........'xXXXXXXXd....'k"
             print "\tWXKKOc....;kXXXXXXXx'.......................;OXXXXXX0:....:K"
             print "\tMNKK0x,....c0XXXXXXKl.....';::ccllloddc.....lKXXXXXKd.....xW"
             print "\tMWXKK0l.....l0XXXXXXk,....l0XXXXXXXXXXx'....dXXXXXXx,....cXM"
             print "\tMMWXKKOc.....cOXXXXXKo....;OXXXXXXXXXXx'...,kXXXXKd,....;0WM"
             print "\tMMMWXKKOl.....;xKXXXXO:....dXXXXXXXXXXd....:0XXX0l'....;OWMM"
             print "\tMMMMWXKK0o'.....ckKXXXd'...:0XXXXXXXXXd....lKX0d;.....:0WMMM"
             print "\tMMMMMWNKK0x:......:d0X0c...'dXXXXXXXXXo...'dOo;.....'oXMMMMM"
             print "\tMMMMMMMWNKKOd;......,cdl'...c0XXXXXXXXo....,'......c0WMMMMMM"
             print "\tMMMMMMMMMWXKKOd:............'lxxkkxxdl;.........'lONMMMMMMMM"
             print "\tMMMMMMMMMMMWNXK0xl;..........................':dKWMMMMMMMMMM"
             print "\tMMMMMMMMMMMMMMWNXX0koc;'.................':lxKNMMMMMMMMMMMMM"
             print "\tMMMMMMMMMMMMMMMMMWWNNXKOkdolc:::::cclodkOXNWMMMMMMMMMMMMMMMM"
             print "\tMMMMMMMMMMMMMMMMMMMMMMMWWWWWNNNNNNWWMMMMMMMMMMMMMMMMMMMMMMMM"
             print "\n"
         getch(
             "It seems your query does not match any record in our library, press ENTER to continue...  "
         )
         return
コード例 #13
0
def discard2str(player_idx, card_idx, card):
    string = 'Player {} discards card [{}], a {} {}'.format(player_idx, card_idx, util.color(card), util.number(card))
    return string
コード例 #14
0
ファイル: history.py プロジェクト: andrew12/python-coinroll
parser.add_argument('user')
parser.add_argument('password')
args = parser.parse_args()

api = coinroll.Coinroll(args.user, args.password)
bets = float('inf')
offset = 0
profit = 0

print('number | amount     | lucky < less  | diff        | profit')

try:
  while offset < bets:
    offset += 5

    if offset > bets:
      offset = bets

    r = api.bets(offset)
    bets = r.count

    for bet in reversed(r.bets):
      diff = bet.diff
      profit += diff

      print('{:6d} | {:.8f} | {} < {:5d} | {} | {}'.format(bet.num, bet.amount,
        color(diff, bet.lucky, '5d'), bet.lessthan, color(diff), color(profit)))

except KeyboardInterrupt:
  pass
コード例 #15
0
import coinroll
from util import color

from decimal import Decimal
from collections import defaultdict

profits = defaultdict(Decimal)

seen = set()

print('user           | bet          | amount     | lucky < less  | '
      'diff        | profit')

try:
    while True:
        for bet in coinroll.livebets().data:
            if bet.id not in seen:
                seen.add(bet.id)

                profits[bet.user] += bet.diff

                print('{} | {} | {:.8f} | {} < {:5d} | {} | {}'.format(
                    bet.user, bet.id, bet.amount,
                    color(bet.diff, bet.lucky, '5d'), bet.lessthan,
                    color(bet.diff), color(profits[bet.user])))

except KeyboardInterrupt:
    pass
コード例 #16
0
def card2string(card):
    return '{0: >6} {1}'.format(util.color(card), util.number(card))
コード例 #17
0
def card_dealt2str(player_idx, card):
    string = 'A {} {} is dealt to Player {}'.format(util.color(card), util.number(card), player_idx)
    return string
コード例 #18
0
def invalid_play2str(card):
    string = 'A {} {} is not playable, fuse reduced'.format(util.color(card), util.number(card))
    return string
コード例 #19
0
parser.add_argument('password')
args = parser.parse_args()

api = coinroll.Coinroll(args.user, args.password)
bets = float('inf')
offset = 0
profit = 0

print('number | amount     | lucky < less  | diff        | profit')

try:
    while offset < bets:
        offset += 5

        if offset > bets:
            offset = bets

        r = api.bets(offset)
        bets = r.count

        for bet in reversed(r.bets):
            diff = bet.diff
            profit += diff

            print('{:6d} | {:.8f} | {} < {:5d} | {} | {}'.format(
                bet.num, bet.amount, color(diff, bet.lucky, '5d'),
                bet.lessthan, color(diff), color(profit)))

except KeyboardInterrupt:
    pass
コード例 #20
0
ファイル: gui.py プロジェクト: sblagodatny/kodiplus
 def select(self, item):
     item.setLabel(util.color(util.bold(item.getLabel()), 'orange'))
コード例 #21
0
ファイル: event.py プロジェクト: lmanul/sak
 def get_displayed_text(self):
     color = "white"
     if is_past(self.start) and is_past(self.end):
         color = "dim"
     return util.color(self.text, color)
コード例 #22
0
ファイル: fibonacci.py プロジェクト: andrew12/python-coinroll
this = r.balance
index = 0

print('balance    | amount     | lucky < less  | diff        | profit')

try:
  while True:
    amount = seq[index] * base
    
    if r.balance < amount or r.balance >= args.target or args.max < amount:
      break
    
    r = bot.bet(lessthan, amount)

    print('{:.8f} | {:.8f} | {} < {:5d} | {} | {} | {}'.format(r.balance,
      r.amount, color(r.diff, r.lucky, '5d'), r.lessthan, color(r.diff),
      color(r.profit), color(r.balance - this)))

    if r.win:
      index -= 2

      if index < 0:
        index = 0

    else:
      index += 1
      
      if len(seq) <= index:
        seq.append(seq[-2] + seq[-1])

except KeyboardInterrupt:
コード例 #23
0
ファイル: menu.py プロジェクト: herooutman/Kanraoke
	def display_list(self, l, operation_type, param=None):
		if l:
			size = len(l)
			max_page = int(math.ceil(size / 10.0))
			page = 0
			to_main = False
			while not to_main:
				if operation_type == "menu":
					print "===================="
				else:
					print "\n"*50+"========= PAGE: %d/%d ===========" % (page+1, max_page)
				for i in range(10):
					if page * 10 + i >= size:
						break
					item = l[page * 10 + i]
					prefix = i + 1 if i < 9 else 0
					if operation_type == "song":
						Library.display_song(item, prefix)
					elif operation_type == "artist":
						Library.display_artist(item, prefix)
					elif operation_type == "menu":
						Menu.display_menu(item, prefix)
				print "===================="
				print "(Nums)选择   (N)下一页   (P)上一页   (B)后退   (M)主菜单\n"
				valid_selection = False
				sys.stdout.write("please select > ")
				while not valid_selection:
					select = getch()
					if select == "b":
						return
					if select == "m":
						return True
					elif select == "n":
						new_page = min(page + 1, max_page - 1)
						if page != new_page:
							page = new_page
							valid_selection = True
						continue
					elif select == "p":
						new_page = max(page - 1, 0)
						if page != new_page:
							page = new_page
							valid_selection = True
						continue
					elif select.isdigit():
						choice_str = select
						select = int(select)
						select = select - 1 if select > 0 else 9
						idx = page * 10 + select
						if idx < size:
							res = l[idx]
							print choice_str
							to_main = self._select(res, operation_type, param)
							valid_selection = True
						else:
							continue
					else:
						pass
			return True
		else:
			with color("pink"):
				print "\n"
				print "\tMMMMMMMMMMMMMMMMMMMMMWNK0kxdooooooodxk0XNWMMMMMMMMMMMMMMMMMM"
				print "\tMMMMMMMMMMMMMMMWWNKkoc;'...............,:lx0NWMMMMMMMMMMMMMM"
				print "\tMMMMMMMMMMMMWNX0d:'.........................;lkXWMMMMMMMMMMM"
				print "\tMMMMMMMMMMWNKkl,........,:clodddddooc:,'.......;d0WMMMMMMMMM"
				print "\tMMMMMMMMWXKkc'......;ldOKXXXXXXXXXXXXXKOxl;......'l0WMMMMMMM"
				print "\tMMMMMMWXKOo'.....'lkKXXXXXXXXXXXXXXXXXXXXXKko;.....,dXMMMMMM"
				print "\tMMMMWNX0k:.....,oOXXXXXXXXXXXXXXXXK0KXXXXXXXX0d;.....:0WMMMM"
				print "\tMMMWNK0x;.....cOXXXXXXK00XXXXXXXKx:':xKXXXXXXXX0o,....,kWMMM"
				print "\tMMMNKKk;....'oKXXXXXXKo,,lOXXXNX0l....:xKXXXXXXXXk:....'xWMM"
				print "\tMMNKKO:....'dKXXXXXXKo...,xXXXXXXKx;....:kKXXXXXXXOc....,OWM"
				print "\tMWKK0o.....oKXXXXXX0l...'dKXXXXXXXX0l'....ckKXXXXXXO:....:KM"
				print "\tWXKKk;....:0XXXXXX0c....lKXXXXXXXXXXKk:....'oKXXXXXXk,....dN"
				print "\tWXKKd'....dXXXXXXO:....c0XXXXXXXXXXXXX0o,..'xXXXXXXXKl....:K"
				print "\tNKK0l....,kXXXXXXOc...;OXXXXXXXXXXXXXXXXOc;dKXXXXXXXXx'...'k"
				print "\tNKK0l....;OXXXXXXX0d,,xXXXXXXXXXXXXXXXXXXK0XXXXXXXXXXk;....d"
				print "\tNKK0l....;OXXXXXXXXXOOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXO;....o"
				print "\tNKK0o....'xXXXXXXXXXXXXXXXXXKKK00OOkkxddollclkXXXXXXXk,....d"
				print "\tWKKKx,....lKXXXXXXXOdoollc::;,,,''..........'xXXXXXXXd....'k"
				print "\tWXKKOc....;kXXXXXXXx'.......................;OXXXXXX0:....:K"
				print "\tMNKK0x,....c0XXXXXXKl.....';::ccllloddc.....lKXXXXXKd.....xW"
				print "\tMWXKK0l.....l0XXXXXXk,....l0XXXXXXXXXXx'....dXXXXXXx,....cXM"
				print "\tMMWXKKOc.....cOXXXXXKo....;OXXXXXXXXXXx'...,kXXXXKd,....;0WM"
				print "\tMMMWXKKOl.....;xKXXXXO:....dXXXXXXXXXXd....:0XXX0l'....;OWMM"
				print "\tMMMMWXKK0o'.....ckKXXXd'...:0XXXXXXXXXd....lKX0d;.....:0WMMM"
				print "\tMMMMMWNKK0x:......:d0X0c...'dXXXXXXXXXo...'dOo;.....'oXMMMMM"
				print "\tMMMMMMMWNKKOd;......,cdl'...c0XXXXXXXXo....,'......c0WMMMMMM"
				print "\tMMMMMMMMMWXKKOd:............'lxxkkxxdl;.........'lONMMMMMMMM"
				print "\tMMMMMMMMMMMWNXK0xl;..........................':dKWMMMMMMMMMM"
				print "\tMMMMMMMMMMMMMMWNXX0koc;'.................':lxKNMMMMMMMMMMMMM"
				print "\tMMMMMMMMMMMMMMMMMWWNNXKOkdolc:::::cclodkOXNWMMMMMMMMMMMMMMMM"
				print "\tMMMMMMMMMMMMMMMMMMMMMMMWWWWWNNNNNNWWMMMMMMMMMMMMMMMMMMMMMMMM"
				print "\n"
			getch("It seems your query does not match any record in our library, press ENTER to continue...  ")
			return
コード例 #24
0
ファイル: output.py プロジェクト: MirServer/wayland-debug
 def unprocessed(self, *msg):
     if self.show_unprocessed:
         self.show(
             color('37',
                   ' ' * 6 + ' |  ' + ' '.join(map(lambda m: str(m), msg))))
コード例 #25
0
print('balance    | amount     | lucky < less  | diff        | profit')

try:
  while len(seq) > 0:
    size = seq[0]
    
    if len(seq) > 1:
      size += seq[-1]
    
    amount = size * base
    
    if r.balance <= amount or args.max < amount:
      break
    
    r = bot.bet(lessthan, amount)

    print('{:.8f} | {:.8f} | {} < {:5d} | {} | {}'.format(r.balance, r.amount,
      color(r.diff, r.lucky, '5d'), r.lessthan, color(r.diff), color(r.profit)))

    if r.win:
      seq.pop(0)
      
      if len(seq) > 0:
        seq.pop()

    else:
      seq.append(size)

except KeyboardInterrupt:
  pass
コード例 #26
0
bot = coinroll.Coinroll(args.user, args.password)
r = bot.stats()
game = coinroll.gameinfo(args.lessthan)
start = args.start or game.minbet
amount = start

loses = 0

print('balance    | amount     | lucky < less  | diff        | profit')

try:
    while amount <= r.balance < args.target and amount <= args.max:
        r = bot.bet(args.lessthan, amount)

        print('{:.8f} | {:.8f} | {} < {:5d} | {} | {} | {}'.format(
            r.balance, r.amount, color(r.diff, r.lucky, '5d'), r.lessthan,
            color(r.diff), color(r.profit)))

        if r.win:
            amount = start
            loses = 0

        else:
            loses += 1

            if loses % args.interval == 0:
                amount *= args.multiplier

                if args.add:
                    amount += start
コード例 #27
0
ファイル: output.py プロジェクト: MirServer/wayland-debug
 def log(self, *msg):
     if self.verbose:
         self.out.write(
             color('37', 'wl log: ') + ' '.join(map(lambda m: str(m), msg)))
コード例 #28
0
ファイル: output.py プロジェクト: MirServer/wayland-debug
 def warn(self, *msg):
     self.err.write(
         color('1;33', 'Warning: ') + ' '.join(map(lambda m: str(m), msg)))
コード例 #29
0
ファイル: output.py プロジェクト: MirServer/wayland-debug
 def error(self, *msg):
     self.err.write(
         color('1;31', 'Error: ') + ' '.join(map(lambda m: str(m), msg)))
コード例 #30
0
ファイル: livebets.py プロジェクト: andrew12/python-coinroll
import coinroll
from util import color

from decimal import Decimal
from collections import defaultdict

profits = defaultdict(Decimal)

seen = set()

print('user           | bet          | amount     | lucky < less  | '
      'diff        | profit')

try:
  while True:
    for bet in coinroll.livebets().data:
      if bet.id not in seen:
        seen.add(bet.id)
    
        profits[bet.user] += bet.diff

        print('{} | {} | {:.8f} | {} < {:5d} | {} | {}'.format(bet.user, bet.id,
          bet.amount, color(bet.diff, bet.lucky, '5d'), bet.lessthan,
          color(bet.diff), color(profits[bet.user])))

except KeyboardInterrupt:
  pass
コード例 #31
0
ファイル: install.py プロジェクト: andbass/dotfiles
#!/usr/bin/env python3

import dotfiles
import util
import shutil
import os

from pathlib import Path

util.initialize(Path(__file__).parent)

modules = dotfiles.Module.__subclasses__()
for i, module in enumerate(modules):
    progress = "({} out of {})".format(i + 1, len(modules))

    module_name = util.color(module.__name__, util.Color.green)
    module_source = util.color(module.__module__, util.Color.yellow)

    print("Installing module", module_name, "from", module_source, progress)
    instance = module()

    for message in instance.install():
        print(util.timestamp(message))

    print("Copying over files from module", module_name)

    default_path = Path(os.path.expanduser(module.default_dest))
    module_path = Path(module.__module__)
    valid_file_paths = [path for path in module_path.glob("*") if util.validate_path(path)]

    for path in valid_file_paths: