Skip to content

Commit

Permalink
metadata/Music: remove unused external dependency on simplejson
Browse files Browse the repository at this point in the history
The simplejson module was added to the python standard library in 2.6;
here, it is inconsistently imported for python 2.6 (where it already
exists) and lower (where it does not) instead of using `json`.

But, mythtv only supports python 3.8 for a while now. So this
conditional is merely dead code. The import name is still aliased using
`as simplejson`, though, which is bad for visibility and analysis.
  • Loading branch information
eli-schwartz authored and rcrdnalor committed Jan 8, 2024
1 parent 4b5eac8 commit 3588ec0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
5 changes: 2 additions & 3 deletions mythtv/programs/scripts/metadata/Music/lyrics/genius.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from optparse import OptionParser
from common import utilities

import json as simplejson
import json

__author__ = "Paul Harrison and ronie'"
__title__ = "Genius"
Expand Down Expand Up @@ -50,7 +50,7 @@ def get_lyrics(self, lyrics):
return False

req.close()
data = simplejson.loads(response)
data = json.loads(response)

try:
name = data['response']['hits'][0]['result']['primary_artist']['name']
Expand Down Expand Up @@ -198,4 +198,3 @@ def main():

if __name__ == '__main__':
main()

9 changes: 2 additions & 7 deletions mythtv/programs/scripts/metadata/Music/lyrics/lyricswiki.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#-*- coding: UTF-8 -*-

import sys, re, socket
import json, sys, re, socket

try:
from urllib2 import quote, urlopen, HTTPError
Expand All @@ -15,11 +15,6 @@

from optparse import OptionParser

if sys.version_info < (2, 7):
import simplejson
else:
import json as simplejson

from common import *

__author__ = "Paul Harrison and ronie'"
Expand Down Expand Up @@ -49,7 +44,7 @@ def get_lyrics(self, lyrics):
except:
return False
req.close()
data = simplejson.loads(response)
data = json.loads(response)
try:
self.page = data['url']
except:
Expand Down

0 comments on commit 3588ec0

Please sign in to comment.