substitute all special characters but dashes with '_'

discussed with and ok pedro
This commit is contained in:
sturm 2007-06-23 05:16:22 +00:00
parent 140ec0f2e9
commit a9d3b89a95
2 changed files with 4 additions and 3 deletions

View File

@ -1,8 +1,8 @@
# $OpenBSD: Makefile,v 1.5 2007/06/19 17:32:52 pedro Exp $
# $OpenBSD: Makefile,v 1.6 2007/06/23 05:16:22 sturm Exp $
COMMENT= "customizable script to fetch youtube videos"
PKGNAME= yt-4
PKGNAME= yt-5
CATEGORIES= net
DISTFILES=

View File

@ -1,5 +1,5 @@
#!%%LOCALBASE%%/bin/lua
-- $OpenBSD: yt.lua,v 1.3 2007/06/19 17:32:52 pedro Exp $
-- $OpenBSD: yt.lua,v 1.4 2007/06/23 05:16:22 sturm Exp $
-- Fetch videos from YouTube.com and convert them to MPEG.
-- Written by Pedro Martelletto in August 2006. Public domain.
-- Example: lua yt.lua http://www.youtube.com/watch?v=c5uoo1Kl_uA
@ -28,6 +28,7 @@ title = assert(string.match(body, pattern))
-- Build a name for the files the video will be stored in.
file = string.gsub(title, " ", "_")
file = string.gsub(title, "[^%w-]", "_")
file = "youtube-" .. string.lower(file)
flv = file .. ".flv"
avi = file .. ".avi"