Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-organized code and a lot of other stuff. #342

Merged
merged 25 commits into from
May 22, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
6af22cf
added support for HTTP redirects. Closes #315
FiloSottile Mar 18, 2012
d891ff9
Ignore leading spaces (and trailing also) in all URL from url list or…
baryluk Mar 23, 2012
69d3b2d
Extract original URL from next_url parameter of verify_age page, befo…
baryluk Mar 23, 2012
0719406
Always extract original URL from next_url (#318)
FiloSottile Mar 24, 2012
74a5ff5
transplant ceba827e9aab563ae7c7190fc236ec1aa358ee59, d891ff9fd9952b28…
FiloSottile Mar 24, 2012
c23d8a7
Merge branch 'next-url'
FiloSottile Mar 25, 2012
d77c3df
Split code as a package, compiled into an executable zip
FiloSottile Mar 25, 2012
770234a
Added py2exe script
FiloSottile Mar 25, 2012
58ca755
moved increment_downloads and process_info calls from IEs to FD.downl…
FiloSottile Mar 30, 2012
303692b
's/ /\t/'
FiloSottile Mar 30, 2012
53e8936
corrected -U to support new zipfile and exe (#153) formats
FiloSottile Mar 30, 2012
bcfde70
py2exe -U fix for Windows XP
FiloSottile Mar 30, 2012
c6306eb
wine-py2exe.sh to create the exe under linux (!!)
FiloSottile Apr 7, 2012
d6a9615
standardized the use of unescapeHTML; added clean_html()
FiloSottile Apr 10, 2012
e179aad
moved trivialjson to a separate file
FiloSottile Apr 10, 2012
d11d05d
better naming for the sub-modules
FiloSottile Apr 10, 2012
c6f45d4
removed dependency from lxml: added IDParser
FiloSottile Apr 10, 2012
781cc52
removed the undocumented HTMLParser.unescape, replaced with _unescape…
FiloSottile Apr 10, 2012
7a8501e
ignore parsing errors in get_element_by_id()
FiloSottile Apr 10, 2012
9e6dd23
merged unescapeHTML branch; removed lxml dependency
FiloSottile Apr 10, 2012
9beb5af
some HTMLParser bugfixes
FiloSottile Apr 13, 2012
921a145
dropped the support for Python 2.5
FiloSottile May 1, 2012
3fe294e
merge upstream
FiloSottile May 1, 2012
0b8c922
Introduced Trouble(Exception) for more elegant non-fatal errors handling
FiloSottile May 9, 2012
2c288bd
reorganized the titles sanitizing: now title is the untouched title
FiloSottile May 9, 2012
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
*.pyc
*.pyo
*~
wine-py2exe/
py2exe.log
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ update-readme:
echo "$${footer}" >> README.md

compile:
cp youtube_dl/__init__.py youtube-dl
zip --junk-paths youtube-dl youtube_dl/*.py
echo '#!/usr/bin/env python' > youtube-dl
cat youtube-dl.zip >> youtube-dl
rm youtube-dl.zip

.PHONY: default compile update update-latest update-readme
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ youtube-dl [options] url [url...]
## DESCRIPTION
**youtube-dl** is a small command-line program to download videos from
YouTube.com and a few more sites. It requires the Python interpreter, version
2.x (x being at least 5), and it is not platform specific. It should work in
2.x (x being at least 6), and it is not platform specific. It should work in
your Unix box, in Windows or in Mac OS X. It is released to the public domain,
which means you can modify it, redistribute it or use it however you like.

Expand Down
48 changes: 48 additions & 0 deletions build_exe.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
from distutils.core import setup
import py2exe
import sys, os

"""This will create an exe that needs Microsoft Visual C++ 2008 Redistributable Package"""

# If run without args, build executables
if len(sys.argv) == 1:
sys.argv.append("py2exe")

# os.chdir(os.path.dirname(os.path.abspath(sys.argv[0]))) # conflict with wine-py2exe.sh
sys.path.append('./youtube_dl')

options = {
"bundle_files": 1,
"compressed": 1,
"optimize": 2,
"dist_dir": '.',
"dll_excludes": ['w9xpopen.exe']
}

console = [{
"script":"./youtube_dl/__main__.py",
"dest_base": "youtube-dl",
}]

init_file = open('./youtube_dl/__init__.py')
for line in init_file.readlines():
if line.startswith('__version__'):
version = line[11:].strip(" ='\n")
break
else:
version = ''

setup(name='youtube-dl',
version=version,
description='Small command-line program to download videos from YouTube.com and other video sites',
url='https://github.com/rg3/youtube-dl',
packages=['youtube_dl'],

console = console,
options = {"py2exe": options},
zipfile = None,
)

import shutil
shutil.rmtree("build")

Binary file added devscripts/SizeOfImage.patch
Binary file not shown.
Binary file added devscripts/SizeOfImage_w.patch
Binary file not shown.
56 changes: 56 additions & 0 deletions devscripts/wine-py2exe.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash

# Run with as parameter a setup.py that works in the current directory
# e.g. no os.chdir()
# It will run twice, the first time will crash

set -e

SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"

if [ ! -d wine-py2exe ]; then

sudo apt-get install wine1.3 axel bsdiff

mkdir wine-py2exe
cd wine-py2exe
export WINEPREFIX=`pwd`

axel -a "http://www.python.org/ftp/python/2.7/python-2.7.msi"
axel -a "http://downloads.sourceforge.net/project/py2exe/py2exe/0.6.9/py2exe-0.6.9.win32-py2.7.exe"
#axel -a "http://winetricks.org/winetricks"

# http://appdb.winehq.org/objectManager.php?sClass=version&iId=21957
echo "Follow python setup on screen"
wine msiexec /i python-2.7.msi

echo "Follow py2exe setup on screen"
wine py2exe-0.6.9.win32-py2.7.exe

#echo "Follow Microsoft Visual C++ 2008 Redistributable Package setup on screen"
#bash winetricks vcrun2008

rm py2exe-0.6.9.win32-py2.7.exe
rm python-2.7.msi
#rm winetricks

# http://bugs.winehq.org/show_bug.cgi?id=3591

mv drive_c/Python27/Lib/site-packages/py2exe/run.exe drive_c/Python27/Lib/site-packages/py2exe/run.exe.backup
bspatch drive_c/Python27/Lib/site-packages/py2exe/run.exe.backup drive_c/Python27/Lib/site-packages/py2exe/run.exe "$SCRIPT_DIR/SizeOfImage.patch"
mv drive_c/Python27/Lib/site-packages/py2exe/run_w.exe drive_c/Python27/Lib/site-packages/py2exe/run_w.exe.backup
bspatch drive_c/Python27/Lib/site-packages/py2exe/run_w.exe.backup drive_c/Python27/Lib/site-packages/py2exe/run_w.exe "$SCRIPT_DIR/SizeOfImage_w.patch"

cd -

else

export WINEPREFIX="$( cd wine-py2exe && pwd )"

fi

wine "C:\\Python27\\python.exe" "$1" py2exe > "py2exe.log" 2>&1 || true
echo '# Copying python27.dll' >> "py2exe.log"
cp "$WINEPREFIX/drive_c/windows/system32/python27.dll" build/bdist.win32/winexe/bundle-2.7/
wine "C:\\Python27\\python.exe" "$1" py2exe >> "py2exe.log" 2>&1

Binary file modified youtube-dl
Binary file not shown.
Binary file added youtube-dl.exe
Binary file not shown.
Loading