|
SageTV Github Development Discussion related to SageTV Open Source Development. Use this forum for development topics about the Open Source versions of SageTV, hosted on Github. |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
Wiz.bin SQL importer
I wrote a standalone C++ program that reads in a wiz.bin file and generates database table schema (CREATE TABLE) and data import (INSERT) SQL commands. Currently SQLite and Postgres formats are supported with the only differences being a few data types and syntax. I recommend SQLite since it's very lightweight and requires no setup.
It's not necessarily complete but seemed to run fine on my version7 (wiz.bin ver 75) and version9 (wiz.bin ver 85 & ver 86). I have not tested any other versions so there could be errors in the format definitions for those which can be fixed easily. The code is 4 .cpp and 3 .h files and compiles as a Windows console app or Linux. I'm not sure what explicit purpose this program serves yet but it gave me an excuse to learn the insides of wiz.bin as well as confidently and portably save my TV show history. It could potentially be modified to write wiz.bin files which would allow for SQL data edits (repairs) before exporting back to wiz.bin. I've included the Windows .exe inside the .zip. Compile on Linux with: Code:
g++ -o wiz2sql Wiz2SQL.cpp Wizard.cpp Tables.cpp TableField.cpp Code:
wiz2sql.exe wiz.bin -schema schema.sql -data data.sql Code:
sqlite3 wiz.db < schema.sql sqlite3 wiz.db < data.sql The tables are built to follow the classes used in SageTV for the various DB objects (show, person, etc). In wiz.bin, related tables were simply serialized inline within the individual records. For these, Wiz2SQL creates related tables like "show_person" which represents "person" data related to a "show". For those tables, the primary ID column is the original table wiz ID (e.g. showID). In later versions of wiz.bin, there are also indexes which provide a list of ID's, sorted by something specific. Those are built as tables with "_by_" in the name like "titles_by_name" with a 'pos' (position) column and an ID column. Also, feel free to post questions about the wiz.bin format so Jeff can correct my answers. EDIT: Modified ZIP attachment for Wizard version 87 - NOTE: Not tested. EDIT (09/27/2018): Fixed bug with UPDATE that created a bogus "-" column title. Last edited by wnjj; 09-27-2018 at 11:38 PM. |
#2
|
|||
|
|||
Thanks for sharing. I am not sure of the usage case yet either but I can see it coming in handy. I definitely will play with it. Thanks again
|
#3
|
|||
|
|||
Quote:
__________________
[size=1]-MrD ============= Linux Server 7.1.9 (1)HD300 (1) HD200 (1) HD100 (2) PC Clients Intel Xeon L? 32Gb CetonTV cable card /FIOS |
#4
|
||||
|
||||
Potential Future Move for Open Source to replace WIZ.BIN
It would make sense to me that WIZ.BIN be replaced with a SQL database if there's an advantage in speed and/or resilience and standardization for other things to connect to it.
I'd guess that SageTV already kind of behaves like a SQL database engine - I'm presuming clients and extenders don't directly look at WIZ.BIN and rely on the SageTV service / server app to hand data to them like an SQL server does, so there may not be any performance improvement.
__________________
SageTV 9 / 3 SageTV Clients / Ceton InfiniTV 6 / ComSkip |
#5
|
|||
|
|||
My biggest wiz.bin wishlist item would be some sort of compaction utility, which would leave the wiz.bin file in a state that optimizes efficiency within SageTV, along with hopefully reducing the likelihood of the wiz.bin getting "corrupted".
__________________
Server: MSI Z270 SLI Plus ATX Motherboard, Intel i7-7700T CPU, 32GB Memory, Unraid 6.11.5, sagetvopen-sagetv-server-opendct-java11 Docker (version 2.0.7) Tuners: 2 x SiliconDust HDHomeRun Prime Cable TV Tuners, SiliconDust HDHomeRun CONNECT 4K OTA Tuner Clients: Multiple HD300 Extenders, Multiple Fire TV Stick 4K Max w/MiniClient Miscellaneous: Multiple Sony RM-VLZ620 Universal Remote Controls |
#6
|
||||
|
||||
@wnjj - you should create a github project for this. People could then fork it, extend it, contribute back, etc.
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient |
#7
|
||||
|
||||
What makes you think that it doesn't already do that? I'm not saying it does, but I've got ~10 years of history in mine and it's not like it keeps growing, I think the size has been pretty stable for years.
|
#8
|
||||
|
||||
Quote:
Another idea would be if you could use this to roll-back from a newer wiz.bin format to an older format.
__________________
Server: Ryzen 2400G with integrated graphics, ASRock X470 Taichi Motherboard, HDMI output to Vizio 1080p LCD, Win10-64Bit (Professional), 16GB RAM Capture Devices (7 tuners): Colossus (x1), HDHR Prime (x2),USBUIRT (multi-zone) Source: Comcast/Xfinity X1 Cable Primary Client: Server Other Clients: (1) HD200, (1) HD300 Retired Equipment: MediaMVP, PVR150 (x2), PVR150MCE, HDHR, HVR-2250, HD-PVR |
#9
|
|||
|
|||
Quote:
I was thinking of that too. A V9 to V7 might be nice for those who didn't back things up. I'll have to look at what data may be changed or lost going from V7 to V9 but I think it would work ok. |
#10
|
|||
|
|||
More thinking it would also be good for those of us () that prefer SQL filtering/querying as compared to sage's API. I know personally I can perform more dynamic and powerful searches using SQL.
|
#11
|
|||
|
|||
Quote:
The other kind of wasteful thing I noticed is that the FULL path to every mediafile is stored (actually 2x for photos). I have something like 3MB in just the paths of my photos without their name. |
#12
|
|||
|
|||
Quote:
__________________
Server: MSI Z270 SLI Plus ATX Motherboard, Intel i7-7700T CPU, 32GB Memory, Unraid 6.11.5, sagetvopen-sagetv-server-opendct-java11 Docker (version 2.0.7) Tuners: 2 x SiliconDust HDHomeRun Prime Cable TV Tuners, SiliconDust HDHomeRun CONNECT 4K OTA Tuner Clients: Multiple HD300 Extenders, Multiple Fire TV Stick 4K Max w/MiniClient Miscellaneous: Multiple Sony RM-VLZ620 Universal Remote Controls |
#13
|
||||
|
||||
If you've got a lot of history, the profiler (which does Intelligent Recording scheduling) can take a long time to start up, but I don't think it's in any way tied to the "physical" size of the database. Beside the delayed_carny_init or whatever property gets Sage started in seconds anyway (takes a while for IRs to show up though).
|
#14
|
|||
|
|||
Quote:
Quote:
Last edited by Monedeath; 09-28-2015 at 12:52 PM. Reason: Fixed formatting |
#15
|
|||
|
|||
Yes, the DB is loaded into a big array of tables in Wizard.java.
|
#16
|
||||
|
||||
Quote:
Quote:
Quote:
Yes, it does grow over time...just not that much. And it is all loaded into various arrays in memory...the whole DB lives in RAM and then gets saved out to disk (and it appends it with transactional data between maintenance/compression cycles).
__________________
Jeffrey Kardatzke Founder of SageTV |
#17
|
|||
|
|||
Fantastic. I have officially dropped wiz.bin compaction off my wish list!
__________________
Server: MSI Z270 SLI Plus ATX Motherboard, Intel i7-7700T CPU, 32GB Memory, Unraid 6.11.5, sagetvopen-sagetv-server-opendct-java11 Docker (version 2.0.7) Tuners: 2 x SiliconDust HDHomeRun Prime Cable TV Tuners, SiliconDust HDHomeRun CONNECT 4K OTA Tuner Clients: Multiple HD300 Extenders, Multiple Fire TV Stick 4K Max w/MiniClient Miscellaneous: Multiple Sony RM-VLZ620 Universal Remote Controls |
#18
|
|||
|
|||
I just want to say THANKS for this tool...wow. This makes chasing/debuging issues a breeze as I can clearly see (offline of course) what is going on in the database.
Great tool! Thanks k
__________________
If you wish to see what I am up to and support my efforts visit my Patreon page |
#19
|
|||
|
|||
Won't run for me
I get a unable to start correctly exception. Tried on a few different computers.
__________________
- James M - Capture Devices: HDHomerunXTEND, HDHomerunPrime |
#20
|
|||
|
|||
There must be some Visual C++ dll dependencies that aren't happy on your machines. I only ran it on mine which has the compiler installed. I'll try it on a machine without one and see what it needs and/or see if I can compile it without needing the DLL's.
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Plugin: DVB-S Importer | routerunner | Customization Announcements | 18 | 04-11-2019 12:04 PM |
Plugin: DVB4Sage EPG Importer | Jabroni | SageTV v7 Customizations | 9 | 09-14-2014 03:26 AM |
XMLTV importer | Vaughan | SageTV Australia/New Zealand | 2 | 09-22-2010 06:22 AM |
er... how do i run the xmltv importer | sfag | SageTV United Kingdom | 4 | 01-20-2009 07:14 AM |
So what importer are most using? | wilsonj | SageTV Australia/New Zealand | 3 | 02-15-2007 05:34 AM |