A Python/Objective-C script that borrows AppleScript to present a choose file, and choose folder dialog that obtains your list of .mov files to tag, and the target folder where they are to be tagged. Any .mov file that is both in the list, and within that folder will get tagged — in your case orange. This can be set once in the code. This was tested with the default Python 2.7.10 in OS X 10.11.3, and is run from Launchpad : Other : Terminal.
If you have a real programmer's editor (not AppleScript Script Editor), then copy/paste the following code into it and save as tags.py. Otherwise, open a new TextEdit document, select Format menu : Make Plain Text, and then copy/paste into that document. Save as tags.py.
I suggest that you make a test directory with a few .mov files in it, and a paired down list to go with it. Run the Python script against that data and folder.
You still need to make this Python script executable, so in the Terminal window, and then run it.
$ chmod +x tags.py
$ ./tags.py
Code:
#!/usr/bin/python
# coding: utf-8
'''
program: tag.py
Summary: Read master file containing files to be tagged in specified
folder. Utilizes AppleScript for user file and folder access.
Tested: Default OS X 10.11.3 Python v2.7.10. Uses Python/ObjC bridge
Version: 1.1
Author: VikingOSX, Mar 1, 2016, Apple Support Communities
'''
from Foundation import NSAppleScript, NSURL, NSURLLabelNumberKey
import os
import sys
colors = {'none': 0, 'grey': 1, 'green': 2, 'purple': 3, 'blue': 4,
'yellow': 5, 'red': 6, 'orange': 7}
tag_color = 'orange'
mov_type = '.mov'
AS = '''
property defloc : path to desktop folder
property msg1 : "Provide the input file with .mov filenames:"
property msg2 : "Select folder containing .mov files to tag:"
tell application "Finder"
activate
set movFile to POSIX path of (choose file with prompt msg1 default location defloc invisibles no)
set movFolder to POSIX path of (choose folder with prompt msg2 default location defloc invisibles no)
end tell
return {movFile, movFolder}
'''
def set_tag(afile, acolor):
fileURL = NSURL.fileURLWithPath_(afile)
fileURL.setResourceValue_forKey_error_(colors[acolor],
NSURLLabelNumberKey, None)
return
try:
t = NSAppleScript.alloc().initWithSource_(AS)
result = t.executeAndReturnError_(None)
mov_file = result[0].descriptorAtIndex_(1).stringValue().encode('utf-8')
tag_folder = (result[0].descriptorAtIndex_(2).stringValue().
encode('utf-8').rstrip('/'))
except (AttributeError, TypeError):
sys.exit('User pressed cancel… ending application')
# read in the file with list of .mov to tag.
with open(mov_file, 'r') as f:
mov_list = [x.strip() for x in f.readlines()]
# get list of .mov files to be tagged in the selected folder
mov_folder_items = filter(lambda f: not f.startswith('.') and
f.endswith(mov_type), os.listdir(tag_folder))
# list of common .mov files from the file listing and tagging folder
tagged_items = set(mov_list) & set(mov_folder_items)
# put an orange tag on specified .mov files
[set_tag(os.path.join(tag_folder, x), tag_color) for x in tagged_items if tagged_items]
sys.exit()