Skip to content

Commit

Permalink
Move code into a separate Python module
Browse files Browse the repository at this point in the history
  • Loading branch information
phihag committed Nov 21, 2011
1 parent 5b3330e commit 235b3ba
Show file tree
Hide file tree
Showing 4 changed files with 4,237 additions and 7 deletions.
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
default: update

update: update-readme update-latest
update: compile update-readme update-latest

update-latest:
./youtube-dl --version > LATEST_VERSION
Expand All @@ -15,6 +15,7 @@ update-readme:
echo -e '\n## FAQ' >> README.md && \
echo "$${footer}" >> README.md

compile:
cp youtube_dl/__init__.py youtube-dl


.PHONY: default update update-latest update-readme
.PHONY: default compile update update-latest update-readme
10 changes: 6 additions & 4 deletions youtube-dl
Original file line number Diff line number Diff line change
Expand Up @@ -4045,7 +4045,7 @@ def gen_extractors():
GenericIE()
]

def main():
def _real_main():
parser, opts, args = parseOpts()

# Open appropriate CookieJar
Expand Down Expand Up @@ -4205,15 +4205,17 @@ def main():

sys.exit(retcode)


if __name__ == '__main__':
def main():
try:
main()
_real_main()
except DownloadError:
sys.exit(1)
except SameFileError:
sys.exit(u'ERROR: fixed output name but more than one file to download')
except KeyboardInterrupt:
sys.exit(u'\nERROR: Interrupted by user')

if __name__ == '__main__':
main()

# vim: set ts=4 sw=4 sts=4 noet ai si filetype=python:
6 changes: 6 additions & 0 deletions youtube-dl.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import youtube_dl

youtube_dl.main()
Loading

0 comments on commit 235b3ba

Please sign in to comment.