API Reference¶
-
music_scraper.main.
main
()[source]¶ The entry point for the app. Called when music-scraper is typed in terminal. Starts the GUI and starts the scraping process after the input is given
-
music_scraper.main.
start_gui
(process)[source]¶ A function that takes care of starting the GUI and stops the Scrapy crawler process when exited from program.
Parameters: process (CrawlerProcess) – The scrapy crawler process that is used to scrape the web. The instance is used for stopping the process.
-
class
music_scraper.gui.
GUI
[source]¶ A static class containing attributes to control the GUI process of the app
- Attributes:
screen: The maximum speed that such a bird can attain. status: The locale where these birds congregate to reproduce. strings: The list of song names, scraped from the web size_dict: Dictionary mapping file names to size of file. url_dict: Dictionary mapping file names to url of file. pages: Total number of pages required to display the song list. page: current page number position: current highlighted song name. max_row: Maximum number of rows that can be displayed in the terminal window. row_num: Total number of rows required. box: Box object which is drawn on the screen with curses high_light_text: curses color of highlighted text. normal_text: Normal text color. key: current pressed key value. run_download: Used to indicate an ongoing download gui_stopped: Used to indicate whether GUI is on or off message: The message or query passed to scrapy and got as input from user
Adds the bottom menu Exit and Download
-
static
get_input
()[source]¶ Loops till user types a non empty query :return: The user inputted query.
-
static
my_raw_input
(r, c, prompt_string)[source]¶ Gets input on the screen :param r: y coordinate :param c: x coordinate :param prompt_string: The prompt string :return: The input string
-
class
music_scraper.threads.
DownloadThread
(func)[source]¶ A thread used for downloading Audio files
Parameters: func – The function that is run in the thread.
-
class
music_scraper.threads.
GUIThread
(process, func)[source]¶ A thread used to run GUI in parallel
Parameters: - process (CrawlerProcess) – Process of Scrapy that scrapes the Web for songs
- func – The function to run when the thread is started.
-
class
music_scraper.spiders.music_spider.
MusicSpider
(name=None, **kwargs)[source]¶ -
name
= 'music'¶
-
parse
(response)[source]¶ Override function of the class scrapy.Spider. Called when response is obtained :param response: Response object used to get the details of the webpage
-