mirror of
https://github.com/cooperhammond/irs.git
synced 2024-12-22 17:35:28 +00:00
Merge pull request #30 from kepoorhampond/issue-14
Apparently it was just some wierd apostrophe in a unicode format
This commit is contained in:
commit
24f3681b36
|
@ -1,3 +1,5 @@
|
||||||
|
# _*_ coding:utf-8 _*_
|
||||||
|
|
||||||
# System
|
# System
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
@ -141,8 +143,8 @@ class Ripper:
|
||||||
raise ValueError("Must specify song_title/artist in `args` with \
|
raise ValueError("Must specify song_title/artist in `args` with \
|
||||||
init, or in method arguments.")
|
init, or in method arguments.")
|
||||||
|
|
||||||
search_terms = str(song) + " " + str(artist
|
search_terms = song + " " + artist + " " + additional_search
|
||||||
) + " " + str(additional_search)
|
|
||||||
query_string = urlencode({"search_query": (
|
query_string = urlencode({"search_query": (
|
||||||
search_terms.encode('utf-8'))})
|
search_terms.encode('utf-8'))})
|
||||||
link = "http://www.youtube.com/results?" + query_string
|
link = "http://www.youtube.com/results?" + query_string
|
||||||
|
@ -376,7 +378,11 @@ init, or in method arguments.")
|
||||||
|
|
||||||
video_url, video_title = self.find_yt_url(song, artist)
|
video_url, video_title = self.find_yt_url(song, artist)
|
||||||
|
|
||||||
print(self.args["hook-text"].get("song").format(song, artist))
|
if sys.version_info[0] == 2:
|
||||||
|
print(self.args["hook-text"].get("song").decode().format(song,
|
||||||
|
artist))
|
||||||
|
else:
|
||||||
|
print(self.args["hook-text"].get("song").format(song, artist))
|
||||||
|
|
||||||
file_name = data["file_prefix"] + ObjManip.blank(song, False) + ".mp3"
|
file_name = data["file_prefix"] + ObjManip.blank(song, False) + ".mp3"
|
||||||
|
|
||||||
|
|
15
irs/utils.py
15
irs/utils.py
|
@ -1,4 +1,5 @@
|
||||||
# -*- coding: UTF-8 -*-
|
# _*_ coding:utf-8 _*_
|
||||||
|
|
||||||
|
|
||||||
# =======
|
# =======
|
||||||
# Imports
|
# Imports
|
||||||
|
@ -95,12 +96,16 @@ class ObjManip: # Object Manipulation
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def blank(string, downcase=True):
|
def blank(string, downcase=True):
|
||||||
import re
|
|
||||||
regex = re.compile('[^a-zA-Z0-9\ ]')
|
|
||||||
string = regex.sub('', str(string))
|
|
||||||
if downcase:
|
if downcase:
|
||||||
string = string.lower()
|
string = string.lower()
|
||||||
return ' '.join(string.split())
|
import re
|
||||||
|
regex = re.compile('[^a-zA-Z0-9\ ]')
|
||||||
|
if sys.version_info == 2:
|
||||||
|
string = regex.sub('', string.decode("utf8"))
|
||||||
|
return ' '.join(string.decode().split())
|
||||||
|
else:
|
||||||
|
string = regex.sub('', string)
|
||||||
|
return ' '.join(string.split())
|
||||||
|
|
||||||
def blank_include(this, includes_this):
|
def blank_include(this, includes_this):
|
||||||
this = ObjManip.blank(this)
|
this = ObjManip.blank(this)
|
||||||
|
|
Loading…
Reference in a new issue