mirror of
https://github.com/nikdoof/mediatomb-config.git
synced 2025-12-13 05:22:15 +00:00
Imported config
This commit is contained in:
117
mediatomb/config.xml
Normal file
117
mediatomb/config.xml
Normal file
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<config version="2" xmlns="http://mediatomb.cc/config/2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://mediatomb.cc/config/2 http://mediatomb.cc/config/2.xsd"><!--
|
||||
Read /usr/share/doc/mediatomb-common/README.gz section 6 for more
|
||||
information on creating and using config.xml configration files.
|
||||
-->
|
||||
<server>
|
||||
<ui enabled="yes" show-tooltips="yes">
|
||||
<accounts enabled="no" session-timeout="30">
|
||||
<account user="mediatomb" password="mediatomb"/>
|
||||
</accounts>
|
||||
</ui>
|
||||
<name>MediaTomb</name>
|
||||
<udn>uuid:53d0c857-20ef-426d-a180-026e7a2885c6</udn>
|
||||
<home>/var/lib/mediatomb</home>
|
||||
<webroot>/usr/share/mediatomb/web</webroot>
|
||||
<storage caching="yes">
|
||||
<sqlite3 enabled="yes">
|
||||
<database-file>mediatomb.db</database-file>
|
||||
</sqlite3>
|
||||
<mysql enabled="no">
|
||||
<host>localhost</host>
|
||||
<username>mediatomb</username>
|
||||
<database>mediatomb</database>
|
||||
</mysql>
|
||||
</storage>
|
||||
<pc-directory upnp-hide="yes"/>
|
||||
<protocolInfo extend="yes"/>
|
||||
<extended-runtime-options>
|
||||
<ffmpegthumbnailer enabled="yes">
|
||||
<thumbnail-size>128</thumbnail-size>
|
||||
<seek-percentage>5</seek-percentage>
|
||||
<filmstrip-overlay>no</filmstrip-overlay>
|
||||
<workaround-bugs>no</workaround-bugs>
|
||||
</ffmpegthumbnailer>
|
||||
<mark-played-items enabled="yes" suppress-cds-updates="yes">
|
||||
<string mode="append">*</string>
|
||||
<mark>
|
||||
<content>video</content>
|
||||
</mark>
|
||||
</mark-played-items>
|
||||
</extended-runtime-options>
|
||||
</server>
|
||||
<import hidden-files="no">
|
||||
<scripting script-charset="UTF-8">
|
||||
<common-script>/usr/share/mediatomb/js/common.js</common-script>
|
||||
<playlist-script>/usr/share/mediatomb/js/playlists.js</playlist-script>
|
||||
<virtual-layout type="js">
|
||||
<import-script>/etc/mediatomb/import-custom.js</import-script>
|
||||
<dvd-script>/usr/share/mediatomb/js/import-dvd.js</dvd-script>
|
||||
</virtual-layout>
|
||||
</scripting>
|
||||
<mappings>
|
||||
<extension-mimetype ignore-unknown="no">
|
||||
<map from="mp3" to="audio/mpeg"/>
|
||||
<map from="ogg" to="application/ogg"/>
|
||||
<map from="asf" to="video/x-ms-asf"/>
|
||||
<map from="asx" to="video/x-ms-asf"/>
|
||||
<map from="wma" to="audio/x-ms-wma"/>
|
||||
<map from="wax" to="audio/x-ms-wax"/>
|
||||
<map from="wmv" to="video/x-ms-wmv"/>
|
||||
<map from="wvx" to="video/x-ms-wvx"/>
|
||||
<map from="wm" to="video/x-ms-wm"/>
|
||||
<map from="wmx" to="video/x-ms-wmx"/>
|
||||
<map from="m3u" to="audio/x-mpegurl"/>
|
||||
<map from="pls" to="audio/x-scpls"/>
|
||||
<map from="flv" to="video/x-flv"/>
|
||||
<map from="mkv" to="video/x-matroska"/>
|
||||
<map from="mka" to="audio/x-matroska"/>
|
||||
<map from="avi" to="video/divx"/>
|
||||
<map from="m2ts" to="video/mpeg"/>
|
||||
<map from="srt" to="video/subtitle"/>
|
||||
<map from="sub" to="video/subtitle"/>
|
||||
<map from="vob" to="video/mpeg"/>
|
||||
<map from="ts" to="video/mpeg"/>
|
||||
<map from="mp4" to="video/avc"/>
|
||||
</extension-mimetype>
|
||||
<mimetype-upnpclass>
|
||||
<map from="audio/*" to="object.item.audioItem.musicTrack"/>
|
||||
<map from="video/*" to="object.item.videoItem"/>
|
||||
<map from="image/*" to="object.item.imageItem"/>
|
||||
<map from="application/ogg" to="object.item.audioItem.musicTrack"/>
|
||||
</mimetype-upnpclass>
|
||||
<mimetype-contenttype>
|
||||
<treat mimetype="audio/mpeg" as="mp3"/>
|
||||
<treat mimetype="application/ogg" as="ogg"/>
|
||||
<treat mimetype="audio/x-flac" as="flac"/>
|
||||
<treat mimetype="image/jpeg" as="jpg"/>
|
||||
<treat mimetype="audio/x-mpegurl" as="playlist"/>
|
||||
<treat mimetype="audio/x-scpls" as="playlist"/>
|
||||
<treat mimetype="audio/x-wav" as="pcm"/>
|
||||
<treat mimetype="audio/L16" as="pcm"/>
|
||||
<treat mimetype="video/x-msvideo" as="avi"/>
|
||||
<treat mimetype="video/mp4" as="mp4"/>
|
||||
<treat mimetype="audio/mp4" as="mp4"/>
|
||||
<treat mimetype="application/x-iso9660" as="dvd"/>
|
||||
<treat mimetype="application/x-iso9660-image" as="dvd"/>
|
||||
<treat mimetype="video/x-matroska" as="mkv"/>
|
||||
<treat mimetype="audio/x-matroska" as="mka"/>
|
||||
</mimetype-contenttype>
|
||||
</mappings>
|
||||
</import>
|
||||
<transcoding enabled="yes">
|
||||
<mimetype-profile-mappings>
|
||||
<transcode mimetype="video/x-matroska" using="transcode-matroska"/>
|
||||
</mimetype-profile-mappings>
|
||||
<profiles>
|
||||
<profile name="transcode-matroska" enabled="yes" type="external">
|
||||
<mimetype>video/mpeg</mimetype>
|
||||
<accept-url>no</accept-url>
|
||||
<first-resource>yes</first-resource>
|
||||
<accept-ogg-theora>yes</accept-ogg-theora>
|
||||
<agent command="/etc/mediatomb/mediatomb-transcode" arguments="-i %in -o %out --transcode-matroska"/>
|
||||
<buffer size="14400000" chunk-size="512000" fill-size="120000"/>
|
||||
</profile>
|
||||
</profiles>
|
||||
</transcoding>
|
||||
</config>
|
||||
159
mediatomb/import-custom.js
Normal file
159
mediatomb/import-custom.js
Normal file
@@ -0,0 +1,159 @@
|
||||
/*jslint indent: 4, maxerr: 50, sloppy: true */
|
||||
|
||||
function addAudio(obj) {
|
||||
var desc = '', track = '', temp = '', artist_full, album_full,
|
||||
title = obj.meta[M_TITLE], artist = obj.meta[M_ARTIST],
|
||||
album = obj.meta[M_ALBUM], date = obj.meta[M_DATE],
|
||||
genre = obj.meta[M_GENRE], description = obj.meta[M_DESCRIPTION];
|
||||
|
||||
// first gather data
|
||||
if (!title) {
|
||||
title = obj.title;
|
||||
}
|
||||
|
||||
if (!artist) {
|
||||
artist = 'Unknown';
|
||||
artist_full = null;
|
||||
} else {
|
||||
artist_full = artist;
|
||||
desc = artist;
|
||||
}
|
||||
|
||||
if (!album) {
|
||||
album = 'Unknown';
|
||||
album_full = null;
|
||||
} else {
|
||||
desc = desc + ', ' + album;
|
||||
album_full = album;
|
||||
}
|
||||
|
||||
if (desc) {
|
||||
desc = desc + ', ';
|
||||
}
|
||||
desc = desc + title;
|
||||
|
||||
if (!date) {
|
||||
date = 'Unknown';
|
||||
} else {
|
||||
date = getYear(date);
|
||||
desc = desc + ', ' + date;
|
||||
}
|
||||
|
||||
if (!genre) {
|
||||
genre = 'Unknown';
|
||||
} else {
|
||||
desc = desc + ', ' + genre;
|
||||
}
|
||||
|
||||
if (!description) {
|
||||
obj.meta[M_DESCRIPTION] = desc;
|
||||
}
|
||||
|
||||
obj.title = title;
|
||||
addCdsObject(obj, createContainerChain(['Audio', 'All Audio']));
|
||||
addCdsObject(obj, createContainerChain(['Audio', 'Artists', artist, 'All Songs']));
|
||||
|
||||
if (artist_full) {
|
||||
temp = artist_full;
|
||||
}
|
||||
|
||||
if (album_full) {
|
||||
temp = temp + ' - ' + album_full + ' - ';
|
||||
} else {
|
||||
temp = temp + ' - ';
|
||||
}
|
||||
|
||||
obj.title = temp + title;
|
||||
addCdsObject(obj, createContainerChain(['Audio', 'All - full name']));
|
||||
addCdsObject(obj, createContainerChain(['Audio', 'Artists', artist, 'All - full name']));
|
||||
|
||||
obj.title = track + title;
|
||||
addCdsObject(obj, createContainerChain(['Audio', 'Artists', artist, album]), UPNP_CLASS_CONTAINER_MUSIC_ALBUM);
|
||||
addCdsObject(obj, createContainerChain(['Audio', 'Albums', album]), UPNP_CLASS_CONTAINER_MUSIC_ALBUM);
|
||||
addCdsObject(obj, createContainerChain(['Audio', 'Genres', genre]), UPNP_CLASS_CONTAINER_MUSIC_GENRE);
|
||||
addCdsObject(obj, createContainerChain(['Audio', 'Year', date]));
|
||||
}
|
||||
|
||||
function getEp(obj) {
|
||||
var ep = '';
|
||||
|
||||
// Flexget Renamer Format
|
||||
var regex = /(.*) - S(\d\d)E(\d\d) - (.*)/, ep = '';
|
||||
var match = regex.exec(obj.title);
|
||||
if (match) {
|
||||
return 'Episode ' + match[3] + ' - ' + match[4];
|
||||
}
|
||||
|
||||
// Neighbours Format
|
||||
var regex = /(.*) - Episode (\d\d\d\d) - (.*)/, ep = '';
|
||||
var match = regex.exec(obj.title);
|
||||
if (match) {
|
||||
return 'Episode ' + match[2] + ' - ' + match[3];
|
||||
}
|
||||
return ep;
|
||||
}
|
||||
|
||||
function addVideo(obj) {
|
||||
var chain = [], location = obj.location.split('/'), epname = '';
|
||||
|
||||
var root = location[3], series = location[4];
|
||||
if (location.length > 5) {
|
||||
var season = location[5];
|
||||
} else
|
||||
var season = null;
|
||||
|
||||
// Check if the file is a TV Show
|
||||
if (root === "TV") {
|
||||
chain.push("TV Shows"); //genre name (Series, Movies)
|
||||
chain.push(series); //series name (MySeries)
|
||||
if (series != 'Neighbours') {
|
||||
print('Found TV: ' + series + " - " + season);
|
||||
chain.push(season); //season (Series 1, 2, ...)
|
||||
} else {
|
||||
print('Found TV: ' + location[location.length-3]);
|
||||
}
|
||||
|
||||
// Parse the title into a useful name
|
||||
epname = getEp(obj);
|
||||
if (epname) {
|
||||
obj.title = epname;
|
||||
}
|
||||
|
||||
} else if (root === "Recent") {
|
||||
chain.push("Recent");
|
||||
|
||||
} else if (root === "Movies") {
|
||||
print("Found Movie: " + obj.title);
|
||||
chain.push("Movies");
|
||||
} else {
|
||||
chain.push("Other");
|
||||
}
|
||||
addCdsObject(obj, createContainerChain(chain));
|
||||
}
|
||||
|
||||
// main script part
|
||||
if (getPlaylistType(orig.mimetype) === '') {
|
||||
var arr = orig.mimetype.split('/');
|
||||
var mime = arr[0];
|
||||
|
||||
print("Importing: " + orig.title + " - MIME: " + mime);
|
||||
|
||||
var obj = orig;
|
||||
obj.refID = orig.id;
|
||||
|
||||
if (mime === 'audio') {
|
||||
addAudio(obj);
|
||||
}
|
||||
|
||||
if (mime === 'video') {
|
||||
addVideo(obj);
|
||||
}
|
||||
|
||||
if (orig.mimetype === 'application/ogg') {
|
||||
if (orig.theora === 1) {
|
||||
addVideo(obj);
|
||||
} else {
|
||||
addAudio(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
118
mediatomb/mediatomb-transcode
Executable file
118
mediatomb/mediatomb-transcode
Executable file
@@ -0,0 +1,118 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# This script is used by MediaTomb for transcoding support.
|
||||
#
|
||||
# Basic function that will transcode any input file into the target type
|
||||
# 'dvd' ffmpeg supports
|
||||
video_common() {
|
||||
local input="$1"
|
||||
local output="$2"
|
||||
exec ffmpeg -i "$input" -t dvd -y "$output"
|
||||
}
|
||||
|
||||
# Basic function that will transcode any input file into the wav format
|
||||
audio_common() {
|
||||
local input="$1"
|
||||
local output="$2"
|
||||
exec ffmpeg -i "$input" -f s16be -y "$output"
|
||||
}
|
||||
|
||||
transcode_matroska() {
|
||||
local input="$1"
|
||||
local output="$2"
|
||||
local alang="$3"
|
||||
local slang="$4"
|
||||
|
||||
audiofmt=`mediainfo --Inform="Audio;%Format%" "$1"`
|
||||
vidfmt=`mediainfo --Inform="Video;%Format%" "$1"`
|
||||
|
||||
echo "Format: $vidfmt/$audiofmt"
|
||||
|
||||
if [ "$vidfmt" = "AVC" ]; then
|
||||
# Already MP4, use it
|
||||
outvidfmt="copy -bsf h264_mp4toannexb"
|
||||
#outvidfmt="libx264 -level 41 -vpre normal"
|
||||
else
|
||||
outvidfmt="avc"
|
||||
fi
|
||||
|
||||
if [ "$audiofmt" = "AAC" ]; then
|
||||
outaudfmt="copy"
|
||||
else
|
||||
outaudfmt="libmp3lame -ab 192k"
|
||||
fi
|
||||
exec ffmpeg -i "$1" -vcodec $outvidfmt -acodec $outaudfmt -copyts -sameq -f mpegts -y "$2"
|
||||
}
|
||||
|
||||
# Our "main" function below.
|
||||
|
||||
USAGE="
|
||||
This script is used by MediaTomb for transcoding support. It can also serve as
|
||||
a script to transcode various files in a format suitable for streaming directly.
|
||||
|
||||
Synopsis:
|
||||
mediatomb-transcode [TRANSCODE FUNCTION OPTION] [GENERIC OPTIONS]
|
||||
|
||||
Generic Options:
|
||||
-h, --help Display this help message.
|
||||
-i, --input Input file that is meant to be transcoded.
|
||||
-o, --output Output file that will be read back by MediaTomb.
|
||||
--audio-lang Specify ISO 639 language code to use for audio.
|
||||
--subtitle-lang Specify ISO 639 language code to use for subtitles.
|
||||
|
||||
Transcode Function Options (one is required):
|
||||
--video-common Perform generic video transcoding.
|
||||
--audio-common Perform generic audio transcoding.
|
||||
--transcode-matroska Used in transcoding matroska files.
|
||||
"
|
||||
|
||||
while [ "$#" -gt "0" ]
|
||||
do
|
||||
case "$1" in
|
||||
-i|--input)
|
||||
INPUT="$2"
|
||||
shift; shift;
|
||||
;;
|
||||
-o|--output)
|
||||
OUTPUT="$2"
|
||||
shift; shift;
|
||||
;;
|
||||
--video-common)
|
||||
USE_VIDEO_COMMON=1
|
||||
shift
|
||||
;;
|
||||
--audio-common)
|
||||
USE_AUDIO_COMMON=1
|
||||
shift
|
||||
;;
|
||||
--transcode-matroska)
|
||||
USE_TRANSCODE_MATROSKA=1
|
||||
shift
|
||||
;;
|
||||
--audio-lang)
|
||||
ALANG="$2"
|
||||
shift; shift;
|
||||
;;
|
||||
--subtitle-lang)
|
||||
SLANG="$2"
|
||||
shift; shift;
|
||||
;;
|
||||
-h|--help|*)
|
||||
echo "${USAGE}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Perform specified function
|
||||
if [ $USE_VIDEO_COMMON ]; then
|
||||
video_common "$INPUT" "$OUTPUT"
|
||||
elif [ $USE_AUDIO_COMMON ]; then
|
||||
audio_common "$INPUT" "$OUTPUT"
|
||||
elif [ $USE_TRANSCODE_MATROSKA ]; then
|
||||
transcode_matroska "$INPUT" "$OUTPUT" "$ALANG" "$SLANG"
|
||||
else
|
||||
# Must specify one transcoding function
|
||||
echo "${USAGE}"
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user