Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rework wikidata and mb delays #1122

Merged
merged 1 commit into from
Dec 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions nowplaying/artistextras/wikimedia.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@
def _get_page(self, entity, lang):
logging.debug("Processing %s", entity)
try:
page = wptools.page(wikibase=entity, lang=lang, silent=True)
page = wptools.page(wikibase=entity, lang=lang, silent=True, timeout=5)
page.get()
except Exception: # pylint: disable=broad-except
page = None
if self.config.cparser.value('wikimedia/bio_iso_en_fallback',
type=bool) and lang != 'en':
try:
page = wptools.page(wikibase=entity, lang='en', silent=True)
page = wptools.page(wikibase=entity, lang='en', silent=True, timeout=5)

Check warning on line 44 in nowplaying/artistextras/wikimedia.py

View check run for this annotation

Codecov / codecov/patch

nowplaying/artistextras/wikimedia.py#L44

Added line #L44 was not covered by tests
page.get()
except Exception as err: # pylint: disable=broad-except
page = None
Expand Down
6 changes: 3 additions & 3 deletions nowplaying/musicbrainz.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

REMIX_RE = re.compile(r'^\s*(.*)\s+[\(\[].*[\)\]]$')

musicbrainzngs.musicbrainz._max_retries = 1 # pylint: disable=protected-access
musicbrainzngs.musicbrainz._timeout = 30 # pylint: disable=protected-access
musicbrainzngs.musicbrainz._max_retries = 2 # pylint: disable=protected-access
musicbrainzngs.musicbrainz._timeout = 15 # pylint: disable=protected-access
# WNP (typically) has large lulls between 2-3 calls that need to happen
# quickly. so double the rate of calls to speed things up but still
# keep a rate limiter in case the DJ is doing something stupid
Expand All @@ -45,7 +45,7 @@ class MusicBrainzHelper():
''' handler for NowPlaying '''

def __init__(self, config=None):
logging.getLogger('musicbrainzngs').setLevel(logging.CRITICAL + 1)
logging.getLogger('musicbrainzngs').setLevel(logging.INFO)
if config:
self.config = config
else:
Expand Down
Loading