Estoy usando un grabador de TV online para grabar programas de TV. Esas grabaciones se descargan como podcast en iTunes. Mi siguiente Applescript debería coger esos podcasts, actualizar algunos campos de información y finalmente marcarlos como "programa de TV" para que aparezcan en "Programas de TV" en iTunes.
Funciona muy bien, sólo la parte en la que quiero poner el tipo de vídeo en programa de televisión no parece funcionar.
set video kind of aTrack to TV show
También eché un vistazo a el script de este Doug que hace algo parecido y no encuentro ninguna diferencia.
Aquí está mi script completo:
on matchRegExp(regex, txt, |caseSensitive?|)
if |caseSensitive?| then
set ci to "i"
else
set ci to ""
end if
set theRubyOneLiner to quote & "s = '" & txt & "'; s =~ /" & regex & "/" & ci & "; puts Regexp.last_match.to_a" & quote
set theCommand to "ruby -e " & theRubyOneLiner
set theMatchData to do shell script theCommand
set tid to AppleScript's text item delimiters
set AppleScript's text item delimiters to character id 13 -- new line
set theMatchData to the text items of theMatchData
set AppleScript's text item delimiters to tid
theMatchData
end matchRegExp
tell application "iTunes"
set myLib to library playlist 1
set pods to every track of library playlist 1 whose genre is "Podcast" and album is "Online Videorecorder"
set ofi to fixed indexing
set fixed indexing to true
with timeout of 3000 seconds
repeat with aTrack in pods
set desc to long description of aTrack
try
set episode to last item of my matchRegExp("(Folge|Episode) (\\d+)", desc, true)
set season to last item of my matchRegExp("(Staffel|Season) (\\d+)", desc, true)
end try
set series to name of aTrack
set title to description of aTrack
set cat to category of aTrack
try
set video kind of aTrack to TV show
on error m
log m
end try
set episode number of aTrack to episode
set season number of aTrack to season
set show of aTrack to series
set episode ID of aTrack to title
set description of aTrack to desc
end repeat
end timeout
set fixed indexing to ofi
end tell