Page 1 of 1

Converting to Hazel

PostPosted: Mon Dec 09, 2013 10:29 pm
by ondrovic
Could really use some help getting this converted over to an hazel rule to automatically add the s0 e0 to tv shows
Code: Select all
on makeEpisodeIdentifier(strSeasonNumber, strEpisodeNumber)
   
   set intSeason to strSeasonNumber as integer
   set intEpisode to strEpisodeNumber as integer
   
   if intSeason ≤ 9 then
      set strReturn to "S0" & strSeasonNumber
   else
      set strReturn to "S" & strSeasonNumber
   end if
   
   if intEpisode ≤ 9 then
      set strReturn to strReturn & "E0" & strEpisodeNumber
   else
      set strReturn to strReturn & "E" & strEpisodeNumber
   end if
   
   return strReturn
   
end makeEpisodeIdentifier

Re: Converting to Hazel

PostPosted: Tue Dec 10, 2013 1:51 pm
by Mr_Noodle
There seems to be quite a few details missing here like where the season and episode numbers are coming from. Assuming they are included in the name of the file, you can use match patterns (search for it in the help) to pull that info out. You can then format the numbers with leading zeros when using it in a rename or sort pattern.