more 2.6 compat
Browse files- pytube/models.py +4 -4
pytube/models.py
CHANGED
@@ -68,13 +68,13 @@ class Video(object):
|
|
68 |
"""
|
69 |
path = os.path.normpath(path)
|
70 |
if os.path.isdir(path):
|
71 |
-
filename = "{}.{}".format(self.filename, self.extension)
|
72 |
path = os.path.join(path, filename)
|
73 |
# TODO: If it's not a path, this should raise an ``OSError``.
|
74 |
# TODO: Move this into cli, this kind of logic probably shouldn't be
|
75 |
# handled by the library.
|
76 |
if os.path.isfile(path) and not force_overwrite:
|
77 |
-
raise OSError("Conflicting filename:'{}'".format(self.filename))
|
78 |
# TODO: Split up the downloading and OS jazz into separate functions.
|
79 |
response = urlopen(self.url)
|
80 |
meta_data = dict(response.info().items())
|
@@ -107,8 +107,8 @@ class Video(object):
|
|
107 |
# should be taken care of by the client. Also you should be allowed
|
108 |
# to disable this.
|
109 |
os.remove(path)
|
110 |
-
raise KeyboardInterrupt(
|
111 |
-
|
112 |
|
113 |
def __repr__(self):
|
114 |
"""A clean representation of the class instance."""
|
|
|
68 |
"""
|
69 |
path = os.path.normpath(path)
|
70 |
if os.path.isdir(path):
|
71 |
+
filename = "{0}.{1}".format(self.filename, self.extension)
|
72 |
path = os.path.join(path, filename)
|
73 |
# TODO: If it's not a path, this should raise an ``OSError``.
|
74 |
# TODO: Move this into cli, this kind of logic probably shouldn't be
|
75 |
# handled by the library.
|
76 |
if os.path.isfile(path) and not force_overwrite:
|
77 |
+
raise OSError("Conflicting filename:'{0}'".format(self.filename))
|
78 |
# TODO: Split up the downloading and OS jazz into separate functions.
|
79 |
response = urlopen(self.url)
|
80 |
meta_data = dict(response.info().items())
|
|
|
107 |
# should be taken care of by the client. Also you should be allowed
|
108 |
# to disable this.
|
109 |
os.remove(path)
|
110 |
+
raise KeyboardInterrupt(
|
111 |
+
"Interrupt signal given. Deleting incomplete video.")
|
112 |
|
113 |
def __repr__(self):
|
114 |
"""A clean representation of the class instance."""
|