mirror of
https://github.com/SoongNoonien/mpdevil.git
synced 2023-08-10 21:12:44 +03:00
removed requests dependency
This commit is contained in:
parent
1ca4761d75
commit
0c6fc5ac19
@ -59,7 +59,6 @@ Dependencies:
|
|||||||
Python modules:
|
Python modules:
|
||||||
- mpd (python-mpd2 >=1.1)
|
- mpd (python-mpd2 >=1.1)
|
||||||
- gi (Gtk, Gio, Gdk, GdkPixbuf, Pango, GObject, GLib)
|
- gi (Gtk, Gio, Gdk, GdkPixbuf, Pango, GObject, GLib)
|
||||||
- requests
|
|
||||||
- bs4 (beautifulsoup)
|
- bs4 (beautifulsoup)
|
||||||
|
|
||||||
Run:
|
Run:
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
beautifulsoup4
|
beautifulsoup4
|
||||||
requests
|
|
||||||
python-mpd2 >=1.1
|
python-mpd2 >=1.1
|
||||||
PyGObject
|
PyGObject
|
||||||
|
@ -21,8 +21,8 @@ import gi
|
|||||||
gi.require_version("Gtk", "3.0")
|
gi.require_version("Gtk", "3.0")
|
||||||
from gi.repository import Gtk, Gio, Gdk, GdkPixbuf, Pango, GObject, GLib
|
from gi.repository import Gtk, Gio, Gdk, GdkPixbuf, Pango, GObject, GLib
|
||||||
from mpd import MPDClient, base as MPDBase
|
from mpd import MPDClient, base as MPDBase
|
||||||
import requests
|
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
|
import urllib
|
||||||
import threading
|
import threading
|
||||||
import functools
|
import functools
|
||||||
import itertools
|
import itertools
|
||||||
@ -2780,8 +2780,8 @@ class LyricsWindow(Gtk.ScrolledWindow):
|
|||||||
for char1, char2 in replaces:
|
for char1, char2 in replaces:
|
||||||
title=title.replace(char1, char2)
|
title=title.replace(char1, char2)
|
||||||
artist=artist.replace(char1, char2)
|
artist=artist.replace(char1, char2)
|
||||||
req=requests.get(f"https://www.letras.mus.br/winamp.php?musica={title}&artista={artist}")
|
with urllib.request.urlopen(f"https://www.letras.mus.br/winamp.php?musica={title}&artista={artist}") as response:
|
||||||
soup=BeautifulSoup(req.text, "html.parser")
|
soup=BeautifulSoup(response.read(), "html.parser")
|
||||||
soup=soup.find(id="letra-cnt")
|
soup=soup.find(id="letra-cnt")
|
||||||
if soup is None:
|
if soup is None:
|
||||||
raise ValueError("Not found")
|
raise ValueError("Not found")
|
||||||
@ -2801,7 +2801,7 @@ class LyricsWindow(Gtk.ScrolledWindow):
|
|||||||
idle_add(self._text_buffer.set_text, _("searching…"), -1)
|
idle_add(self._text_buffer.set_text, _("searching…"), -1)
|
||||||
try:
|
try:
|
||||||
text=self._get_lyrics(current_song["title"][0], current_song["artist"][0])
|
text=self._get_lyrics(current_song["title"][0], current_song["artist"][0])
|
||||||
except requests.exceptions.ConnectionError:
|
except urllib.error.URLError:
|
||||||
self._displayed_song_file=None
|
self._displayed_song_file=None
|
||||||
text=_("connection error")
|
text=_("connection error")
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
Loading…
Reference in New Issue
Block a user