Kodi Community Forum

Full Version: Reset TV database from command line
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I've been reading and trying for a while now - at last, I decided to post.

Background:
I grab new urls for daily and update my playlist accordingly. Thereafter, I refresh the iptv simple client in order to be able to have the updated playlist available in kodi. Unfortunately, for some strange reason, this messes up the order of the channels. Only if I reset the live tv database (which implies reimporting all data) is the order as ok (i.e. as is given in the playlist).

Question:
I wonder now how to reset the PVR database without the GUI. I tried to disable/re-enable the iptvsimple client via json. Similarly, I tried via kodi-send (StartPVRManager). Both approaches indeed re-read the playlist, but the channel order still seems arbitrary. As stated, only by resetting the database the playlist appears in the right order.

- when typing this post, I wondered if deleting the tv database file (in userdata/database) prior to refreshing the client could help - or is this simply a bad idea?

Thanks
kermit
I don't think it's possible to reset the database using the API. The bug you're experiencing is a known bug and should be fixed in Kodi Jarvis so I suggest you upgrade.
Thank you pointing out the bug, negge.
I think I can wait for the stable... should be any time now :-)
Where is a workaround for dynamic/new urls. If you can "grab new urls for daily and update my playlist accordingly" you will be able to follow this simple instruction. The principle is simple - m3u file has static links to a *.php files on your webserver and then you zap to some channel, Kodi follows http link in m3u file and then php file redirects to dynamic urls.

Create *.m3u file with the following content but with your own customizations:
Code:
#EXTM3U
#EXTINF:0 group-title="News",BBC News
http://url.to.your.personal.webserver/bbcnews.php
#EXTINF:0 group-title="News",CNN
http://url.to.your.personal.webserver/cnn.php
...

Create template.php file with following content:
PHP Code:
<?php
header
("Location: dynamiclink");
?>

Now adjust your script ("I grab new urls ...") to do the following steps:
1. Copy template.php file renaming it to bbcnews.php.
2. Grab dynamic channel url.
3. Inside bbcnews.php replace the word "dynamiclink" with new dynamic link.
4. Upload updated bbcnews.php to your personal webserver overwriting the old one.

Repeat these steps in your script with other channels. All of these steps can be automated with simple bash script. Add your script to any time-based job scheduler (crontab) and set it to run periodically according to your needs.