commit lollypop for openSUSE:Factory
Hello community, here is the log from the commit of package lollypop for openSUSE:Factory checked in at 2019-07-29 17:31:23 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/lollypop (Old) and /work/SRC/openSUSE:Factory/.lollypop.new.4126 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "lollypop" Mon Jul 29 17:31:23 2019 rev:93 rq:719508 version:1.1.4.7 Changes: -------- --- /work/SRC/openSUSE:Factory/lollypop/lollypop.changes 2019-07-28 10:22:30.364568104 +0200 +++ /work/SRC/openSUSE:Factory/.lollypop.new.4126/lollypop.changes 2019-07-29 17:31:23.790171894 +0200 @@ -1,0 +2,6 @@ +Mon Jul 29 07:59:11 UTC 2019 - antoine.belvire@opensuse.org + +- Update to version 1.1.4.7: + * Remove python-wikipedia dependency. + +------------------------------------------------------------------- Old: ---- lollypop-1.1.4.6.tar.xz New: ---- lollypop-1.1.4.7.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ lollypop.spec ++++++ --- /var/tmp/diff_new_pack.WqHCiU/_old 2019-07-29 17:31:24.386171172 +0200 +++ /var/tmp/diff_new_pack.WqHCiU/_new 2019-07-29 17:31:24.390171168 +0200 @@ -17,7 +17,7 @@ Name: lollypop -Version: 1.1.4.6 +Version: 1.1.4.7 Release: 0 Summary: GNOME music playing application License: GPL-3.0-or-later @@ -43,7 +43,6 @@ Requires: python3-pylast Recommends: easytag Recommends: kid3-cli -Recommends: python3-wikipedia Recommends: youtube-dl Suggests: python3-textblob BuildArch: noarch ++++++ _service ++++++ --- /var/tmp/diff_new_pack.WqHCiU/_old 2019-07-29 17:31:24.422171129 +0200 +++ /var/tmp/diff_new_pack.WqHCiU/_new 2019-07-29 17:31:24.422171129 +0200 @@ -1,7 +1,7 @@ <services> <service mode="disabled" name="tar_scm"> <param name="changesgenerate">enable</param> - <param name="revision">1.1.4.6</param> + <param name="revision">1.1.4.7</param> <param name="scm">git</param> <param name="url">https://gitlab.gnome.org/World/lollypop.git</param> <param name="versionformat">@PARENT_TAG@</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.WqHCiU/_old 2019-07-29 17:31:24.446171100 +0200 +++ /var/tmp/diff_new_pack.WqHCiU/_new 2019-07-29 17:31:24.450171095 +0200 @@ -1,4 +1,4 @@ <servicedata> <service name="tar_scm"> <param name="url">https://gitlab.gnome.org/World/lollypop.git</param> - <param name="changesrevision">38e00b1bfa3aec92bd423c7cda950516e3fde8ac</param></service></servicedata> \ No newline at end of file + <param name="changesrevision">81067cb0ffbd2c3505ccaab47ab7e70879c25ead</param></service></servicedata> \ No newline at end of file ++++++ lollypop-1.1.4.6.tar.xz -> lollypop-1.1.4.7.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lollypop-1.1.4.6/lollypop/downloader_info.py new/lollypop-1.1.4.7/lollypop/downloader_info.py --- old/lollypop-1.1.4.6/lollypop/downloader_info.py 2019-07-26 17:36:01.000000000 +0200 +++ new/lollypop-1.1.4.7/lollypop/downloader_info.py 2019-07-29 00:25:36.000000000 +0200 @@ -12,6 +12,7 @@ from gi.repository import GLib +from gettext import gettext as _ import json from locale import getdefaultlocale @@ -26,13 +27,17 @@ Helper for wikipedia search """ + __API_SEARCH = "https://%s.wikipedia.org/w/api.php?action=query" +\ + "&list=search&srsearch=%s&format=json" + __API_INFO = "https://%s.wikipedia.org/w/api.php?action=query" +\ + "&pageids=%s&format=json" +\ + "&prop=extracts&exlimit=max&explaintext&redirects=1" + def __init__(self): """ Init wikipedia - @raise exception is wikipedia module not installed """ - import wikipedia - wikipedia + self.__locale = getdefaultlocale()[0][0:2] def get_content(self, string): """ @@ -40,47 +45,46 @@ @param string as str @return str/None """ - content = None try: - name = self.__get_duckduck_name(string) - if name is None: + (locale, page_id) = self.__search_term(string) + if page_id is None: return None - import wikipedia - language = getdefaultlocale()[0][0:2] - wikipedia.set_lang(language) - page = wikipedia.page(name) - if page is None: - wikipedia.set_lang("en") - page = wikipedia.page(name) - if page is not None: - content = page.content.encode(encoding="UTF-8") + uri = self.__API_INFO % (locale, page_id) + (status, data) = App().task_helper.load_uri_content_sync(uri) + if status: + decode = json.loads(data.decode("utf-8")) + extract = decode["query"]["pages"][str(page_id)]["extract"] + return extract.encode("utf-8") except Exception as e: Logger.error("Wikipedia::get_content(): %s", e) - return content + return None ####################### # PRIVATE # ####################### - def __get_duckduck_name(self, string): + def __search_term(self, term): """ - Get wikipedia duck duck name for string - @param string as str - @return str + Search term on Wikipdia + @param term as str + @return pageid as str """ - name = None try: - uri = "https://api.duckduckgo.com/?q=%s&format=json&pretty=1"\ - % string - (status, data) = App().task_helper.load_uri_content_sync(uri) - if status: - import json - decode = json.loads(data.decode("utf-8")) - uri = decode["AbstractURL"] - if uri: - name = uri.split("/")[-1] + for locale in [self.__locale, "en"]: + uri = self.__API_SEARCH % (locale, term) + (status, data) = App().task_helper.load_uri_content_sync(uri) + if status: + decode = json.loads(data.decode("utf-8")) + for item in decode["query"]["search"]: + if item["title"].lower() == term.lower(): + return (locale, item["pageid"]) + else: + for word in [_("band"), _("singer"), + "band", "singer"]: + if item["snippet"].lower().find(word) != -1: + return (locale, item["pageid"]) except Exception as e: - Logger.error("Wikipedia::__get_duckduck_name(): %s", e) - return name + print("Wikipedia::__search_term(): %s", e) + return ("", None) class InfoDownloader(Downloader): @@ -161,7 +165,7 @@ if get_network_available("WIKIPEDIA"): wikipedia = Wikipedia() content = wikipedia.get_content(artist) - else: + if content is None: for (api, a_helper, ar_helper, helper) in self._WEBSERVICES: if helper is None: continue diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lollypop-1.1.4.6/meson.build new/lollypop-1.1.4.7/meson.build --- old/lollypop-1.1.4.6/meson.build 2019-07-26 17:36:01.000000000 +0200 +++ new/lollypop-1.1.4.7/meson.build 2019-07-29 00:25:36.000000000 +0200 @@ -1,5 +1,5 @@ project('lollypop', - version: '1.1.4.6', + version: '1.1.4.7', meson_version: '>= 0.40.0' ) i18n = import('i18n')
participants (1)
-
root