Jump to content

Script to add your own links for thumbnails in xmltv file


denz

Recommended Posts

denz

Since my guide data provider does not provide thumbnails as part of the tv guide services I thought why I couldn't do it my self I know it is a big exercise but there are not that many channels so there is probable about 100 or so shows and in couple hours I have managed to snap and resize thumbnails on the internet and save them on the nas.  

 

I don't think it is illegal storing them on my nas since I am only one using them. I will read more about that later. It would be interesting to find out how does schedules direct link to a thumbnail.

 

I managed to find a powershell script on the stackoverflow with a few adjustements to it it now does what I wanted it to. What this script does is that it loads the cvs file and the cvs file has two columns one has a xml tag and the other one a link to the saved thumbnail. Once it finds a match it inserts the link in the original xml file and then this file gets imported into emby. As I am beginner I have still a lot to learn about scripting and I will try to improve the script to be even more automated. This works as intended it is a bit time consuming but the end result is worth it.

 

$c = Import-Csv C:\temp\thumbslinks.csv
Get-ChildItem C:\temp\tvguideinfo.xml | Foreach-Object {
  # Out-String in the next line lets you work with a single string rather than an
  # array of strings.
  $xmldoc = (Get-Content $_.PSPath | Out-String)
  # Loop through your CSV, updating $xmldoc with each pass
  $c | Foreach-Object {
  $xmldoc = $xmldoc -replace ([regex]::Escape($_.title)), ($_.title + " " + $_.link)
  }
  # Write the updated $xmldoc back to the original XML file's path
  $xmldoc | Set-Content $_.PSPath
}

 

A big thanks to stackoverflow website for this script.

 

This is the thumbslinks.cvs it only has two columns called title and link and over the weeks this cvs will grow as I add more and more thumbnails. The title tag is from xmltv now I manually copy this tag to cvs file but I am looking to automating this so that all the title tags gets exported to cvs.   

 

"<title lang=""en"">Married At First Sight</title>","<icon src=""http://192.168.1.25/Pictures/ShowsThumbs/marriedatfirstsight.jpg""/>"
"<title lang=""en"">Good Chef Bad Chef</title>","<icon src=""http://192.168.1.25/Pictures/ShowsThumbs/goodchefbadchef.jpg""/>"
"<title lang=""en"">Seafood Escape With Andrew Ettingshausen</title>","<icon src=""http://192.168.1.25/Pictures/ShowsThumbs/seafoodescape.jpg""/>"
"<title lang=""en"">Extreme Homes</title>","<icon src=""http://192.168.1.25/Pictures/ShowsThumbs/extremehomes.jpg""/>"

 

This is the output it looks much better now.

 

 

58d8b24d278ed_emby.jpg

Edited by denz
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...