diff --git a/API_Reference.py b/API_Reference.py index 98ff18e..674c7ce 100644 --- a/API_Reference.py +++ b/API_Reference.py @@ -353,4 +353,6 @@ guan.compress_wav_to_mp3(wav_path, output_filename='a.mp3', bitrate='16k') guan.play_academic_words(reverse=0, random_on=0, bre_or_ame='ame', show_translation=1, show_link=1, translation_time=2, rest_time=1) +guan.play_selected_academic_words(reverse=0, random_on=0, bre_or_ame='ame', show_link=1, rest_time=3) + guan.play_element_words(random_on=0, show_translation=1, show_link=1, translation_time=2, rest_time=1) \ No newline at end of file diff --git a/PyPI/setup.cfg b/PyPI/setup.cfg index 799e8f9..fbe6eb2 100644 --- a/PyPI/setup.cfg +++ b/PyPI/setup.cfg @@ -1,7 +1,7 @@ [metadata] # replace with your username: name = guan -version = 0.0.124 +version = 0.0.125 author = guanjihuan author_email = guanjihuan@163.com description = An open source python package diff --git a/PyPI/src/guan.egg-info/PKG-INFO b/PyPI/src/guan.egg-info/PKG-INFO index a27f2fc..4f357b9 100644 --- a/PyPI/src/guan.egg-info/PKG-INFO +++ b/PyPI/src/guan.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: guan -Version: 0.0.124 +Version: 0.0.125 Summary: An open source python package Home-page: https://py.guanjihuan.com Author: guanjihuan diff --git a/PyPI/src/guan/__init__.py b/PyPI/src/guan/__init__.py index 218bd29..3e59bda 100644 --- a/PyPI/src/guan/__init__.py +++ b/PyPI/src/guan/__init__.py @@ -2,7 +2,7 @@ # With this package, you can calculate band structures, density of states, quantum transport and topological invariant of tight-binding models by invoking the functions you need. Other frequently used functions are also integrated in this package, such as file reading/writing, figure plotting, data processing. -# The current version is guan-0.0.124, updated on August 13, 2022. +# The current version is guan-0.0.125, updated on August 25, 2022. # Installation: pip install --upgrade guan @@ -2664,6 +2664,61 @@ def play_academic_words(reverse=0, random_on=0, bre_or_ame='ame', show_translati pygame.mixer.music.stop() print() +def play_selected_academic_words(reverse=0, random_on=0, bre_or_ame='ame', show_link=1, rest_time=3): + from bs4 import BeautifulSoup + import re + import urllib.request + import requests + import os + import pygame + import time + import ssl + import random + ssl._create_default_https_context = ssl._create_unverified_context + html = urllib.request.urlopen("https://www.guanjihuan.com/archives/24732").read().decode('utf-8') + if bre_or_ame == 'ame': + directory = 'words_mp3_ameProns/' + elif bre_or_ame == 'bre': + directory = 'words_mp3_breProns/' + exist_directory = os.path.exists(directory) + html_file = urllib.request.urlopen("https://file.guanjihuan.com/words/"+directory).read().decode('utf-8') + if exist_directory == 0: + os.makedirs(directory) + soup = BeautifulSoup(html, features='lxml') + contents = re.findall('