Merge pull request #39 from kepoorhampond/exact-album

-e/--exact flag feature
This commit is contained in:
Kepoor Hampond 2017-09-30 18:12:42 -07:00 committed by GitHub
commit 32b52df309
3 changed files with 12 additions and 5 deletions

View file

@ -26,6 +26,9 @@ name. Must be used with -s/--song or -A/--album")
# Album # Album
parser.add_argument("-A", "--album", dest="album", help="Specify album \ parser.add_argument("-A", "--album", dest="album", help="Specify album \
name") name")
parser.add_argument("-e", "--exact", dest="exact", action="store_true",
help="The list will only be chosen if it equals the \
user input.")
# Playlist # Playlist
parser.add_argument("-u", "--username", dest="username", help="Specify \ parser.add_argument("-u", "--username", dest="username", help="Specify \

View file

@ -167,7 +167,6 @@ init, or in method arguments.")
try: try:
if "yt-simple-endpoint style-scope ytd-video-renderer" in str(" ".join(link["class"])) or \ if "yt-simple-endpoint style-scope ytd-video-renderer" in str(" ".join(link["class"])) or \
"yt-uix-tile-link yt-ui-ellipsis yt-ui-ellipsis-2 yt-uix-sessionlink spf-link " in str(" ".join(link["class"])): "yt-uix-tile-link yt-ui-ellipsis yt-ui-ellipsis-2 yt-uix-sessionlink spf-link " in str(" ".join(link["class"])):
if "&list=" not in link["href"]: if "&list=" not in link["href"]:
return link return link
except KeyError: except KeyError:
@ -231,8 +230,7 @@ album row at @ session".split(" ")
return self.find_yt_url(song=song, artist=artist, additional_search=additional_search, caught_by_google=True) return self.find_yt_url(song=song, artist=artist, additional_search=additional_search, caught_by_google=True)
elif caught_by_google is True and first is not True: elif caught_by_google is True and first is not True:
return self.find_yt_url(song, artist, additional_search, caught_by_google, first=True) return self.find_yt_url(song, artist, additional_search, caught_by_google, first=True)
def album(self, title, artist=None): # Alias for spotify_list("album", ..) def album(self, title, artist=None): # Alias for spotify_list("album", ..)
return self.spotify_list("album", title=title, artist=artist) return self.spotify_list("album", title=title, artist=artist)

View file

@ -90,8 +90,8 @@ class ObjManip: # Object Manipulation
def check_garbage_phrases(phrases, string, title): def check_garbage_phrases(phrases, string, title):
for phrase in phrases: for phrase in phrases:
if phrase in ObjManip.blank(string): if phrase in string.lower():
if phrase not in ObjManip.blank(title): if phrase not in title.lower():
return True return True
return False return False
@ -443,6 +443,12 @@ class Config:
else: else:
return True return True
def parse_exact(ripper):
exact = check_sources(ripper, "exact")
if exact in (True, False):
return exact
#============== #==============
# Captcha Cheat # Captcha Cheat