From 69d58eede2e9bf83aa1ed1d8fcf956efde494726 Mon Sep 17 00:00:00 2001 From: jesopo Date: Wed, 3 Oct 2018 13:22:37 +0100 Subject: Move src/Utils.py in to src/utils/, splitting functionality out in to modules of related functionality --- modules/lastfm.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'modules/lastfm.py') diff --git a/modules/lastfm.py b/modules/lastfm.py index 8febe3c0..31cf1cfd 100644 --- a/modules/lastfm.py +++ b/modules/lastfm.py @@ -1,15 +1,15 @@ #--require-config lastfm-api-key from datetime import datetime, timezone -from src import ModuleManager, Utils +from src import ModuleManager, utils URL_SCROBBLER = "http://ws.audioscrobbler.com/2.0/" -@Utils.export("set", {"setting": "lastfm", "help": "Set last.fm username"}) +@utils.export("set", {"setting": "lastfm", "help": "Set last.fm username"}) class Module(ModuleManager.BaseModule): _name = "last.fm" - @Utils.hook("received.command.np|listening|nowplaying") + @utils.hook("received.command.np|listening|nowplaying") def np(self, event): """ :help: Get the last listened to track from a user @@ -22,7 +22,7 @@ class Module(ModuleManager.BaseModule): lastfm_username = event["user"].get_setting("lastfm", event["user"].nickname) shown_username = event["user"].nickname - page = Utils.get_url(URL_SCROBBLER, get_params={ + page = utils.http.get_url(URL_SCROBBLER, get_params={ "method": "user.getrecenttracks", "user": lastfm_username, "api_key": self.bot.config["lastfm-api-key"], "format": "json", "limit": "1"}, json=True) @@ -51,7 +51,7 @@ class Module(ModuleManager.BaseModule): short_url = " -- " + short_url if short_url else "" - info_page = Utils.get_url(URL_SCROBBLER, get_params={ + info_page = utils.http.get_url(URL_SCROBBLER, get_params={ "method": "track.getInfo", "artist": artist, "track": track_name, "autocorrect": "1", "api_key": self.bot.config["lastfm-api-key"], -- cgit v1.3.1-10-gc9f91