• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Renaming TV Episodes.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Renaming TV Episodes.


  • Subject: Renaming TV Episodes.
  • From: Manuel <email@hidden>
  • Date: Sat, 22 Dec 2012 11:53:30 +0100

Hi all, 

I have tried to make a folder action that renames the subtitle file and moves it with the video file to another folder.
Once the folder gets a new subtitle file, it compares the first 4 characters of the subtitle file with the name of every video file in the folder, if it matchs, it renames the subtitle. (That´s how it should work)
Sometimes when there are 2 or 3 files in the folder, it works. But when I have several subtitles and video files, it does not. 
Please tell me what I´m doing wrong. 
The source code is in spanish. If anyone wants it in english, please let me know. 

Thanks to all of you, and Merry Christmas. 

on adding folder items to this_folder after receiving these_items
subtituloSeries()
end adding folder items to

on subtituloSeries()
tell application "Finder"
delay 1
-- Indicamos las carpetas de origen y destino para los subtitulos y videos
set origen to folder "TV SERIES" of disk "WINOSX"
set destinofinal to alias "WINOSX:TV SERIES:Series Subtituladas:"
-- Hacemos una lista con las extensiones de video que buscará 
set listaExtensiones to {"mkv", "mp4", "avi"}


try
-- Inciamos un bucle para que cuente el numero de archivos en origen
repeat with i from 1 to the count of files in origen
-- Asignamos a subtituloBajado el archvivo de subtitulo
set subtituloBajado to (item i of origen whose name extension is "srt")
-- Asignamos a capituloBajado el archivo de video
set capituloBajado to (item i of origen whose name extension is in listaExtensiones)
set nombrecapitulo to name of capituloBajado
-- Asignamos a NombrecapituloSinExtension el nombre del capitulo sin extensión
set NombrecapituloSinExtension to (characters 1 thru -5 in nombrecapitulo as string)
-- Aqui comprobamos que si el subtitulo contiene los primeros 4 caracteres del nombre del episodio, renombre el subtitulo al capitulo y le añada la extension srt
if name of subtituloBajado contains (characters 1 thru 4) in nombrecapitulo then
set the name of subtituloBajado to NombrecapituloSinExtension & ".srt"


end if
-- Chequeamos si existe un subtitulo con el mismo nombre que un capitulo, y si es así los mueve al destino final (Carpeta de Series Subtituladas)
if name of subtituloBajado contains NombrecapituloSinExtension then
delay 2
move subtituloBajado to destinofinal
delay 2
move capituloBajado to destinofinal
end if
end repeat
end try
end tell
end subtituloSeries







 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Prev by Date: Re: do script in FileMaker 12
  • Next by Date: Creating a New File In a Folder with WriteRoom
  • Previous by thread: Re: do script in FileMaker 12
  • Next by thread: Creating a New File In a Folder with WriteRoom
  • Index(es):
    • Date
    • Thread