diff options
Diffstat (limited to 'www/youtube_dl')
-rw-r--r-- | www/youtube_dl/Makefile | 22 | ||||
-rw-r--r-- | www/youtube_dl/distinfo | 6 | ||||
-rw-r--r-- | www/youtube_dl/files/conv2avi.patch | 74 | ||||
-rw-r--r-- | www/youtube_dl/files/ffmpeg.patch | 60 |
4 files changed, 95 insertions, 67 deletions
diff --git a/www/youtube_dl/Makefile b/www/youtube_dl/Makefile index 45dfc25adcd7..cb75b5479501 100644 --- a/www/youtube_dl/Makefile +++ b/www/youtube_dl/Makefile @@ -6,7 +6,7 @@ # PORTNAME= youtube_dl -PORTVERSION= 2007.10.09 +PORTVERSION= 2008.01.24 CATEGORIES= www MASTER_SITES= http://www.arrakis.es/~rggi3/youtube-dl/ DISTNAME= youtube-dl-${PORTVERSION} @@ -23,20 +23,34 @@ USE_PYTHON= 2.4+ PLIST_FILES= bin/youtube-dl -OPTIONS= FFMPEG "With optional avi output format" off +OPTIONS= FFMPEG "Use ffmpeg for avi output" off \ + FLV2MPEG4 "Use flv2mpeg4 for avi output" off .include <bsd.port.pre.mk> +.if defined(WITH_FFMPEG) || defined(WITH_FLV2MPEG4) +EXTRA_PATCHES+= ${PATCHDIR}/conv2avi.patch +.endif + .if defined(WITH_FFMPEG) +.if defined (WITH_FLV2MPEG4) +IGNORE= cannot use WITH_FFMPEG and WITH_FLV2MPEG4 simultaneously +.endif +CONV2AVI_CMD= ${PREFIX}/bin/ffmpeg -y -i RUN_DEPENDS= ffmpeg:${PORTSDIR}/multimedia/ffmpeg -EXTRA_PATCHES+= ${PATCHDIR}/ffmpeg.patch +.else +CONV2AVI_CMD= ${PREFIX}/bin/flv2mpeg4 +RUN_DEPENDS= flv2mpeg4:${PORTSDIR}/multimedia/flv2mpeg4 .endif post-extract: @${CP} ${DISTDIR}/youtube-dl-${PORTVERSION} ${WRKSRC}/youtube-dl post-patch: - @${REINPLACE_CMD} -e 's|%%PYTHON_CMD%%|${PYTHON_CMD}|g' ${WRKSRC}/youtube-dl + @${REINPLACE_CMD} -e 's|%%PYTHON_CMD%%|${PYTHON_CMD}|' ${WRKSRC}/youtube-dl +.if defined(WITH_FFMPEG) || defined(WITH_FLV2MPEG4) + @${REINPLACE_CMD} -e 's|%%CONV2AVI_CMD%%|${CONV2AVI_CMD}|' ${WRKSRC}/youtube-dl +.endif do-install: @${INSTALL_SCRIPT} ${WRKSRC}/youtube-dl ${PREFIX}/bin/youtube-dl diff --git a/www/youtube_dl/distinfo b/www/youtube_dl/distinfo index 36bc18f16e47..d6f33001b1ee 100644 --- a/www/youtube_dl/distinfo +++ b/www/youtube_dl/distinfo @@ -1,3 +1,3 @@ -MD5 (youtube-dl-2007.10.09) = a721e6f3cbd44777bbaa73b45c4a6117 -SHA256 (youtube-dl-2007.10.09) = f1773a2d98d9c2d5cab2c7ff2526c6c1fe91c13f6588d1b0af8849989efa6949 -SIZE (youtube-dl-2007.10.09) = 15356 +MD5 (youtube-dl-2008.01.24) = 48a7df743398bbfdf2710962000886cb +SHA256 (youtube-dl-2008.01.24) = 6e98f3abfa79a038e578d45441bb6675ac6d4880bae4b801d5125e364e60d5c5 +SIZE (youtube-dl-2008.01.24) = 14643 diff --git a/www/youtube_dl/files/conv2avi.patch b/www/youtube_dl/files/conv2avi.patch new file mode 100644 index 000000000000..3f9c6581640b --- /dev/null +++ b/www/youtube_dl/files/conv2avi.patch @@ -0,0 +1,74 @@ +--- youtube-dl.orig Wed Jan 30 14:18:50 2008 ++++ youtube-dl Thu Jan 31 21:36:49 2008 +@@ -208,6 +208,7 @@ + cmdl_parser.add_option('-t', '--title', action='store_true', dest='use_title', help='use title in file name') + cmdl_parser.add_option('-l', '--literal', action='store_true', dest='use_literal', help='use literal 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_parser.add_option('-g', '--get-url', action='store_true', dest='get_url', help='print final video URL only') + cmdl_parser.add_option('-2', '--title-too', action='store_true', dest='get_title', help='used with -g, print title too') + (cmdl_opts, cmdl_args) = cmdl_parser.parse_args() +@@ -382,6 +383,26 @@ + + except KeyboardInterrupt: + sys.exit('\n') ++ ++# Convert to avi if needed ++if cmdl_opts.use_avi: ++ if cmdl_opts.outfile is None: ++ avi_filename = '%s.avi' % video_filename[:-4] ++ else: ++ avi_filename = '%s.avi' % video_filename ++ ++ try: ++ os.system('%%CONV2AVI_CMD%% "%s" "%s" > %s 2> %s' % (video_filename, avi_filename, os.path.devnull, os.path.devnull)) ++ cond_print('Video file converted to %s\n' % avi_filename) ++ except OSError: ++ sys.exit('Error: unable to convert file.\n') ++ except KeyboardInterrupt: ++ sys.exit('\n') ++ ++ try: ++ os.unlink(video_filename) ++ except OSError: ++ sys.exit('Error: unable to remove downloaded file.\n') + + # Finish + sys.exit() +--- youtube-dl.orig Wed Jan 30 14:18:50 2008
++++ youtube-dl Thu Jan 31 21:36:49 2008
+@@ -208,6 +208,7 @@
+ cmdl_parser.add_option('-t', '--title', action='store_true', dest='use_title', help='use title in file name')
+ cmdl_parser.add_option('-l', '--literal', action='store_true', dest='use_literal', help='use literal 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_parser.add_option('-g', '--get-url', action='store_true', dest='get_url', help='print final video URL only')
+ cmdl_parser.add_option('-2', '--title-too', action='store_true', dest='get_title', help='used with -g, print title too')
+ (cmdl_opts, cmdl_args) = cmdl_parser.parse_args()
+@@ -382,6 +383,26 @@
+
+ except KeyboardInterrupt:
+ sys.exit('\n')
++
++# Convert to avi if needed
++if cmdl_opts.use_avi:
++ if cmdl_opts.outfile is None:
++ avi_filename = '%s.avi' % video_filename[:-4]
++ else:
++ avi_filename = '%s.avi' % video_filename
++
++ try:
++ os.system('%%CONV2AVI_CMD%% "%s" "%s" > %s 2> %s' % (video_filename, avi_filename, os.path.devnull, os.path.devnull))
++ cond_print('Video file converted to %s\n' % avi_filename)
++ except OSError:
++ sys.exit('Error: unable to convert file.\n')
++ except KeyboardInterrupt:
++ sys.exit('\n')
++
++ try:
++ os.unlink(video_filename)
++ except OSError:
++ sys.exit('Error: unable to remove downloaded file.\n')
+
+ # Finish
+ sys.exit()
diff --git a/www/youtube_dl/files/ffmpeg.patch b/www/youtube_dl/files/ffmpeg.patch deleted file mode 100644 index 3a8c8005cd03..000000000000 --- a/www/youtube_dl/files/ffmpeg.patch +++ /dev/null @@ -1,60 +0,0 @@ ---- youtube-dl.orig Wed Mar 28 22:12:49 2007 -+++ youtube-dl Wed Mar 28 22:11:38 2007 -@@ -203,6 +203,7 @@ - cmdl_parser.add_option('-t', '--title', action='store_true', dest='use_title', help='use title in file name') - cmdl_parser.add_option('-l', '--literal', action='store_true', dest='use_literal', help='use literal 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_parser.add_option('-g', '--get-url', action='store_true', dest='get_url', help='print final video URL only') - (cmdl_opts, cmdl_args) = cmdl_parser.parse_args() - -@@ -275,13 +276,21 @@ - - # 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 or cmdl_opts.get_url): -@@ -328,7 +337,10 @@ - if cmdl_opts.simulate or cmdl_opts.get_url: - sys.exit() - -- video_file = open(video_filename, 'wb') -+ 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: -+ video_file = open(video_filename, 'wb') - try: - video_len = long(video_data.info()['Content-length']) - video_len_str = format_bytes(video_len) -@@ -382,7 +394,11 @@ - prefix = title_string_norm(video_title) - else: - prefix = title_string_touch(video_title) -- final_filename = '%s-%s.flv' % (prefix, video_url_id) -+ if cmdl_opts.use_avi: -+ ext = 'avi' -+ else: -+ ext = 'flv' -+ final_filename = '%s-%s.%s' % (prefix, video_url_id, ext) - os.rename(video_filename, final_filename) - cond_print('Video file renamed to %s\n' % final_filename) - |