Skip to content
This repository was archived by the owner on Jan 4, 2021. It is now read-only.

Commit d2d3f6e

Browse files
author
totokaka
committed
Fixes #5
1 parent b23d304 commit d2d3f6e

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

mcman/backend/common.py

-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ def download(url, destination=None, checksum=None, prefix='',
100100
term_width = get_term_width()
101101
pprefix = prefix + display_name
102102
progress = create_progress_bar(prefix=pprefix, width=term_width)
103-
print(urlretrieve)
104103
urlretrieve(url, filename=destination, reporthook=progress)
105104

106105
if checksum is not None and len(checksum) > 0:

mcman/backend/servers.py

+13
Original file line numberDiff line numberDiff line change
@@ -159,3 +159,16 @@ def find_latest_build(build_list):
159159
version = spacegdn.versions(version=build['version_id'])[0]['version']
160160

161161
return channel, version, build
162+
163+
164+
def find_newest(server, channel):
165+
""" Find the newest version and build in a channel.
166+
167+
Returns a tuple with the version name and build number.
168+
"""
169+
channel_id = spacegdn.get_id(jar=server, channel=channel)
170+
result = spacegdn.builds(channel=channel_id)
171+
172+
channel, version, build = find_latest_build(result)
173+
174+
return version, build['build']

mcman/frontend/servers_command.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,19 @@ def identify(self):
103103
self.p_main('Found no build on SpaceGDN with matching checksum')
104104
return
105105

106-
server, channel, version, build = backend.get_roots(build)
106+
server, channel, version, build_num = backend.get_roots(build)
107+
108+
self.p_main('Checking for updates in channel')
109+
110+
new_version, new_build = backend.find_newest(server, channel)
111+
appendix = ''
112+
if new_build > build_num:
113+
appendix = ' -- Out of date. Newest build: {} {}'.format(
114+
new_version, new_build)
107115

108116
self.result('Found build:', '{} {} {} {}'.format(server, channel,
109-
version, build))
117+
version, build_num)
118+
+ appendix)
110119

111120
def download(self):
112121
""" Download a server. """

0 commit comments

Comments
 (0)