Kodi Community Forum

Full Version: Template to export TV Shows Information into Excel
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all, 

As I did in another post where I did a template to export all avaible fields for movies into Excel, now I want to build a template to export information from a TV Show.

As a TV Show, I have take out single episode xml, so I am going to generate just a Sum Up of the TV Show in itself, and a detail XML with the information off every episode.

First, this is the template I have used for TV Show general information (list.jmte)

Code:

<?xml version="1.0" encoding="utf-8"?>
<tvshows>
<!-- iterate over all TV shows -->
${foreach tvShows show}
  <tvshow>
    <Title>${show.title}</Title>
    <Year>${show.year}</Year>
    <Seasons>${show.seasonCount}</Seasons>
    <Episodes>${show.episodeCount}</Episodes>
    <Plot>${show.plot}</Plot>
    <Path>${show.path}</Path>
    <tvdbId>${show.tvdbId}</tvdbId>
    <imdbId>${show.imdbId}</imdbId>
    <Genres>${show.genresAsString}</Genres>
    <certificacion>${show.certification}</certificacion>
    </tvshow>
${end}
</tvshows>

Second, I have began to work into the detail template (detail.jmte), which it is right now as follow:

Code:

<?xml version="1.0" encoding="utf-8"?>
<tvshow>
  <TVShow>${tvShow.title}</TVShow>
  <seasons>${tvShow.seasonCount}</seasons>
  <episodes>${tvShow.episodeCount}</episodes>

  <!-- iterate over all episodes -->
  ${foreach tvShow.episodes episode}
   <episode>
    <title>${episode.title}</title>
    <season>${episode.season}</season>
    <episode>${episode.episode}</episode>
    <Audio>${episode.mediaInfoAudioCodecAndChannels}</Audio>
    <VideoCodec>${episode.mediaInfoVideoCodec}</VideoCodec>
    <Formato>${episode.mediaInfoVideoFormat}</Formato>
    <Duracion>${episode.runtimeFromMediaFiles}</Duracion>
  </episode>
  ${end}
</tvshow>

This last syntax is working properly getting information from the TvShowEpisode list that I got from Wiki template page

Now... what I want is to include to that detail.jmte file, a list with the mediafile information of every episode of the show, and here is where I got stacked.

Let's say I just want to get "filesize" information.  Knowing that, it would be easy to guess how to get the other fields. 

I need help in doing this....  This is what I thought, but it is not working, so any help would be appreciated.

Code:

<?xml version="1.0" encoding="utf-8"?>
<tvshow>
  <TVShow>${tvShow.title}</TVShow>
  <seasons>${tvShow.seasonCount}</seasons>
  <episodes>${tvShow.episodeCount}</episodes>

  <!-- iterate over all episodes -->
  ${foreach tvShow.episodes episode}
   <episode>
    <title>${episode.title}</title>
    <season>${episode.season}</season>
    <episode>${episode.episode}</episode>
    <Audio>${episode.mediaInfoAudioCodecAndChannels}</Audio>
    <VideoCodec>${episode.mediaInfoVideoCodec}</VideoCodec>
    <Formato>${episode.mediaInfoVideoFormat}</Formato>
    <Duracion>${episode.runtimeFromMediaFiles}</Duracion>
  </episode>
  ${end}

  <!-- iterate over all mediaFiles -->
  ${foreach tvShow.mediaFiles mediafiles}
   <mediafiles>
    <filesize>${episodeFile.filesize}</filesize>
  </mediafiles>

</tvshow>

As you can see, I have completely "invented" how to go through all mediafiles for each episode.

Code:

  <!-- iterate over all mediaFiles -->
  ${foreach tvShow.mediaFiles mediafiles}
   <mediafiles>
    <filesize>${episodeFile.filesize}</filesize>
  </mediafiles>

How should I do it?  It didn't worked as supposed.

Thanks in advanced.
Hi, I have another question related with this topic (please, don't forget to answer me to the previous message).

I have realized that exporting let's say 5 TV shows, the detail.jmte template generates 5 different xml files, instead of just one xml file containing all 5 TV shows.

If I want to export the episode's detail of my 60 TV shows, it would be a mess to have 60 different xml files and have them unified into a unique one.

How can I get all TV shows episode details into a single xml file?

Thanks in advanced.
This is how it is designed:

The "list" creates one file with everything,
and the additional "detail" will create one file/folder for each entry,
and the "episode" even files for every episode...

What do you want to archieve?