- Project:
- auto songs downloader
- Abstract:
- a python program that can scrape various web sites (funmaza.com, apniisp.com, songs.pk) and extract the links of all the songs, sorted by album.
- it also downloads the files and saves them to appropriate directories. file tags (artist, album) are also set automatically.
- Basic Design:
- a two level design:
- ==> at the first level is a backend that stores the details of the songs and albums. the storage can be in any format, but the interface
- exported is same for all backend storage formats. thus, a change in internal storage format should not break the application
- ==> at the second level are various scripts for scrapping the web sites and adding the data to the backend.
- once the data is added, the files are downloaded, again using the backend interface to get the required info (song name, album, location, already downloaded?)
- and the backend is updated appropriately.
- a GUI frontend is also present. it also uses the backend storage to show the data.
- no component except the backend handles the storage file directly. all requests go through the backend, thus making the system independant of the file format used to store the data.
- BACKEND API:
- ************************
- BCKEND API START
- connect_to_file (file_name, callback) # connects to the specified file to get data. if no file exists the callback is called, if it returns the STRING "TRUE" a new file is created
- # if it returns the STRING "FALSE", action is cancelled. if it returns any other STRING, connect_to_file () is called again with the string as the file_name
- disconnect_from_file () # disconnects the backend from the file, any further data exchanges are prohibited until a new file is connected to
- get_albums () # returns a list containing (album_id, album_name) for each album
- get_downloaded_albums () # return a list containing (album_id, album_name) for each album marked as downloaded
- get_not_downloaded_albums () # inverse of get_downloaded_albums ()
- get_album_location (album_id) # returns the path of the folder for the album_id
- get_album_artists (album_id) # returns list of album artists
- get_songs () # return a list containing (song_id, song_album_id, song_name) for each song
- get_album_songs (album_id) # returns a list containing (song_id, song_name) for each song from the given album
- get_downloaded_songs () # returns a list containing (song_id, song_album_id, song_name) for each song marked as downloaded
- get_not_downloaded_songs () # inverse of get_downloaded_songs ()
- get_song_location (song_id) # returns the complete path (with filename) for the song_id
- get_song_artists (album_id) # returns list of song artists
- get_is_album_downloaded (album_id) # returns TRUE if the album_id is marked as downloaded
- get_is_song_downloaded (song_id) # returns TRUE if the song_id is marked as downloaded
- set_is_album_downloaded (album_id) # changes the downloaded flag of the album_id
- set_is_song_downloaded (song_id) # changes the downloaded flag of the song_id
- add_album (album_name, album_location, downloaded, album_artists) # adds a new album with the provided properties
- add_song (song_name, song_location, downloaded, song_artists, album_id) # adds a new song with the provided properties
- delete_album (album_id, from_fs) # deletes the album_id from DB. if from_fs is true, the album_location folder is also deleted
- delete_song (song_id, from_fs) # deletes the song_id from DB. if from_fs is true, the song_location file is also deleted
- find_album (album_name) # returns the album with the given album_name (exact case insensitive string match)
- search_album (name) # return the album(s) with the given album_name (approximate match using Soundex {may change} algorithm)
- BCKEND API END
- ************************