commit
8f9b2fa0f1
|
@ -15,7 +15,7 @@ website. I don't remember why I added an extra step, I really don't. Oh well, it
|
|||
|
||||
class AnimeDL(object):
|
||||
|
||||
def __init__(self, url, username, password, resolution, language, skipper, logger, episode_range):
|
||||
def __init__(self, url, username, password, resolution, language, skipper, logger, episode_range, output):
|
||||
|
||||
website = str(self.honcho(url=url[0]))
|
||||
|
||||
|
@ -27,7 +27,7 @@ class AnimeDL(object):
|
|||
|
||||
sites.crunchyroll.Crunchyroll(
|
||||
url=url[0], password=password, username=username, resolution=resolution, language=language,
|
||||
skipper=skipper, logger=logger, episode_range=episode_range)
|
||||
skipper=skipper, logger=logger, episode_range=episode_range, output=output)
|
||||
|
||||
elif website == "VRV":
|
||||
print("Not Implemented")
|
||||
|
|
|
@ -33,6 +33,7 @@ class Main():
|
|||
parser.add_argument('-l', '--language', nargs=1, help='Selects the language for the show.', default='Japanese')
|
||||
parser.add_argument('-rn', '--range', nargs=1, help='Specifies the range of episodes to download.',
|
||||
default='All')
|
||||
parser.add_argument('-o', '--output', nargs=1, help='Specifies the directory of which to save the files.')
|
||||
parser.add_argument('--skip', action='store_true', help='skips the video download and downloads only subs.')
|
||||
parser.add_argument("-v", "--verbose", help="Prints important debugging messages on screen.",
|
||||
action="store_true")
|
||||
|
@ -73,7 +74,9 @@ class Main():
|
|||
args.language = args.language[0]
|
||||
if type(args.range) == list:
|
||||
args.range = args.range[0]
|
||||
if type(args.output) == list:
|
||||
args.output = args.output[0]
|
||||
|
||||
AnimeDL(url=args.input, username=args.username, password=args.password,
|
||||
resolution=args.resolution, language=args.language, skipper=skipper,
|
||||
logger=logger, episode_range=args.range)
|
||||
logger=logger, episode_range=args.range, output=args.output)
|
|
@ -12,7 +12,7 @@ from shutil import move
|
|||
|
||||
|
||||
class Crunchyroll(object):
|
||||
def __init__(self, url, password, username, resolution, language, skipper, logger, episode_range):
|
||||
def __init__(self, url, password, username, resolution, language, skipper, logger, episode_range, output):
|
||||
if logger == "True":
|
||||
logging.basicConfig(format='%(levelname)s: %(message)s', filename="Error Log.log", level=logging.DEBUG,
|
||||
encoding="utf-8")
|
||||
|
@ -39,16 +39,16 @@ class Crunchyroll(object):
|
|||
if skipper == "yes":
|
||||
self.only_subs(url=url, cookies=cookies, resolution=resolution)
|
||||
else:
|
||||
self.single_episode(url=url, cookies=cookies, token=token, resolution=resolution)
|
||||
self.single_episode(url=url, cookies=cookies, token=token, resolution=resolution, output=output)
|
||||
elif crunchy_show:
|
||||
self.whole_show(url=url, cookie=cookies, token=token, language=language, resolution=resolution, skipper=skipper, episode_range=episode_range)
|
||||
self.whole_show(url=url, cookie=cookies, token=token, language=language, resolution=resolution, skipper=skipper, episode_range=episode_range, output=output)
|
||||
else:
|
||||
print("URL does not look like a show or a video, stopping.")
|
||||
else:
|
||||
print("Failed Login!!!")
|
||||
exit(1)
|
||||
|
||||
def single_episode(self, url, cookies, token, resolution):
|
||||
def single_episode(self, url, cookies, token, resolution, output):
|
||||
video_id = str(url.split('-')[-1]).replace("/", "")
|
||||
logging.debug("video_id : {0}".format(video_id))
|
||||
|
||||
|
@ -70,6 +70,9 @@ class Crunchyroll(object):
|
|||
output_directory = supporters.path_works.path_creator(anime_name=anime_name)
|
||||
file_location = str(output_directory) + os.sep + str(file_name).replace(".mp4", ".mkv")
|
||||
|
||||
if output is None or not os.path.exists(output):
|
||||
output = output_directory
|
||||
|
||||
if os.path.isfile(file_location):
|
||||
print('[anime-dl] File Exists! Skipping {0}\n'.format(file_name))
|
||||
pass
|
||||
|
@ -92,7 +95,8 @@ class Crunchyroll(object):
|
|||
|
||||
is_stream_muxed = self.stream_muxing(file_name=file_name, subs_files=sub_files, fonts=fonts, output_directory=output_directory)
|
||||
if is_stream_muxed:
|
||||
is_file_moved = self.move_video_file(output_directory = output_directory)
|
||||
is_file_moved = self.move_video_file(output_directory = output)
|
||||
print("Moved file to", output)
|
||||
if is_file_moved:
|
||||
is_cleaned = self.material_cleaner()
|
||||
if is_cleaned:
|
||||
|
@ -116,7 +120,7 @@ class Crunchyroll(object):
|
|||
print("Couldn't Connect To XML Page.")
|
||||
pass
|
||||
|
||||
def whole_show(self, url, cookie, token, language, resolution, skipper, episode_range):
|
||||
def whole_show(self, url, cookie, token, language, resolution, skipper, episode_range, output):
|
||||
response, page_source, episode_list_cookies = anime_dl.common.browser_instance.page_downloader(url=url, cookies=cookie)
|
||||
|
||||
if response:
|
||||
|
@ -147,7 +151,7 @@ class Crunchyroll(object):
|
|||
# cookies, Token = self.webpagedownloader(url=url)
|
||||
# print("Dub list : %s" % dub_list)
|
||||
try:
|
||||
self.single_episode(url=episode_url, cookies=cookie, token=token, resolution=resolution)
|
||||
self.single_episode(url=episode_url, cookies=cookie, token=token, resolution=resolution, output=output)
|
||||
except Exception as SomeError:
|
||||
print("Error Downloading : {0}".format(SomeError))
|
||||
pass
|
||||
|
@ -160,7 +164,7 @@ class Crunchyroll(object):
|
|||
# cookies, Token = self.webpagedownloader(url=url)
|
||||
# print("Sub list : %s" % sub_list)
|
||||
try:
|
||||
self.single_episode(url=episode_url, cookies=cookie, token=token, resolution=resolution)
|
||||
self.single_episode(url=episode_url, cookies=cookie, token=token, resolution=resolution, output=output)
|
||||
except Exception as SomeError:
|
||||
print("Error Downloading : {0}".format(SomeError))
|
||||
pass
|
||||
|
@ -178,7 +182,7 @@ class Crunchyroll(object):
|
|||
for single_node in chap_holder_div:
|
||||
href_value = single_node["href"]
|
||||
title_value = single_node["title"]
|
||||
if "(Dub)" in str(title_value):
|
||||
if "(Dub)" in u' '.join(title_value).encode('utf-8').strip():
|
||||
dub_list.append(str(url) + "/" + str(str(href_value).split("/")[-1]))
|
||||
else:
|
||||
ep_sub_list.append(str(url) + "/" + str(str(href_value).split("/")[-1]))
|
||||
|
@ -451,11 +455,18 @@ class Crunchyroll(object):
|
|||
info_url = "http://www.crunchyroll.com/xml/?req=RpcApiVideoPlayer_GetStandardConfig&media_id=%s&video_format=106&video_quality=62¤t_page=%s" % (
|
||||
video_id, url)
|
||||
resolution_to_find = "1280x720"
|
||||
|
||||
elif str(resolution).lower() in ['640', '640x480']:
|
||||
info_url = "http://www.crunchyroll.com/xml/?req=RpcApiVideoPlayer_GetStandardConfig&media_id=%s&video_format=103&video_quality=61¤t_page=%s" % (
|
||||
video_id, url)
|
||||
resolution_to_find = "640x480"
|
||||
elif str(resolution).lower() in ['480p', '480', 'sd']:
|
||||
info_url = "http://www.crunchyroll.com/xml/?req=RpcApiVideoPlayer_GetStandardConfig&media_id=%s&video_format=106&video_quality=61¤t_page=%s" % (
|
||||
video_id, url)
|
||||
resolution_to_find = "848x480"
|
||||
elif str(resolution).lower() in ['480x360']:
|
||||
info_url = "http://www.crunchyroll.com/xml/?req=RpcApiVideoPlayer_GetStandardConfig&media_id=%s&video_format=106&video_quality=61¤t_page=%s" % (
|
||||
video_id, url)
|
||||
resolution_to_find = "480x360"
|
||||
elif str(resolution).lower() in ['360p', '360', 'cancer']:
|
||||
info_url = "http://www.crunchyroll.com/xml/?req=RpcApiVideoPlayer_GetStandardConfig&media_id=%s&video_format=106&video_quality=60¤t_page=%s" % (
|
||||
video_id, url)
|
||||
|
|
Loading…
Reference in New Issue