1
// Default MediaTomb dvd import script.
2
// see MediaTomb scripting documentation for more information
6
MediaTomb - http://www.mediatomb.cc/
8
import-dvd.js - this file is part of MediaTomb.
10
Copyright (C) 2006-2009 Gena Batyan <bgeradz@mediatomb.cc>,
11
Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>,
12
Leonhard Wimmer <leo@mediatomb.cc>
14
This file is free software; the copyright owners give unlimited permission
15
to copy and/or redistribute it; with or without modifications, as long as
16
this notice is preserved.
18
This file is distributed in the hope that it will be useful,
19
but WITHOUT ANY WARRANTY; without even the implied warranty of
20
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
22
$Id: import-dvd.js 2011 2009-01-11 19:14:54Z lww $
25
var title = dvd.title;
26
var index = title.lastIndexOf('.');
28
title = title.substring(0, index);
30
// we got the ISO here but our virtual items should have the video class
31
dvd.upnpclass = UPNP_CLASS_ITEM_VIDEO;
33
var title_count = dvd.aux[DVD].titles.length;
34
for (var t = 0; t < title_count; t++)
36
var title_name = 'Title';
39
title_name = title_name + ' 0' + (t + 1);
41
title_name = title_name + ' ' + (t + 1);
43
var chapter_count = dvd.aux[DVD].titles[t].chapters.length;
44
var audio_track_count = dvd.aux[DVD].titles[t].audio_tracks.length;
45
for (var a = 0; a < audio_track_count; a++)
48
var audio_name = ' - Audio Track ' + (a + 1);
49
var audio_language = dvd.aux[DVD].titles[t].audio_tracks[a].language;
50
var audio_format = dvd.aux[DVD].titles[t].audio_tracks[a].format;
51
if (audio_format != '')
53
if (audio_language != '')
54
audio_name = audio_name + ' - ' + audio_language;
56
chain = new Array('Video', 'DVD', title, 'Audio Formats',
57
audio_format, title_name + audio_name);
59
for (var c = 0; c < chapter_count; c++)
62
dvd.title = "Chapter 0" + (c + 1);
64
dvd.title = "Chapter " + (c + 1);
66
addDVDObject(dvd, t, c, a, createContainerChain(chain));
70
if (audio_language != '')
72
chain = new Array('Video', 'DVD', title, 'Languages',
74
if (audio_format != '')
75
chain.push(title_name + audio_name + ' - ' + audio_format);
77
chain.push(title_name + audio_name);
79
for (var c = 0; c < chapter_count; c++)
82
dvd.title = "Chapter 0" + (c + 1);
84
dvd.title = "Chapter " + (c + 1);
86
addDVDObject(dvd, t, c, a, createContainerChain(chain));
90
chain = new Array('Video', 'DVD', title, 'Titles');
92
var titles = title_name + ' - Audio Track ' + (a + 1);
94
if (audio_format != '')
95
titles = titles + ' - ' + audio_format;
97
if (audio_language != '')
98
titles = titles + ' - ' + audio_language;
102
for (var c = 0; c < chapter_count; c++)
105
dvd.title = "Chapter 0" + (c + 1);
107
dvd.title = "Chapter " + (c + 1);
109
addDVDObject(dvd, t, c, a, createContainerChain(chain));