Skip to content

Commit

Permalink
Use the API endpoints with /v1/ prefix
Browse files Browse the repository at this point in the history
To take care of the API v1 backward compatibility guarantee.
  • Loading branch information
ironsmile committed Apr 24, 2021
1 parent 2853de9 commit e2044a1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions httpms.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ def load_upstream_data(self):
self.new_model()

self.cancel_request()
search_url = urllib.parse.urljoin(self.address_base, '/search/')
search_url = urllib.parse.urljoin(self.address_base, '/v1/search/')
print("Loading HTTPMS into the database")
self.loader = Loader()
self.loader.set_headers(self.auth_headers)
Expand All @@ -350,20 +350,20 @@ def add_track(self, db, entry_type, item):
# track_url is the canonical unique URL for this track.
track_url = urllib.parse.urljoin(
self.address_base,
'/file/{}'.format(item['id']),
'/v1/file/{}'.format(item['id']),
)

# play_url is the URL at which this track can be loaded.
# Sometimes this can be different from track_url. For
# example when the URL includes a token or basic auth.
play_url = urllib.parse.urljoin(
self.address_base,
'/file/{}'.format(item['id']),
'/v1/file/{}'.format(item['id']),
)

album_url = urllib.parse.urljoin(
self.address_base,
'/album/{}/artwork'.format(item['album_id']),
'/v1/album/{}/artwork'.format(item['album_id']),
)

if len(self.auth_token) > 0:
Expand Down Expand Up @@ -513,7 +513,7 @@ def try_authenticated(self, remote_url):
username = self.login_entry_user.get_text().strip()
password = self.login_entry_pass.get_text()

login_token_url = urllib.parse.urljoin(remote_url, '/login/token/')
login_token_url = urllib.parse.urljoin(remote_url, '/v1/login/token/')

loader = Loader()
loader.post_url(
Expand Down Expand Up @@ -567,7 +567,7 @@ def register_auth_token(self, token, remote_url):
order to activate the newly received token.
'''
register_token_url = urllib.parse.urljoin(
remote_url, '/register/token/')
remote_url, '/v1/register/token/')

register_token_url = '{}?token={}'.format(register_token_url, token)

Expand Down

0 comments on commit e2044a1

Please sign in to comment.