Closed rask1toma closed 5 years ago
Which number is on your right in the overview of the playlists (Unique ID)?
Sent with GitHawk
I assume your pulling those Channels and adding a Unique ID? Otherwise when your Provider changes the name of those Channels, xTeVe will deactivate them. Specifically are you asking for more choices of duration in xTeVe Dummy?
This is accomplished in "Mapping", (Bulk Edit) There would be way too many Variables to have it done Automatically when adding a Filter.
I'm not sure he explained this very well... It would be useful if you could set all channels missing an XMLTV ID to a "xTeVe Dummy" file with a default "XXX_Minutes". My iptv provider frequently brings channels in and out that don't really need tied to specific channel data. It would be nice for them to show up automatically without me have to map/bulk edit.
If it helps anyone I wrote a bash script to do just this, it goes through the xepg.json file and updates the required values for the dummy when x-mapping is "-". It then sends a request to the api to update so the channges actually show. You'll need to enable the api in settings for this actually work. I've got this running on a cron job every 30 mins (probably overkill!). You'll obviously also need to amend paths to suit your need.
rm -f /opt/xteve/xepgbackup.json cp /opt/xteve/xepg.json /opt/xteve/xepgbackup.json jq '.[] |= if ."x-mapping" == "-" then ."x-xmltv-file" = "xTeVe Dummy" | ."x-mapping" = "30_Minutes" | ."x-active" = true else . end ' /opt/xteve/xepg.json >> /opt/xteve/xepg.json.tmp mv -f /opt/xteve/xepg.json.tmp /opt/xteve/xepg.json curl -X POST -H "Content-Type: application/json" -d @/opt/xteve/req.json http://localhost:34400/api/
If it helps anyone I wrote a bash script to do just this, it goes through the xepg.json file and updates the required values for the dummy when x-mapping is "-". It then sends a request to the api to update so the channges actually show. You'll need to enable the api in settings for this actually work. I've got this running on a cron job every 30 mins (probably overkill!). You'll obviously also need to amend paths to suit your need.
!/bin/bash rm -f /opt/xteve/xepgbackup.json cp /opt/xteve/xepg.json /opt/xteve/xepgbackup.json jq '.[] |= if ."x-mapping" == "-" then ."x-xmltv-file" = "xTeVe Dummy" | ."x-mapping" = "30_Minutes" | ."x-active" = true else . end ' /opt/xteve/xepg.json >> /opt/xteve/xepg.json.tmp mv -f /opt/xteve/xepg.json.tmp /opt/xteve/xepg.json curl -X POST -H "Content-Type: application/json" -d @/opt/xteve/req.json http://localhost:34400/api/
Quick addition to this extremely helpful script - you will first need to create a "req.json" file as well at the indicated location that contains:
{ "cmd": "update.xepg" }
Thanks owensy!
I would start by running through the script line by line and taking note of the result of each line perhaps? Also check permissions on the .json files to ensure they are writable.
On Tue, Oct 25, 2022 at 10:13 AM rasorjb @.***> wrote:
If it helps anyone I wrote a bash script to do just this, it goes through the xepg.json file and updates the required values for the dummy when x-mapping is "-". It then sends a request to the api to update so the channges actually show. You'll need to enable the api in settings for this actually work. I've got this running on a cron job every 30 mins (probably overkill!). You'll obviously also need to amend paths to suit your need.
!/bin/bash rm -f /opt/xteve/xepgbackup.json cp /opt/xteve/xepg.json
/opt/xteve/xepgbackup.json jq '.[] |= if ."x-mapping" == "-" then ."x-xmltv-file" = "xTeVe Dummy" | ."x-mapping" = "30_Minutes" | ."x-active" = true else . end ' /opt/xteve/xepg.json >> /opt/xteve/xepg.json.tmp mv -f /opt/xteve/xepg.json.tmp /opt/xteve/xepg.json curl -X POST -H "Content-Type: application/json" -d @/opt/xteve/req.json http://localhost:34400/api/
Quick addition to this extremely helpful script - you will first need to create a "req.json" file as well at the indicated location that contains:
{ "cmd": "update.xepg" }
Thanks owensy!
So I've built this CRON job and updated directory's as applicable. While when I run the command in terminal I receive no errors it does not appear the job is actually doing anything. I would expect date time stamps on files to update and any channel marked as '-' to change to xTeVe Dummy. Am I missing something?
— Reply to this email directly, view it on GitHub https://github.com/xteve-project/xTeVe/issues/15#issuecomment-1290815543, or unsubscribe https://github.com/notifications/unsubscribe-auth/AH4TTDVMC3O2WC7HCUJTOG3WFABJXANCNFSM4IN7QX4A . You are receiving this because you commented.Message ID: @.***>
Does anyone have a PowerShell version of this script?
thanks @owensy and @godver3
i make a PowerShell version of it
However i think having in Xteve an option to set default dummy mapping if no EPG would be great
$configFile='F:\apps\xteve\Config\xepg.json'
$configFileTmp='F:\apps\xteve\Config\xepg.json.tmp'
$configFileBkp= 'F:\apps\xteve\Config\xepg.json.bkp'
$xteveAPIURL='http://htpc:5004/api/'
if (Test-Path $configFileBkp) {
Remove-Item $configFileBkp
}
Copy-Item -Path $configFile -Destination $configFileBkp
$x= (Get-Content $configFile -raw | ConvertFrom-Json)
foreach( $rootProperty in @($x.psobject.properties | where-object {$_.MemberType -eq "NoteProperty"}) )
{
foreach( $childProperty in @($rootProperty.Value.psobject.properties | where-object {$_.MemberType -eq "NoteProperty"}) )
{
if ($($childProperty.Name).equals("x-mapping")){
#write-host "'$($childProperty.Name)' = '$($childProperty.Value)'"
if($($childProperty.Value).equals("-")){
$rootProperty.Value.'x-active'=$true
$rootProperty.Value.'x-xmltv-file'="xTeVe Dummy"
$rootProperty.Value.'x-mapping'="120_Minutes"
}
}
}
}
$x | ConvertTo-Json -depth 32| set-content $configFileTmp
if (Test-Path $configFileTmp) {
Move-Item -Force $configFileTmp $configFile
}
$postParams = @"
{
"cmd": "update.xepg"
}
"@
Invoke-WebRequest -Uri $xteveAPIURL -Method POST -Body $postParams
thanks @owensy and @godver3
i make a PowerShell version of it
However i think having in Xteve an option to set default dummy mapping if no EPG would be great
$configFile='F:\apps\xteve\Config\xepg.json' $configFileTmp='F:\apps\xteve\Config\xepg.json.tmp' $configFileBkp= 'F:\apps\xteve\Config\xepg.json.bkp' $xteveAPIURL='http://htpc:5004/api/' if (Test-Path $configFileBkp) { Remove-Item $configFileBkp } Copy-Item -Path $configFile -Destination $configFileBkp $x= (Get-Content $configFile -raw | ConvertFrom-Json) foreach( $rootProperty in @($x.psobject.properties | where-object {$_.MemberType -eq "NoteProperty"}) ) { foreach( $childProperty in @($rootProperty.Value.psobject.properties | where-object {$_.MemberType -eq "NoteProperty"}) ) { if ($($childProperty.Name).equals("x-mapping")){ #write-host "'$($childProperty.Name)' = '$($childProperty.Value)'" if($($childProperty.Value).equals("-")){ $rootProperty.Value.'x-active'=$true $rootProperty.Value.'x-xmltv-file'="xTeVe Dummy" $rootProperty.Value.'x-mapping'="120_Minutes" } } } } $x | ConvertTo-Json -depth 32| set-content $configFileTmp if (Test-Path $configFileTmp) { Move-Item -Force $configFileTmp $configFile } $postParams = @" { "cmd": "update.xepg" } "@ Invoke-WebRequest -Uri $xteveAPIURL -Method POST -Body $postParams
Awesome! Good work @saadtrash , glad to see this script has been useful for a few people.
Totally agree an option to do this directly in xteve would be really useful.
Dev's original idea was this was for DVR, and without EPG, DVR is useless. Even if he was still active I'm sure he would reject your request.
Thanks @saadtrash . This works great. I run it once an hour in Windows Scheduler.
How would one go about making this work when using freenas scale container? Noob here
How would one go about making this work when using freenas scale container? Noob here
Make what work? It's just a bash script. Does this NAS not run bash scripts?
#!/bin/bash
rm -f /opt/xteve/xepgbackup.json
cp /opt/xteve/xepg.json /opt/xteve/xepgbackup.json
jq '.[] |= if ."x-mapping" == "-" then ."x-xmltv-file" = "xTeVe Dummy" | ."x-mapping" = "30_Minutes" | ."x-active" = true else . end ' /opt/xteve/xepg.json >> /opt/xteve/xepg.json.tmp
mv -f /opt/xteve/xepg.json.tmp /opt/xteve/xepg.json
curl -X POST -H "Content-Type: application/json" -d @/opt/xteve/req.json http://localhost:34400/api/
Any guide on that? I have Nas Synology (I'm pretty new to this script so I'm hoping someone can explain how to do it.)
and my xTeVe running on docker
i got this bash scripts guide on youtube. but i got error: Warning: Couldn't read data from file "/opt/xteve/req.json", this makes an Warning: empty POST.
i got this bash scripts guide on youtube. but i got error: Warning: Couldn't read data from file "/opt/xteve/req.json", this makes an Warning: empty POST.
Permissions?
I have now sat and played with this bash script and got it done with req.json as well.
it works fine where I had to run with the user permission "ROOT", but the problem is that if I were to change some channels on xteve, (update) I get the error: "open /home/xteve/conf/xepg.json: permission denied"
but xteve uid and gid is 31337 ?
but there are not some have the uid and gid in my docker system.
I assume your pulling those Channels and adding a Unique ID? Otherwise when your Provider changes the name of those Channels, xTeVe will deactivate them. Specifically are you asking for more choices of duration in xTeVe Dummy?
How do you get your unique id? just from xtream-editor?
thanks @owensy and @godver3 i make a PowerShell version of it However i think having in Xteve an option to set default dummy mapping if no EPG would be great
$configFile='F:\apps\xteve\Config\xepg.json' $configFileTmp='F:\apps\xteve\Config\xepg.json.tmp' $configFileBkp= 'F:\apps\xteve\Config\xepg.json.bkp' $xteveAPIURL='http://htpc:5004/api/' if (Test-Path $configFileBkp) { Remove-Item $configFileBkp } Copy-Item -Path $configFile -Destination $configFileBkp $x= (Get-Content $configFile -raw | ConvertFrom-Json) foreach( $rootProperty in @($x.psobject.properties | where-object {$_.MemberType -eq "NoteProperty"}) ) { foreach( $childProperty in @($rootProperty.Value.psobject.properties | where-object {$_.MemberType -eq "NoteProperty"}) ) { if ($($childProperty.Name).equals("x-mapping")){ #write-host "'$($childProperty.Name)' = '$($childProperty.Value)'" if($($childProperty.Value).equals("-")){ $rootProperty.Value.'x-active'=$true $rootProperty.Value.'x-xmltv-file'="xTeVe Dummy" $rootProperty.Value.'x-mapping'="120_Minutes" } } } } $x | ConvertTo-Json -depth 32| set-content $configFileTmp if (Test-Path $configFileTmp) { Move-Item -Force $configFileTmp $configFile } $postParams = @" { "cmd": "update.xepg" } "@ Invoke-WebRequest -Uri $xteveAPIURL -Method POST -Body $postParams
Awesome! Good work @saadtrash , glad to see this script has been useful for a few people.
Totally agree an option to do this directly in xteve would be really useful.
So for whatever reason it is not updating in the mapping section. I run the script and open the file in text editor and it shows it did everything correct. Even calls the api and sends the update. Not sure what to do next? Anyone have any ideas? Its almost like it is keeping it in memory rather than straight from the xepg file. I have also changed all the file paths to my respective location.
When there's no XML EPG data provided, the filters should have an option to auto fill with the Xteve Dummy with a standard Channel duration (set by the user)
This would help a lot when you have iptv lists that change a lot, specially with PPV/Box-Office Events.