(*
Title: SyncTunes Plugin Template.scpt
Author: Paul Nesfield
Date: 14 July 2006
(c) 2006 Paul Nesfield
Summary:
Example of a pre or post Sync plugin script for use with SyncTunes.
If the Pre-Sync and/or Post-Sync advanced option are selected the
associated named Applescript .scpt script file will be run at the
beginning/end of the sync process. The post-sync script is run
before ejecting the volume, if eject has been selected.
Uses for the plugins are varied, such as deleting specific tracks instead
of a wholesale 'replace', writing destination to CD, manipulating the
M3U playlists.
The plugin comes with a set of parameters from the SyncTunes saved
preferences, written before the call to the plugin.
Notes:
SyncTunes has a preset time limit to wait for upto 15 minutes for the
plug-in to complete and return a success or fail result.
Do not use 'tell application "SyncTunes"' statements as SyncTunes is
will not respond as it is waiting for this plug-in to finish.
*)
try
(*=====================================
START OF PARAMETER DECLARATIONS
Set up variables with SyncTunes preference values using
the subroutine read_synctunes_parameter(parameter)
=====================================*)
(*=====================================
PLAYLIST Parameters - Main Window
=====================================*)
(* Interface element: Select playlist [text field]
Values: Name of the iTunes playlist *)
set PlaylistName to (read_synctunes_parameter("PlaylistName") as string)
(* Interface element: Current PDA tracks will be [radio buttons]
Values: 1=Replaced, 2=Merged *)
set CopyMusic to (read_synctunes_parameter("CopyMusic") as integer)
(* Interface element: Smart playlists will [checkbox]
Values: 0=false, 1=true *)
set UpdateMusic to (read_synctunes_parameter("UpdateMusic") as integer)
(* Interface element: Ignore playlist during sync [checkbox]
Values: 0=false, 1=true *)
set NoPL to (read_synctunes_parameter("NoPL") as integer)
(*=====================================
PLAYLIST Parameters - Advanced Settings
=====================================*)
(* Interface element: Playlist destination subfolder name [radio buttons]
Values: 1= Use iTunes playlist name
2= Let me specify *)
set SetPlaylistSubFolder to (read_synctunes_parameter("SetPlaylistSubFolder") as integer)
(* Interface element: Let me specify ... (playlist folder name) [text field]
Values: Subfolder name for playlist tracks*)
set PlaylistSubFolder to (read_synctunes_parameter("PlaylistSubFolder") as string)
(* Interface element: Reverse playlist sync order [checkbox]
Values: 0=false, 1=true *)
set RevSyncOrder to (read_synctunes_parameter("RevSyncOrder") as integer)
(* Interface element: Sync updates iTunes played date & counter [checkbox]
Values: 0=false, 1=true *)
set PlaylistFields to (read_synctunes_parameter("PlaylistFields") as integer)
(*=====================================
PODCAST Parameters - Main Window
=====================================*)
(* Interface element: Sync shows [checkbox]
Values: 0=false, 1=true *)
set SyncPodcasts to (read_synctunes_parameter("SyncPodcasts") as integer)
(* Interface element: Sync shows (types) [radio buttons]
Values: 1=All, 2=New *)
set CopyPodcastType to (read_synctunes_parameter("CopyPodcastType") as integer)
(* Interface element: Current PDA tracks will be [radio buttons]
Values: 1=Replaced, 2=Merged *)
set CopyPodcasts to (read_synctunes_parameter("CopyPodcasts") as integer)
(* Interface element: Delete podcasts in iTunes [checkbox]
Values: 0=false, 1=true *)
set DeletePodcasts to (read_synctunes_parameter("DeletePodcasts") as integer)
(*=====================================
PODCAST Parameters - Advanced Settings
=====================================*)
(* Interface element: Remove New Show mark in iTunes [checkbox]
Values: 0=false, 1=true *)
set PodcastNewShow to (read_synctunes_parameter("PodcastNewShow") as integer)
(* Interface element: Sync updates iTunes played date & counter [checkbox]
Values: 0=false, 1=true *)
set PodcastFields to (read_synctunes_parameter("PodcastFields") as integer)
(* Interface element: Date added within [checkbox]
Values: 0=false, 1=true *)
set PodcastDayLimit to (read_synctunes_parameter("PodcastDayLimit") as integer)
(* Interface element: Date added within (number) [popup list]
Values: 0=1 PodcastPeriod units, 1=2 PodcastPeriod units, etc *)
set PodcastNumber to (read_synctunes_parameter("PodcastNumberNew") as string)
(* Interface element: Date added within (period) [popup list]
Values: 0=hours, 1=days, 2=weeks *)
set PodcastPeriod to (read_synctunes_parameter("PodcastPeriodNew") as string)
(* Interface element: Only if enabled in iTunes [checkbox]
Values: 0=false, 1=true *)
set PodcastEnabled to (read_synctunes_parameter("PodcastEnabled") as integer)
(*=====================================
VOLUMES Parameters - Main Window
=====================================*)
(* Interface element: Browse volumes [text field]
Values: Name of destination volume *)
set VolumeName to (read_synctunes_parameter("VolumeName") as string)
(* Interface element: Destination folder [popup list]
Values: Destination folder as string *)
set DestFolder to (read_synctunes_parameter("DestFolder") as string)
(* Interface element: Transfer files which are [popup list]
Values: 0=All formats
1=MP3 format
2= AAC format
3= MP3 & AAC formats *)
set FileFormats to (read_synctunes_parameter("FileFormatsNew") as string)
(* Interface element: Eject volume after sync [checkbox]
Values: 0=false, 1=true *)
set EjectDisk to (read_synctunes_parameter("EjectDisk") as integer)
(*=====================================
VOLUMES Parameters - Advanced Settings
=====================================*)
(* Interface element: Use Simple Mode [checkbox]
Values: 0=false, 1=true *)
set SimpleMode to (read_synctunes_parameter("SimpleMode") as integer)
(* Interface element: Use Playlist Subfolder instead of destination top-level folder [checkbox]
Values: 0=false, 1=true *)
set UsePLinSM to (read_synctunes_parameter("UsePLinSM") as integer)
(* Interface element: Number of destination folder levels [popup list]
Values: 1, 2, 3 ,4 *)
set FolderLevels to (read_synctunes_parameter("FolderLevels") as string)
(* Interface element: Restrict lists to ejectable volumes [checkbox]
Values: 0=false, 1=true *)
set VolumeType to (read_synctunes_parameter("VolumeType") as integer)
(* Interface element: Use ID3 Name tag for filenames [checkbox]
Values: 0=false, 1=true *)
set ID3Names to (read_synctunes_parameter("ID3Names") as integer)
(* Interface element: Remove accents etc. in file and folder names ... [checkbox]
Values: 0=false, 1=true *)
set ConvertAccents to (read_synctunes_parameter("ConvertAccents") as integer)
(* Interface element: Create Artist/Album folder hierarchy [checkbox]
Values: 0=false, 1=true *)
set ArtistFolders to (read_synctunes_parameter("ArtistFolders") as integer)
(* Interface element: Use single Artist-Album folders [checkbox]
Values: 0=false, 1=true *)
set ArtistFoldersSingle to (read_synctunes_parameter("ArtistFoldersSingle") as integer)
(* Interface element: Create .m3u playlists [checkbox]
Values: 0=false, 1=true *)
set M3UPlaylists to (read_synctunes_parameter("M3UPlaylists") as integer)
(* Interface element: Create Artist/Album playlists [checkbox]
Values: 0=false, 1=true *)
set M3UPlaylistsArt to (read_synctunes_parameter("M3UPlaylistsArt") as integer)
(* Interface element: Use relative file paths [checkbox]
Values: 0=false, 1=true *)
set M3UPlaylistsRel to (read_synctunes_parameter("M3UPlaylistsRel") as integer)
(* Interface element: Use extended M3U format [checkbox]
Values: 0=false, 1=true *)
set M3UPlaylistsExt to (read_synctunes_parameter("M3UPlaylistsExt") as integer)
(* Interface element: Use Windows formattings [checkbox]
Values: 0=false, 1=true *)
set M3UPlaylistsWin to (read_synctunes_parameter("M3UPlaylistsWin") as integer)
(* Interface element: Convert transferred tracks using iTunes import settings [checkbox]
Values: 0=false, 1=true *)
set ConvertFiles to (read_synctunes_parameter("ConvertFiles") as integer)
(* Interface element: Convert transferred tracks using iTunes import settings (format) [popup list]
Values: 0=MP3, 1=AAC *)
set ConvertFilesType to (read_synctunes_parameter("ConvertFilesTypeNew") as string)
(* Interface element: Convert tracks of all file types [checkbox]
Values: 0=false, 1=true *)
set ConvertAllFiles to (read_synctunes_parameter("ConvertAllFiles") as integer)
(* Interface element: Minimum bitrate to reconvert [popup list]
Values: 0= 256kbps
1= 192kbps
2= 128kbps
3= 96kbps
4= 64kbps
5= 32kbps
6= 16kbps *)
set MinBitRate to (read_synctunes_parameter("MinBitRate") as string)
(*=====================================
SYNC & Other Parameters - Main Window
=====================================*)
(* Interface element: Quit after sync [checkbox]
Values: 0=false, 1=true *)
set QuitMe to (read_synctunes_parameter("QuitMe") as integer)
(* Interface element: Quit iTunes with SyncTunes [checkbox]
Values: 0=false, 1=true *)
set QuitiTunes to (read_synctunes_parameter("QuitiTunes") as integer)
(*=====================================
END OF PARAMETER DECLARATIONS
=====================================*)
(*=====================================
START OF MAIN PLUG-IN CODE BLOCK
=====================================*)
-->>>>>>> Replace with plugin specific code here <<<<<<<</em>
(*=====================================
END OF MAIN PLUG-IN CODE BLOCK
=====================================*)
-- Mandatory, must return true if successful
-- If not true SyncTunes will raise an alert
return true
on error theError
-- Mandatory, must return a result
return theError
end try
on read_synctunes_parameter(parameter)
return do shell script "defaults read com.Nesfield.SyncTunes " & parameter
end read_synctunes_parameter
Title: SyncTunes Plugin Template.scpt
Author: Paul Nesfield
Date: 14 July 2006
(c) 2006 Paul Nesfield
Summary:
Example of a pre or post Sync plugin script for use with SyncTunes.
If the Pre-Sync and/or Post-Sync advanced option are selected the
associated named Applescript .scpt script file will be run at the
beginning/end of the sync process. The post-sync script is run
before ejecting the volume, if eject has been selected.
Uses for the plugins are varied, such as deleting specific tracks instead
of a wholesale 'replace', writing destination to CD, manipulating the
M3U playlists.
The plugin comes with a set of parameters from the SyncTunes saved
preferences, written before the call to the plugin.
Notes:
SyncTunes has a preset time limit to wait for upto 15 minutes for the
plug-in to complete and return a success or fail result.
Do not use 'tell application "SyncTunes"' statements as SyncTunes is
will not respond as it is waiting for this plug-in to finish.
*)
try
(*=====================================
START OF PARAMETER DECLARATIONS
Set up variables with SyncTunes preference values using
the subroutine read_synctunes_parameter(parameter)
=====================================*)
(*=====================================
PLAYLIST Parameters - Main Window
=====================================*)
(* Interface element: Select playlist [text field]
Values: Name of the iTunes playlist *)
set PlaylistName to (read_synctunes_parameter("PlaylistName") as string)
(* Interface element: Current PDA tracks will be [radio buttons]
Values: 1=Replaced, 2=Merged *)
set CopyMusic to (read_synctunes_parameter("CopyMusic") as integer)
(* Interface element: Smart playlists will [checkbox]
Values: 0=false, 1=true *)
set UpdateMusic to (read_synctunes_parameter("UpdateMusic") as integer)
(* Interface element: Ignore playlist during sync [checkbox]
Values: 0=false, 1=true *)
set NoPL to (read_synctunes_parameter("NoPL") as integer)
(*=====================================
PLAYLIST Parameters - Advanced Settings
=====================================*)
(* Interface element: Playlist destination subfolder name [radio buttons]
Values: 1= Use iTunes playlist name
2= Let me specify *)
set SetPlaylistSubFolder to (read_synctunes_parameter("SetPlaylistSubFolder") as integer)
(* Interface element: Let me specify ... (playlist folder name) [text field]
Values: Subfolder name for playlist tracks*)
set PlaylistSubFolder to (read_synctunes_parameter("PlaylistSubFolder") as string)
(* Interface element: Reverse playlist sync order [checkbox]
Values: 0=false, 1=true *)
set RevSyncOrder to (read_synctunes_parameter("RevSyncOrder") as integer)
(* Interface element: Sync updates iTunes played date & counter [checkbox]
Values: 0=false, 1=true *)
set PlaylistFields to (read_synctunes_parameter("PlaylistFields") as integer)
(*=====================================
PODCAST Parameters - Main Window
=====================================*)
(* Interface element: Sync shows [checkbox]
Values: 0=false, 1=true *)
set SyncPodcasts to (read_synctunes_parameter("SyncPodcasts") as integer)
(* Interface element: Sync shows (types) [radio buttons]
Values: 1=All, 2=New *)
set CopyPodcastType to (read_synctunes_parameter("CopyPodcastType") as integer)
(* Interface element: Current PDA tracks will be [radio buttons]
Values: 1=Replaced, 2=Merged *)
set CopyPodcasts to (read_synctunes_parameter("CopyPodcasts") as integer)
(* Interface element: Delete podcasts in iTunes [checkbox]
Values: 0=false, 1=true *)
set DeletePodcasts to (read_synctunes_parameter("DeletePodcasts") as integer)
(*=====================================
PODCAST Parameters - Advanced Settings
=====================================*)
(* Interface element: Remove New Show mark in iTunes [checkbox]
Values: 0=false, 1=true *)
set PodcastNewShow to (read_synctunes_parameter("PodcastNewShow") as integer)
(* Interface element: Sync updates iTunes played date & counter [checkbox]
Values: 0=false, 1=true *)
set PodcastFields to (read_synctunes_parameter("PodcastFields") as integer)
(* Interface element: Date added within [checkbox]
Values: 0=false, 1=true *)
set PodcastDayLimit to (read_synctunes_parameter("PodcastDayLimit") as integer)
(* Interface element: Date added within (number) [popup list]
Values: 0=1 PodcastPeriod units, 1=2 PodcastPeriod units, etc *)
set PodcastNumber to (read_synctunes_parameter("PodcastNumberNew") as string)
(* Interface element: Date added within (period) [popup list]
Values: 0=hours, 1=days, 2=weeks *)
set PodcastPeriod to (read_synctunes_parameter("PodcastPeriodNew") as string)
(* Interface element: Only if enabled in iTunes [checkbox]
Values: 0=false, 1=true *)
set PodcastEnabled to (read_synctunes_parameter("PodcastEnabled") as integer)
(*=====================================
VOLUMES Parameters - Main Window
=====================================*)
(* Interface element: Browse volumes [text field]
Values: Name of destination volume *)
set VolumeName to (read_synctunes_parameter("VolumeName") as string)
(* Interface element: Destination folder [popup list]
Values: Destination folder as string *)
set DestFolder to (read_synctunes_parameter("DestFolder") as string)
(* Interface element: Transfer files which are [popup list]
Values: 0=All formats
1=MP3 format
2= AAC format
3= MP3 & AAC formats *)
set FileFormats to (read_synctunes_parameter("FileFormatsNew") as string)
(* Interface element: Eject volume after sync [checkbox]
Values: 0=false, 1=true *)
set EjectDisk to (read_synctunes_parameter("EjectDisk") as integer)
(*=====================================
VOLUMES Parameters - Advanced Settings
=====================================*)
(* Interface element: Use Simple Mode [checkbox]
Values: 0=false, 1=true *)
set SimpleMode to (read_synctunes_parameter("SimpleMode") as integer)
(* Interface element: Use Playlist Subfolder instead of destination top-level folder [checkbox]
Values: 0=false, 1=true *)
set UsePLinSM to (read_synctunes_parameter("UsePLinSM") as integer)
(* Interface element: Number of destination folder levels [popup list]
Values: 1, 2, 3 ,4 *)
set FolderLevels to (read_synctunes_parameter("FolderLevels") as string)
(* Interface element: Restrict lists to ejectable volumes [checkbox]
Values: 0=false, 1=true *)
set VolumeType to (read_synctunes_parameter("VolumeType") as integer)
(* Interface element: Use ID3 Name tag for filenames [checkbox]
Values: 0=false, 1=true *)
set ID3Names to (read_synctunes_parameter("ID3Names") as integer)
(* Interface element: Remove accents etc. in file and folder names ... [checkbox]
Values: 0=false, 1=true *)
set ConvertAccents to (read_synctunes_parameter("ConvertAccents") as integer)
(* Interface element: Create Artist/Album folder hierarchy [checkbox]
Values: 0=false, 1=true *)
set ArtistFolders to (read_synctunes_parameter("ArtistFolders") as integer)
(* Interface element: Use single Artist-Album folders [checkbox]
Values: 0=false, 1=true *)
set ArtistFoldersSingle to (read_synctunes_parameter("ArtistFoldersSingle") as integer)
(* Interface element: Create .m3u playlists [checkbox]
Values: 0=false, 1=true *)
set M3UPlaylists to (read_synctunes_parameter("M3UPlaylists") as integer)
(* Interface element: Create Artist/Album playlists [checkbox]
Values: 0=false, 1=true *)
set M3UPlaylistsArt to (read_synctunes_parameter("M3UPlaylistsArt") as integer)
(* Interface element: Use relative file paths [checkbox]
Values: 0=false, 1=true *)
set M3UPlaylistsRel to (read_synctunes_parameter("M3UPlaylistsRel") as integer)
(* Interface element: Use extended M3U format [checkbox]
Values: 0=false, 1=true *)
set M3UPlaylistsExt to (read_synctunes_parameter("M3UPlaylistsExt") as integer)
(* Interface element: Use Windows formattings [checkbox]
Values: 0=false, 1=true *)
set M3UPlaylistsWin to (read_synctunes_parameter("M3UPlaylistsWin") as integer)
(* Interface element: Convert transferred tracks using iTunes import settings [checkbox]
Values: 0=false, 1=true *)
set ConvertFiles to (read_synctunes_parameter("ConvertFiles") as integer)
(* Interface element: Convert transferred tracks using iTunes import settings (format) [popup list]
Values: 0=MP3, 1=AAC *)
set ConvertFilesType to (read_synctunes_parameter("ConvertFilesTypeNew") as string)
(* Interface element: Convert tracks of all file types [checkbox]
Values: 0=false, 1=true *)
set ConvertAllFiles to (read_synctunes_parameter("ConvertAllFiles") as integer)
(* Interface element: Minimum bitrate to reconvert [popup list]
Values: 0= 256kbps
1= 192kbps
2= 128kbps
3= 96kbps
4= 64kbps
5= 32kbps
6= 16kbps *)
set MinBitRate to (read_synctunes_parameter("MinBitRate") as string)
(*=====================================
SYNC & Other Parameters - Main Window
=====================================*)
(* Interface element: Quit after sync [checkbox]
Values: 0=false, 1=true *)
set QuitMe to (read_synctunes_parameter("QuitMe") as integer)
(* Interface element: Quit iTunes with SyncTunes [checkbox]
Values: 0=false, 1=true *)
set QuitiTunes to (read_synctunes_parameter("QuitiTunes") as integer)
(*=====================================
END OF PARAMETER DECLARATIONS
=====================================*)
(*=====================================
START OF MAIN PLUG-IN CODE BLOCK
=====================================*)
-->>>>>>> Replace with plugin specific code here <<<<<<<</em>
(*=====================================
END OF MAIN PLUG-IN CODE BLOCK
=====================================*)
-- Mandatory, must return true if successful
-- If not true SyncTunes will raise an alert
return true
on error theError
-- Mandatory, must return a result
return theError
end try
on read_synctunes_parameter(parameter)
return do shell script "defaults read com.Nesfield.SyncTunes " & parameter
end read_synctunes_parameter
