Export custom template
#1
Hello,

I'm trying to create a template for exporting an XML of my movies.
It works almost completely!

Here is the list.jmte :

Code:
<?xml version="1.0" encoding="UTF-8"?>
<movies>${foreach movies movie}
    <movie>
        <id>${movie.id}</id>
        <tmdbId>${movie.ids.tmdbId}</tmdbId>
        <imdbId>${movie.ids.imdbId}</imdbId>
        <dateAdded>${movie.dateAdded;date(yyyy-MM-dd)}</dateAdded>
        <title>${movie.title}</title>
        <originalTitle>${movie.originalTitle}</originalTitle>
        <movieSet>${movie.movieSet}</movieSet>
        <year>${movie.year}</year>
        <releaseDate>${movie.releaseDate;date(yyyy-MM-dd)}</releaseDate>
        <plot>${movie.plot}</plot>
        <watched>${movie.watched}</watched>
        <rating>${movie.rating}</rating>
        <runtime>${movie.runtime}</runtime>
        <director>${movie.director}</director>
        <country>${movie.country}</country>
        <genres>${foreach movie.genres genre}
            <genre>${genre}</genre>${end}
        </genres>
        <writers>${foreach movie.writer writer}
            <writer>${writer}</writer>${end}
        </writers>
        <actors>${foreach movie.actors actor}
            <actor>
                <name>${actor.name}</name>
                <character>${actor.character}</character>
                <thumbUrl>${actor.thumbUrl}</thumbUrl>
            </actor>${end}
        </actors>
        <images>
            <posterUrl>${movie.posterUrl}</posterUrl>
            <fanartUrl>${movie.fanartUrl}</fanartUrl>
            <bannerUrl>${movie.bannerUrl}</bannerUrl>
            <thumbUrl>${movie.thumbUrl}</thumbUrl>
        </images>
        <trailer>${foreach movie.trailers trailer}${if trailer.inNfo=true}${trailer.url}${end}${end}</trailer>
        <files>${foreach movie.mediaFiles file} ${if file.type="VIDEO"}
            <file>
                <name>${file.filename}</name>
                <path>${file.path}</path>
                <file>${file.file}</file>
                <size>${file.filesize}</size>
                <vcodec>${file.videoCodec}</vcodec>
                <vresolution>${file.videoWidth} x ${file.videoHeight}</vresolution>
            </file>${end}${end}
        </files>
    </movie>${end}
</movies>

I have two problems:

1) ${movie.id} don't work. Well, not always! Here is the error log:
Code:
ERROR [main] o.t.u.movies.dialogs.MovieExporterDialog:171 - Error exporting movies: Error while parsing 'movie.id' at location (4:15): Property 'id' on object '...' can not be accessed: "java.lang.IllegalArgumentException: wrong number of arguments"!
However, the "id" object in "Movie" exists ! How to have the ID of the movie in TMM ?

2) The last block "<files>" don't work. If I remove all the block, the export works. When I'm debugging ${movie}, it seems correct but ${foreach movie.mediaFiles file} does not work (even movie.mediaFile). Any idea ?

I have TMM v2.6.9 ; on Windows 7.

Thanks for reading Wink
#2
1) movies.id contains a map of all known ids; I suppose you only want to take

<tmdbId>${movie.tmdbId}</tmdbId>
<imdbId>${movie.imdbId}</imdbId>

2) the block

<file>${file.file}</file>

seems a bit strange to me (MediaFile.file is an abstraction of the "real" file - what did you expect here? you already put the path & filename above..)
tinyMediaManager - THE media manager of your choice - available for Windows, macOS and Linux
Help us translate tinyMediaManager at Weblate | Translations at 66%
Found a bug or want to submit a feature request? Contact us at GitLab
#3
1) Yes I already take tmdbId and imdbId. What I want is to recover the id generated by TMM. Sometimes, it works and I have it but this is rare...

2) Ok you're right but even if I remove the <file>${file.file}</file> block, it doesn't work :/
It works only when I delete ALL the <files> block.
#4
just checked it at home (with the new development version)

a) we do not have any internal ID, so there is no need to export it Big Grin
b) I saw a typo - it should be movie.trailer instead of movie.trailers (after changing that, the block with media files worked for me)

but I saw we did some internal changes, which will affect all existing export templates - have to check that too Sad
tinyMediaManager - THE media manager of your choice - available for Windows, macOS and Linux
Help us translate tinyMediaManager at Weblate | Translations at 66%
Found a bug or want to submit a feature request? Contact us at GitLab
#5
1) Ok, however I had a number few times.
Also, the export "ListExampleHtml" contains this : ShowDetails(det${movie.id})
And this export does not work Wink

For me, it's okay if I do not have ID, I will do otherwise Smile

2) Thanks! It works now Smile
#6
IIRC, movie.id was set by the scraper - the movie ID of that one site.
We reworked that in latest development version (we store now all kinds of IDs, from various sites)

But we don't have/maintain an internal TMM ID (we don't care)
Export templates need a bit more testing.... already on our list
stay tuned Smile

Feel free to test our nightly build (NOT on your productive movies!)
tinyMediaManager - THE media manager of your choice :)
Wanna help translate TMM ?
Image
#7
Ok thank you.

I will test the nightly build Smile
#8
I forgot, is it planned to be able to launch an export from the command line?

Example : tinyMediaManagerCMD.exe -export {export-name} {destination_folder}

Also, why not give the possibility to export the new items.
#9
a) good idea - will put it on our todo list
b) well just exporting new items won't be a good idea; the export templates we have are only list and list/detail ones. Both are re-written on every export, so a "new item" export will only write the new items into the list and drop the old ones..
tinyMediaManager - THE media manager of your choice - available for Windows, macOS and Linux
Help us translate tinyMediaManager at Weblate | Translations at 66%
Found a bug or want to submit a feature request? Contact us at GitLab
#10
a) Nice Smile
b) Ok, you're right Wink
#11
How can I put the file size in GB or Mb, and the file duration in Minutes?
I use the following:
Filesize
{movie.runtimeFromMediaFiles} or {movie.mainVideoFile.filesize}
Runtime
{movie.runtimeFromMediaFiles}
But with this configuration, when exporting it does it in Bytes and Seconds
#12
(2020-09-17, 15:20)Gaby Pozo Wrote: How can I put the file size in GB or Mb, and the file duration in Minutes?
I use the following:
Filesize
{movie.runtimeFromMediaFiles} or {movie.mainVideoFile.filesize}
Runtime
{movie.runtimeFromMediaFiles}
But with this configuration, when exporting it does it in Bytes and Seconds
I can tell you to put runtime in hrs and minutes the command line will be {movie.mainVideoFile.durationHM} but I'm not sure of filesize yet
#13
That worked for me thanks, now it only remains to fix the filesize
#14
(2020-09-17, 15:20)Gaby Pozo Wrote: {movie.mainVideoFile.filesize}

You could use "filesizeInMegabytes" in place of "filesize".
#15
(2020-09-18, 12:39)tars Wrote:
(2020-09-17, 15:20)Gaby Pozo Wrote: {movie.mainVideoFile.filesize}

You could use "filesizeInMegabytes" in place of "filesize".
Is there a way to show it in Gigabytes? I tried {movie.mainVideoFile.filesizeInGigabytes} but that didn't work.

Logout Mark Read Team Forum Stats Members Help
Export custom template0