diff options
-rw-r--r-- | www/youtube_dl/Makefile | 13 | ||||
-rw-r--r-- | www/youtube_dl/distinfo | 6 | ||||
-rw-r--r-- | www/youtube_dl/files/ffmpeg.patch | 59 |
3 files changed, 73 insertions, 5 deletions
diff --git a/www/youtube_dl/Makefile b/www/youtube_dl/Makefile index 1351a2f8d2b7..e711c397f809 100644 --- a/www/youtube_dl/Makefile +++ b/www/youtube_dl/Makefile @@ -6,7 +6,7 @@ # PORTNAME= youtube_dl -PORTVERSION= 2007.01.01 +PORTVERSION= 2007.01.19 CATEGORIES= www MASTER_SITES= http://www.arrakis.es/~rggi3/youtube-dl/ DISTNAME= youtube-dl-${PORTVERSION} @@ -23,6 +23,15 @@ USE_PYTHON= 2.4+ PLIST_FILES= bin/youtube-dl +OPTIONS= FFMPEG "With optional avi output format" off + +.include <bsd.port.pre.mk> + +.if defined(WITH_FFMPEG) +RUN_DEPENDS= ffmpeg:${PORTSDIR}/multimedia/ffmpeg +EXTRA_PATCHES+= ${PATCHDIR}/ffmpeg.patch +.endif + post-extract: @${CP} ${DISTDIR}/youtube-dl-${PORTVERSION} ${WRKSRC}/youtube-dl @@ -32,4 +41,4 @@ post-patch: do-install: @${INSTALL_SCRIPT} ${WRKSRC}/youtube-dl ${TARGETDIR}/bin/youtube-dl -.include <bsd.port.mk> +.include <bsd.port.post.mk> diff --git a/www/youtube_dl/distinfo b/www/youtube_dl/distinfo index acd449ace18c..62b7c7046155 100644 --- a/www/youtube_dl/distinfo +++ b/www/youtube_dl/distinfo @@ -1,3 +1,3 @@ -MD5 (youtube-dl-2007.01.01) = a052f03b4fa4a6bda086d4cafceaefe8 -SHA256 (youtube-dl-2007.01.01) = 90e643e3c6271b231544033f1e49b71e20a56c2e208ad841019a70e34492fcc2 -SIZE (youtube-dl-2007.01.01) = 11108 +MD5 (youtube-dl-2007.01.19) = 5c80bc04449bd862de7cd429a4afc9c0 +SHA256 (youtube-dl-2007.01.19) = 1fbc25009b62cbc19f1f4e3f16b393e696399b44c2ed5f7f655af36d7ad7c523 +SIZE (youtube-dl-2007.01.19) = 12463 diff --git a/www/youtube_dl/files/ffmpeg.patch b/www/youtube_dl/files/ffmpeg.patch new file mode 100644 index 000000000000..ff4edbedf6e9 --- /dev/null +++ b/www/youtube_dl/files/ffmpeg.patch @@ -0,0 +1,59 @@ +--- youtube-dl.orig Sat Jan 20 02:44:25 2007 ++++ youtube-dl Sat Jan 20 23:53:11 2007 +@@ -167,6 +167,7 @@ + cmdl_parser.add_option('-s', '--simulate', action='store_true', dest='simulate', help='do not download video') + cmdl_parser.add_option('-t', '--title', action='store_true', dest='use_title', help='use title in file name') + cmdl_parser.add_option('-n', '--netrc', action='store_true', dest='use_netrc', help='use .netrc authentication data') ++cmdl_parser.add_option('-a', '--avi', action='store_true', dest='use_avi', help='output file in avi format') + (cmdl_opts, cmdl_args) = cmdl_parser.parse_args() + + # Get video URL +@@ -232,19 +233,30 @@ + + # Get output file name + if cmdl_opts.outfile is None: +- video_filename = '%s.flv' % video_url_id ++ if cmdl_opts.use_avi: ++ ext = 'avi' ++ else: ++ ext='flv' ++ video_filename = '%s.%s' % (video_url_id,ext) + else: + video_filename = cmdl_opts.outfile + + # Check name +-if not video_filename.lower().endswith('.flv'): +- sys.stderr.write('Warning: video file name does not end in .flv\n') ++if cmdl_opts.use_avi: ++ if not video_filename.lower().endswith('.avi'): ++ sys.stderr.write('Warning: video file name does not end in .avi\n') ++else: ++ if not video_filename.lower().endswith('.flv'): ++ sys.stderr.write('Warning: video file name does not end in .flv\n') + + # Test writable file + if not cmdl_opts.simulate: + try: +- disk_test = open(video_filename, 'wb') +- disk_test.close() ++ if cmdl_opts.use_avi: ++ video_file = os.popen('ffmpeg -y -i - "%s" > %s 2> %s' % (video_filename, os.path.devnull, os.path.devnull), 'wb') ++ else: ++ disk_test = open(video_filename, 'wb') ++ disk_test.close() + + except (OSError, IOError): + sys.exit('Error: unable to open %s for writing.' % video_filename) +@@ -317,7 +329,11 @@ + # Rename video file if needed + if cmdl_opts.use_title: + try: +- final_filename = '%s-%s.flv' % (title_string_norm(video_title), video_url_id) ++ if cmdl_opts.use_avi: ++ ext = 'avi' ++ else: ++ ext = 'flv' ++ final_filename = '%s-%s.%s' % (title_string_norm(video_title), video_url_id, ext) + os.rename(video_filename, final_filename) + cond_print('Video file renamed to %s\n' % final_filename) + |