Hi everyone, I’m a new Tablo owner and I’ve been visiting this community a lot, researching the Tablo before finally making the purchase.
Anyhow, I’m a novice programmer and I don’t know PHP, but I was able to unobscure Davidvr’s code, then I formatted the script and renamed some variables to make it easier to read and follow. First I’d like to say that I’m very disappointed that Davidvr obscured his script. This is supposed to be a community where Tablo users share ideas and learn from each other.
I’m glad I commented out the line that actually deletes recordings before running the script, otherwise I’d be pretty pissed off. As the code is currently written, it appears that it would delete all series recordings. I don’t think this was deliberate or malicious. I think the code is out of date and changes in how the Tablo stores recording info has caused the script to unintentionally identify false duplicates.
The element jsonFromTribune does not exist in the recording info file, therefore there are no values within that element (sorry if I explained this incorrectly, I don’t know the proper terminology for json strings).
Key/value pairs are then added to an array containing the IDs for each recording, with NULL being it’s value. As the script iterates through all the recording ids, the NULL values are compared to other NULL values and a false duplicate for that recording ID is identified.
I say that it appears (because I don’t know for sure) that the script would delete these false duplicates because I don’t understand the part of the code that actually performs the deletion. It uses a function called curl, which I’ve never heard of before and I don’t understand how it works. The recording IDs are passed to curl and assuming that the NULL values have no effect, then I would suspect that curl would in fact unintentionally delete the falsely identified duplicate recordings.
I advise everyone not to download and run this script until it has been updated by the author. Furthermore, I think the author should update the script to prompt the user before performing each delete.
It’s a simple fix and I’ve made some changes to the code that seem to work, but I don’t know if the code was originally supposed to be comparing meta data that had more unique values.
With all that said, I’m actually kind of excited that someone has figured out how to do this kind of stuff via scripts and I’d like to learn more.
Davidvr, if you’re reading this please don’t take offense. You’re code is great, it just got broken over time as the Tablo evolved.