<mysql enabled="yes"> <host>localhost</host> <username>mediatomb</username> <database>mediatomb</database> </mysql>
reate user 'mt'@'%' identified by 'mt'; grant select on mediatomb.* to 'mt'@'%';
http://<mediatomb_ip>:50500/content/interface?req_type=autoscan&return_type=xml&sid=33a2c429c3c4c82e03baca9564f05908&action=as_edit_save&object_id=2f6d6e742f566964656f&from_fs=1&scan_mode=inotify&scan_level=full&recursive=true&hidden=true&cancel=Cancel
http://<mediatomb_ip>:50500/content/interface?req_type=auth&return_type=xml&sid=null&action=get_sid
<?xml version="1.0" encoding="UTF-8"?> <root sid_was_valid="0" sid="a8ffd95c341aa410a44afaeaf354e105" logged_in="1" success="1"/>
sid=`curl -s "http://<mediatomb_ip>:50500/content/interface?req_type=auth&return_type=xml&sid=null&action=get_sid" | grep sid | awk '{print $3}' | sed -e 's/\"//g'`
catalog=$2 oid="" for ((i=0;$i<${#catalog};i=$(($i+1)))) do sym=`printf '%0.2x' "'${catalog:$i:1}"` oid=$oid$sym done
curl -s -o /dev/null "http://<mediatomb_ip>:50500/content/interface?req_type=autoscan&return_type=xml&$sid&action=as_edit_save&object_id=$oid&from_fs=1&scan_mode=inotify&scan_level=full&recursive=true&hidden=true&cancel=Cancel"
http://<mediatomb_ip>:50500/content/interface?req_type=remove&return_type=xml&sid=ea2d65d2dbc72d96ed1ed37dc1d2bbf6&object_id=686994&all=0&updates=check
select id from mt_cds_object where location="D/mnt/Video"
catalog=$2 oid=`echo "select id from mt_cds_object where location=\"D$catalog\"" | mysql mediatomb | grep -v id`
curl -s -o /dev/null "http://<meditomb_ip>:50500/content/interface?req_type=remove&return_type=xml&$sid&object_id=$oid&all=0&updates=check"
mtomb <add | del> < >
#!/bin/bash cmd=$1 catalog=$2 mediatomb_ip=192.168.7.10 mtombdb="mysql -h $mediatomb_ip mediatomb -umt -pmt" # if [ "${catalog:(-1):1}" = "/" ]; then catalog=${catalog:0:(-1)} fi if [ "$cmd" = "add" ]; then echo "Try add $catalog in mediatomb" # object_id ( 16- ) oid="" for ((i=0;$i<${#catalog};i=$(($i+1)))) do sym=`printf '%0.2x' "'${catalog:$i:1}"` oid=$oid$sym done # SID (Session ID) sid=`curl -s "http://$mediatomb_ip:50500/content/interface?req_type=auth&return_type=xml&sid=null&action=get_sid" | grep sid | awk '{print $3}' | sed -e 's/\"//g'` # if [ -a "$catalog" ]; then curl -s -o /dev/null "http://$mediatomb_ip:50500/content/interface?req_type=autoscan&return_type=xml&$sid&action=as_edit_save&object_id=$oid&from_fs=1&scan_mode=inotify&scan_level=full&recursive=true&hidden=true&cancel=Cancel" else echo "Nothing to add..." fi fi if [ "$cmd" = "del" ]; then echo "Try delete $catalog from mediatomb" # SID (Session ID) sid=`curl -s "http://$mediatomb_ip:50500/content/interface?req_type=auth&return_type=xml&sid=null&action=get_sid" | grep sid | awk '{print $3}' | sed -e 's/\"//g'` # (object_id) oid=`echo "select id from mt_cds_object where location=\"D$catalog\"" | $mtombdb | grep -v id` # if [ -n "$oid" ]; then curl -s -o /dev/null "http://$mediatomb_ip:50500/content/interface?req_type=remove&return_type=xml&$sid&object_id=$oid&all=0&updates=check" else echo "Nothing to delete..." fi fi
Source: https://habr.com/ru/post/277585/
All Articles