Skip to content
This repository has been archived by the owner on Dec 21, 2020. It is now read-only.

Check for iUniqueId before inserting into database to avoid SQL error #9

Closed
msebald opened this issue Sep 29, 2017 · 3 comments
Closed

Comments

@msebald
Copy link

msebald commented Sep 29, 2017

Hello,

I am having a problem with VNSI which came up just recently. When it imports/updates the channels from the VDR I always get SQL errors with the TV29.db database:

17:34:07.778 T:139638883067648   ERROR: SQL: [TV29.db] Abort due to constraint violation
Query: INSERT INTO channels (iUniqueId, bIsRadio, bIsHidden, bIsUserSetIcon, bIsUserSetName, bIsLocked, sIconPath, sChannelName, bIsVirtual, bEPGEnabled, sEPGScraper, iLastWatched, iClientId, idEpg) VALUES (187685585, 1, 0, 0, 0, 0, '/storage/channellogos/1_0_2_1F32_E26_13E_820000_0_0_0.png', 'RADIO 06 WORLD SERVICE OBSOLETE', 0, 1, 'client', 0, 1151313531, -1)

I checked the database file with a SQL Lite Browser and tried to SQL statement and found out that the iUniqueId it wants to insert already exists. So I went onto the VDR and checked the channels.conf:

RADIO 06 WORLD SERVICE OBSOLETE;OBSOLETE IRIB:12437:HC34M2O20P0S1:S13.0E:29900:0:1861=per@17:0:0:7986:318:3622:0
RADIO 06 WORLD SERVICE;IRIB:12437:HC34M2O20P0S1:S13.0E:29900:0:0:0:0:7986:318:3622:0

Yeah, the channel seems to be there two times. The only difference is 1861=per@17 which seems to have something to do with audio. The channel id VNSI creates somehow must be the same, according to what I read and understood here.

Oh, btw, the example above is not the only one in my channels.conf - there are many more. Also, when I delete both channels (which I thought would be a great idea as it only will autoscan/find one of the two) both channels appeared in the channels.conf just a short time later. I do not want to turn of scanning as I want to have new channels listed in the channels.conf to use these.

I already opened a thread in VDR-Portal forum but I think it would be good to have VNSI addon to check if the channel id already exists and if yes, skip the channel and not crushing the addon/database. If this happens the addon is not usable as I do not see any channels in the frontend.

Thank you and cheers,
Martin

@FernetMenta
Copy link
Owner

Not sure why VDR carries those "obsolete" channels in channels.conf. Maybe I should exclude them from sync with Kodi. I'll have a more detailled look into this.

@FernetMenta
Copy link
Owner

I added some code to filter out channels marked as obsolete:
FernetMenta/vdr-plugin-vnsiserver@aee4526

@msebald
Copy link
Author

msebald commented Nov 18, 2017

Thank you, it worked! I downloaded the testing version into my yaVDR device and Kodi now is happy with the channels it imports. :-) Thank you again!

@msebald msebald closed this as completed Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants