Actions
Migration » History » Revision 1
Revision 1/2
| Next »
Nicolas C, 2014-11-21 14:17
Migration
If you want to migrate between Tvheadend instances, one possible approach is to configure your new instance in advance, reading your muxes via http. Of course if you have a large number of muxes, just loading on by one could be tedious, so it's better to do it programmatically. Refer to the attached script.¶
This script has been tested on migrating a 3.4 server to a 3.9 server.
#!/usr/bin/env python import time import urllib import urllib2 import json #Source IP of your TVHeadend Server ipsrc='192.168.0.9' #Target IP ipdst='192.168.0.254' #Old Network Name onn='Astra28' #New Network UUID nnu='7cc8273901fadc4f5e8b65a4bca392fd' url = 'http://'+ipsrc+':9981/api/mpegts/mux/grid?start=0&limit=400' url=urllib2.urlopen(url) json_string=url.read() data = json.loads(json_string) entries = data['entries'] if entries: for entry in entries: if entry['network']==onn: print "Creating MUX: ' + entry['name'] conf = { 'enabled' : 'true', 'epg' : 0, 'scan_state' : 0, 'iptv_url' : 'http://'+ipsrc+':9981/stream/mux/' + entry['uuid'], 'iptv_interface' : 'eth0', 'iptv_atsc' : '', 'iptv_muxname' : entry['name'], 'iptv_sname' : '', 'charset' : '', 'pmt_06_ac3' : '', 'priority' : 0, 'spriority' : 0, } data = { 'uuid' : nnu, 'conf' : json.JSONEncoder().encode(conf), } posturl = 'http://'+ipdst+':9981/api/mpegts/network/mux_create' postdata = urllib.urlencode(data) req = urllib2.Request(posturl, postdata) response = urllib2.urlopen(req) the_page = response.read() print "Sleeping for 60 seconds to allow initial scan" time.sleep(60)
Updated by Nicolas C almost 10 years ago · 1 revisions