Sto utilizzando il registratore TV online per registrare programmi TV. Queste registrazioni vengono scaricate come podcast su iTunes. Il mio script Applescript seguente dovrebbe semplicemente afferrare quei podcast, aggiornare alcuni campi di informazioni e infine contrassegnarli come "serie TV" per visualizzarli in "Programmi TV" in iTunes.
Funziona molto bene, solo la parte in cui voglio impostare il tipo di video per il programma TV non sembra funzionare.
set video kind of aTrack to TV show
Ho anche dato uno sguardo a questo script di Doug che fa qualcosa di simile e non riesco a trovare alcuna differenza.
Ecco il mio copione 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