首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >刻录视频文件以备份DVD

刻录视频文件以备份DVD
EN

Stack Overflow用户
提问于 2014-03-22 23:50:12
回答 1查看 127关注 0票数 0

我正在制作一台AppleScript,用来烧掉教堂布道的文件,以供备份。谈谈我们的进程。

我们有一个索尼数码摄录机,我们用它来拍摄这项服务。我将这些文件下载到iMovie中,创建一个iMovie项目,并将这些部分缝合在一起。我添加了一个开头的标题&结束学分,并以两种决议分享给媒体浏览器。在那之后,我把小解析度文件上传到我们教会的网站上。然后使用更大的分辨率文件创建一个iDVD项目。

我已经获得了带有开头标题的iMovie项目的模板&其中已经包含了闭幕学分,还有一个用于iDVD项目的模板,以及另一个用于打印DVD标签的模板。我已经编写了一个AppleScript,它在特定的一周内复制这些模板。效果很好。

我在第二个脚本上做了很多工作,以便在我的桌面文件夹中创建一个刻录文件夹,并在其中创建文件夹&为原始文件创建别名/快捷方式。但是,考虑到这是我们在这里复制的视频,我需要确保所需的最小数据量被刻录到磁盘上。

具体来说,本周原始视频的iMovie事件文件夹中有两个由iMovie创建的文件夹,我不想刻录到DVD中。一个是缓存,另一个是缩略图。如果在打开iMovie时由于任何原因必须恢复备份,则应该重新创建这些备份。

因此,我只想复制事件文件夹中不是这两个文件夹的文件。这些文件夹称为iMovie Movie CacheiMovie Thumbnails

如何排除这两个文件?我得到的密码如下。

代码语言:javascript
复制
-- Script to copy the iMovie project, the iDVD project, and the DVD Label
-- files for a particular week's sermon into a burn folder and then burn it.
property iMovieEvents : alias ((path to movies folder as text) & "iMovie Events.localized:")
property iMovieProjects : alias ((path to movies folder as text) & "iMovie Projects.localized:")
property iMovieSermonsPath : alias ((iMovieProjects as text) & "Sermons:")
property sermonDocumentsPath : alias ((path to documents folder as text) & "Sermons:")

global burnFolder
global thisSermonsPath
global thisSermonsDvdLabels
global thisSermonsdvdproj
global thisSermonsiMovieEvents
global thisSermonsiMovieProject
global sermonCode

to copySermonFiles()
    -- Start a conversation with the Finder
tell application "Finder"
        -- Create a folder in the burn folder for the iMovie Events
        set theFolder to my createFolder(burnFolder, "iMovie Events.localized")

        -- Give this operation 5 mintues to complete        
        with timeout of (5 * 60) seconds
            -- Copy the Sermon's iMovie Events folder to the Burn Folder.
            -- Need to exclude the iMovie Movie Cache & iMovie Thumbnails folders here
            make new alias at theFolder to folder thisSermonsiMovieEvents
        end timeout

        -- Create a folder in the burn folder for the Sermon's iMovie Project.
        set theFolder to my createFolder(burnFolder, "iMovie Projects.localized")

        with timeout of (5 * 60) seconds
            -- Copy the Sermon's iMovie Project file to the Burn Folder
            make new alias at theFolder to file thisSermonsiMovieProject
        end timeout

        -- Create a folder in the burn folder for the Sermon's documents
        set theFolder to my createFolder(burnFolder, "Documents")

        -- Create a folder in the burn folder's Documents folder for the sermon
        set theFolder to my createFolder(theFolder, sermonCode)

        -- Copy the Sermon's iDVD Project and DVD Labels files to the Burn Folder
        make new alias at theFolder to thisSermonsDvdLabels
        make new alias at theFolder to thisSermonsdvdproj
    end tell
end copySermonFiles

-- Helper method that creates a new folder named theName in the dst folder.
to createFolder(dst, theName)
    -- Create a string that contains the path to the folder we're going to create
    set thePath to (dst as text) & theName

    -- Start a conversation with the Finder
    tell application "Finder"
        -- Does the folder exist already?
        if not (exists thePath) then
            return make new folder at dst with properties {name:theName}
        else
            return alias thePath
        end if
    end tell
end createFolder

to createBurnFolder()
    -- Create the name of the Burn Folder
    set burnFolderName to sermonCode & ".fpbf"
    set desktopPath to (path to desktop) as text

    -- Compute the path to the Sermon's folder in the Documents:Sermons folder.
    set burnFolderPath to desktopPath & burnFolderName

    -- Start a conversation with the Finder
    tell application "Finder"
        -- Does the burn folder exist?
        if not (exists burnFolderPath) then
            -- Create the burn folder
            set burnFolder to make new folder at desktopPath with properties {name:burnFolderName}
        else
            set burnFolder to folder burnFolderPath
        end if
    end tell
end createBurnFolder

to getThisSermonsFiles()
    -- Ask the user to pick the Sermon's iMovie Project file.
    set thisSermonsiMovieProject to choose file with prompt "Please select the Sermon's iMovie Project:" default location iMovieSermonsPath

    -- Extract the sermon code from the Sermon's iMovie Project file name.
    set fileext to ".rcproject"
    set fileName to (name of (info for thisSermonsiMovieProject))
    set sermonCode to text 1 thru ((length of fileName) - (length of fileext)) of fileName

    -- Build the path to the Sermon's iMovie Events folder
    set thisSermonsiMovieEvents to ((iMovieEvents as text) & sermonCode & ":")

    -- Build the path to the Sermon's DVD & DVD Labels files.
    set thisSermonsPath to (sermonDocumentsPath as text) & sermonCode & ":"

    -- Build the path to this Sermon's DVD Labels file.
    set thisSermonsDvdLabels to alias (thisSermonsPath & sermonCode & ".cndx")

    -- Build the path to this sermon's iDVD Project file.
    set thisSermonsdvdproj to alias (thisSermonsPath & sermonCode & ".dvdproj")
end getThisSermonsFiles

on run
    -- Get the sermon code from the user
    getThisSermonsFiles()

    -- Create the Burn folder
    createBurnFolder()

    -- Copy the files into the burn folder.
    copySermonFiles()
end run
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-03-23 09:38:02

搜索者有一个“谁的”克劳斯,这使得过滤一个查找项列表很容易。因此,我们可以用它来排除事物。您也可以将文件或文件夹称为“项”,以便将两者都包含在一个短语中。因此,如果您想从一个文件夹中获得对所有文件和文件夹的引用,但不包括某些项目的名称,那么这样的操作是可行的.

代码语言:javascript
复制
set itemNamesToExclude to {"iMovie Movie Cache", "iMovie Thumbnails"}

tell application "Finder"
    set itemsToMove to items of folder thisSermonsiMovieEvents whose name is not in itemNamesToExclude
    -- move itemsToMove somewhere
end tell
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22585215

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档