Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions GUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def onDouble(self, event):
value = widget.get(selection[0])
self.entry.delete(0, END)
self.entry.insert(END, value)
self.search() # search button fixed

#Function to setup the basic layout of the Graphical User Interface
def widgets(self):
Expand All @@ -74,7 +75,8 @@ def widgets(self):
Label(self, text="Song Downloader System", background="#CC0001", font= ("Comic Sans MS",16)).grid(row=0, column=0, padx=20)
self.search_var = StringVar()

self.entry = Entry(self, textvariable=self.search_var, width=45)
self.entry = Entry(self, textvariable=self.search_var, width=45)
self.entry.grid(row=1, column=0, sticky=W, padx=20, pady=10)

self.b1=Button(self, text='Search', command=self.search)
self.b1.grid(row=1, column=1, sticky=W, padx=20, pady=10)
Expand All @@ -84,7 +86,7 @@ def widgets(self):
self.lbox.bind("<Double-Button-1>", self.onDouble)

self.lbox2 = Listbox(self, width=45, height=15)
self.lbox2.grid(row=2, column=1, columnspan=6,sticky=W, padx=2000, pady=10)
self.lbox2.grid(row=2, column=1, columnspan=6,sticky=W, padx=20, pady=10)


"""
Expand Down
3 changes: 2 additions & 1 deletion crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ def getMetaData(soup, noOfRecords):
if(s != None):
if(s.has_attr('title')):
if(s['title'] == 'Verified'):
d['Verified'] = True
pass

#Third child of yt-lockup-content division
Expand All @@ -214,7 +215,7 @@ def toNumber(string):
try:
return int(number)
except:
return -1
return 0

#Function that filters out the most relevant Youtube video
def getMostRelevant(metaData, searchWord):
Expand Down
Binary file modified crawler.pyc
Binary file not shown.
4 changes: 2 additions & 2 deletions downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def convert_youtubeURL_to_download_URL(youtube_URL):
https://www.ssyoutube.com/XXX contains a link which allows music videos to be downloaded.
youtube_URL: the URL of the music video to be downloaded
"""
index = youtube_URL.find('https')
index = youtube_URL.find('youtube')
file_retrieve_URL = youtube_URL[0:index] + 'ss' + youtube_URL[index:]
redirect_response = requests.get(file_retrieve_URL)
print(redirect_response.url)
Expand Down Expand Up @@ -60,6 +60,6 @@ def download_video(url, filename):

response = requests.get(url, headers=headers)
print(response)
file = open(filename, 'wb')
file = open(filename, '.mp4') # in second branch, second commit
file.write(response.content)
file.close()
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def initiate_Download(search, relevant):
youtube_URL = 'https://www.youtube.com'+relevant['Link']
ssyoutube_URL = convert_youtubeURL_to_download_URL(youtube_URL)
file_URL = retrieve_File_URL(ssyoutube_URL)
download_video(file_URL, search)
download_video(file_URL, search+'.mp4')



Expand Down
Binary file modified main.pyc
Binary file not shown.
7 changes: 4 additions & 3 deletions song_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def compareArtists(artists, search):
def searchStringLogic(cursor, search_string):
words = search_string.split(' ')
for i in range(len(words) - 1):
artist = '-'.join(words[0:i])
artist = '-'.join(words[0:i+1])
song = '-'.join(words[i+1:])
print('Artist', artist)
print('Song', song)
Expand All @@ -32,15 +32,16 @@ def searchStringLogic(cursor, search_string):
print(artist_result)
return (artist_result, song)

return (None, None)
return (None, None) # test required

def getAllSongs(cursor, artist, song):
songs = []
query = "SELECT song, year FROM lyrics WHERE artist LIKE '%s' AND song NOT LIKE '%s';" %(song, artist)
query = "SELECT song, year FROM lyrics WHERE artist LIKE '%s' AND song NOT LIKE '%s';" %(artist, song)
cursor.execute(query)
rows=cursor.fetchall()
for row in rows:
print(row[0], row[1])
print ""
songs.append(str(row[0]) + str(row[1]))
return songs

Expand Down