📜 ⬆️ ⬇️

Adding TV Shows to iTunes

So I watched the entire Doctor House, that I had, and it was time for the next series. I watch TV shows on the road or at bedtime, lying in bed, from my player, and I like it when they lie neatly in the player, when each episode is numbered and has its own name.

iPod media library To keep the episodes in the player in their proper places, each of them needs to be registered: Title, Artist, TV Show Name, Episode Title, Episode Number, Track Number and Season Number.
Unfortunately, the torrents series in most cases are without tags, and they have to make their own. My favorite Tag & Rename did not cope with this task: it does not understand video-specific tags Episode title, Episode number and the like. Internet search mp4 tag editor'ov not crowned with success - they also do not see these tags. As a result, you had to manually poke into each file in iTunes and drive in the necessary data. While I stumbled upon iTunes COM.

And everything has become easier. It has everything you need to manage files: editing tags, managing playlists, covers, podcasts, in general, the entire library of iTunes.

For simplicity, I used JScript, because it runs on bare windows with no additional components. Just a couple of lines we get full control over the video file in the library:
')
var iTunesApp = WScript.CreateObject( "iTunes.Application" ); // iTunes var VideoPlaylist = iTunesApp.CreatePlaylist( "playlistName" ); // VideoPlaylist.AddFile( "c:\Episode_02.mp4" ); // var AddedVideos = VideoPlaylist.Tracks; var item = AddedVideos.Item(0); // item.EpisodeNumber = 1; // * This source code was highlighted with Source Code Highlighter .
  1. var iTunesApp = WScript.CreateObject( "iTunes.Application" ); // iTunes var VideoPlaylist = iTunesApp.CreatePlaylist( "playlistName" ); // VideoPlaylist.AddFile( "c:\Episode_02.mp4" ); // var AddedVideos = VideoPlaylist.Tracks; var item = AddedVideos.Item(0); // item.EpisodeNumber = 1; // * This source code was highlighted with Source Code Highlighter .
  2. var iTunesApp = WScript.CreateObject( "iTunes.Application" ); // iTunes var VideoPlaylist = iTunesApp.CreatePlaylist( "playlistName" ); // VideoPlaylist.AddFile( "c:\Episode_02.mp4" ); // var AddedVideos = VideoPlaylist.Tracks; var item = AddedVideos.Item(0); // item.EpisodeNumber = 1; // * This source code was highlighted with Source Code Highlighter .
  3. var iTunesApp = WScript.CreateObject( "iTunes.Application" ); // iTunes var VideoPlaylist = iTunesApp.CreatePlaylist( "playlistName" ); // VideoPlaylist.AddFile( "c:\Episode_02.mp4" ); // var AddedVideos = VideoPlaylist.Tracks; var item = AddedVideos.Item(0); // item.EpisodeNumber = 1; // * This source code was highlighted with Source Code Highlighter .
  4. var iTunesApp = WScript.CreateObject( "iTunes.Application" ); // iTunes var VideoPlaylist = iTunesApp.CreatePlaylist( "playlistName" ); // VideoPlaylist.AddFile( "c:\Episode_02.mp4" ); // var AddedVideos = VideoPlaylist.Tracks; var item = AddedVideos.Item(0); // item.EpisodeNumber = 1; // * This source code was highlighted with Source Code Highlighter .
  5. var iTunesApp = WScript.CreateObject( "iTunes.Application" ); // iTunes var VideoPlaylist = iTunesApp.CreatePlaylist( "playlistName" ); // VideoPlaylist.AddFile( "c:\Episode_02.mp4" ); // var AddedVideos = VideoPlaylist.Tracks; var item = AddedVideos.Item(0); // item.EpisodeNumber = 1; // * This source code was highlighted with Source Code Highlighter .
  6. var iTunesApp = WScript.CreateObject( "iTunes.Application" ); // iTunes var VideoPlaylist = iTunesApp.CreatePlaylist( "playlistName" ); // VideoPlaylist.AddFile( "c:\Episode_02.mp4" ); // var AddedVideos = VideoPlaylist.Tracks; var item = AddedVideos.Item(0); // item.EpisodeNumber = 1; // * This source code was highlighted with Source Code Highlighter .
var iTunesApp = WScript.CreateObject( "iTunes.Application" ); // iTunes var VideoPlaylist = iTunesApp.CreatePlaylist( "playlistName" ); // VideoPlaylist.AddFile( "c:\Episode_02.mp4" ); // var AddedVideos = VideoPlaylist.Tracks; var item = AddedVideos.Item(0); // item.EpisodeNumber = 1; // * This source code was highlighted with Source Code Highlighter .


To make the series look neat both in iTunes and in the player, you need to install the following tags:
EpisodeNumber and TrackNumber - episode number
Artist and Show - the name of the series
SeasonNumber - season number
Name and EpisodeID - episode title
VideoKind = 3 - mark as TV show


Of course, you can also manage other objects in your iTunes library. You can get full information from iTunes COM SDK (I had problems downloading from apple.com, so I uploaded it to Yandex )

I also offer a turnkey solution. Save this script in the same folder with the episodes of one season, create a list.txt file in the same folder. This file should contain episode information in the following format:
Name =
Season =
DeletePlaylist = (true|false) ( true)
TVShow = (true|false) ( true)

1
2
...

and run the script.

Source: https://habr.com/ru/post/69083/


All Articles