Kodi Community Forum
[RELEASE] PseudoTV Addon: Virtual EPG and TV Channel Surfing Script - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Add-on Support (https://forum.kodi.tv/forumdisplay.php?fid=27)
+---- Forum: Program Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=151)
+----- Forum: PseudoTV / PseudoTV Live (https://forum.kodi.tv/forumdisplay.php?fid=231)
+----- Thread: [RELEASE] PseudoTV Addon: Virtual EPG and TV Channel Surfing Script (/showthread.php?tid=90738)



- Sranshaft - 2011-02-10

Ahh, so it does use FFmpeg. My mistake. They must have changed from MediaInfo to FFmpeg somewhere between Camelot and Dharma.

I can definitely see where it'd be driving you nuts. This is not something that an addon developer should have to worry about. What is strange though, I have no problems at all in regards to durations. This is on both a system that has the files locally and one that is over the network using smb - both running Windows 7 and the latest svn build 35647.

I'll see what I can whip up for testing in the way of an external program. I might find some time tonight when I can sneak away and get some work down then.

A bit off-topic but 2001: A Space Odyssey in anything less than 1080p is a travesty. Laugh


- zepfan - 2011-02-10

Sranshaft Wrote:Ahh, so it does use FFmpeg. My mistake. They must have changed from MediaInfo to FFmpeg somewhere between Camelot and Dharma.

I can definitely see where it'd be driving you nuts. This is not something that an addon developer should have to worry about. What is strange though, I have no problems at all in regards to durations. This is on both a system that has the files locally and one that is over the network using smb - both running Windows 7 and the latest svn build 35647.

I'll see what I can whip up for testing in the way of an external program. I might find some time tonight when I can sneak away and get some work down then.

A bit off-topic but 2001: A Space Odyssey in anything less than 1080p is a travesty. Laugh
What do you use to scrape media info?


- Sranshaft - 2011-02-10

zepfan Wrote:What do you use to scrape media info?

MediaInfo: http://mediainfo.sourceforge.net/en

Edit: Sorry, did you mean to ask if I use a 3rd party program to create nfo files? I used to. The code from before was from a program I created myself to do all of that simply because Ember and those kinds of programs just didn't look / work the way I would have done it. Now though, I just have XBMC scrape everything itself and use XMM web interface addon to change things around.

I believe I may still have some old SQLite interfacing code laying about on a flash drive as I was in the process of adapting my program to interact directly with XBMC's database instead of through nfo files. I'll have a dig through my odd codes and see what I find.


- zepfan - 2011-02-10

That outputs nfo's for movies?

Ahh. Ok


- Sranshaft - 2011-02-10

zepfan Wrote:That outputs nfo's for movies?
Check my previous post. I edited it to something more of a coherent post. But to answer your question. No MediaInfo doesn't output nfo files. It's just a library I used to extract the stream details of a video file.


- jtucker1972 - 2011-02-10

Sranshaft Wrote:A bit off-topic but 2001: A Space Odyssey in anything less than 1080p is a travesty. Laugh

I'm currently moving my HD movies to a new NAS drive. 1.5 TB was not enough! I stream the SD versions to the iPhones and PCs which are on wireless-N.


- zepfan - 2011-02-10

Anyone having trouble with the script showing the wrong info for shows? For example, I start the script 30 Rock plays but shows info for Arrested development. I've tried resetting the script to no avail. Not a big issue, but just wondering if anyone had the issue.


- Sranshaft - 2011-02-10

jtucker1972 Wrote:I'm currently moving my HD movies to a new NAS drive. 1.5 TB was not enough! I stream the SD versions to the iPhones and PCs which are on wireless-N.

I believe I have solved this issue. The duration for each video is stored in the streamdetails table. So in order to get the true duration (the duration columns found in movie and episode tables aren't use anymore to my knowledge) one will have to call the streamdetails table passing the idfile of each video file. Some thing like this...please excuse my piss poor SQL. It's not my strongest of suit but it'll demonstrate a working streamdetail pull for you.

Code:
"select * from streamdetails WHERE idFile={insert id here}"

This will spit back all the details one needs regarding the video (codec, audio info, height, width AND duration!) Huzzah!! So you'll want to:

1. Make a call to get all idFiles in a playlist
2. Loop through and request the streamdetails for each idFile found

Hope this has shed some light on it and points you guys in the right direction. Unless I'm completely out of my gourd and this is no where near what you want. Laugh


- TheDoughboy - 2011-02-10

zepfan Wrote:Anyone having trouble with the script showing the wrong info for shows? For example, I start the script 30 Rock plays but shows info for Arrested development. I've tried resetting the script to no avail. Not a big issue, but just wondering if anyone had the issue.

I noticed that too. My action movie channel ended up showing a movie with a title that had 4 seperate movie titles as the title (something like Teenage Wolverine Airplane Monkeys Smile ) , yet only had 1 movie playing on the channel. The movie summary was correct though. :>

I spent a while trying to add durations individually and doing small tests to no avail. I'm actually going to look more at the script itself.

I have a funny feeling some of the issues I'm having pertain to my iso backups. If I can figure it out I personally want every iso the playlist finds to be thrown to a special DVD channel. I tried but I can not get the playlist to let me select file type and exclue it. Not saying I can get anywhere with scripting, but I'm going to try.

If anyone wants to have a picture of what I would love to have done with this script look here:

Image

Honestly if stream channels and a DVD channel can be put into this script, XBMC will be perfect for me. Also possible channels that are off air till certain times to re-create past station lineups, like TGIF. This script will make XBMC that much more perfect for me. And once PVR is finished I'll be in heaven.

Few hiccups now are worth what's coming down the road.


- Sranshaft - 2011-02-10

TheDoughboy Wrote:I noticed that too. My action movie channel ended up showing a movie with a title that had 4 seperate movie titles as the title (something like Teenage Wolverine Airplane Monkeys Smile ) , yet only had 1 movie playing on the channel. The movie summary was correct though. :>

I've seen Teenage Wolverine Airplane Monkeys but the sequel totally ruined it for me. Laugh That sounds like an issue with a string variable not getting clear properly in the playlist loop.

TheDoughboy Wrote:I spent a while trying to add durations individually and doing small tests to no avail. I'm actually going to look more at the script itself.

I have a funny feeling some of the issues I'm having pertain to my iso backups. If I can figure it out I personally want every iso the playlist finds to be thrown to a special DVD channel. I tried but I can not get the playlist to let me select file type and exclue it. Not saying I can get anywhere with scripting, but I'm going to try.

ISOs are a tricky bunch. XBMC cannot grab the stream details automatically while it's being scanned into the database. For those, and DVD Video_TS files I believe, they are only extracted during the first play of the file. So for every ISO you have, you'll have to go through and play each one for a minute or two in order for XBMC to populate the database with the necessary information.

Also, as you said you're trying to add durations yourself, this needs to be done in streamdetails table associated with the file and not in the movie / episode table.

TheDoughboy Wrote:If anyone wants to have a picture of what I would love to have done with this script look here:

Image

Honestly if stream channels and a DVD channel can be put into this script, XBMC will be perfect for me. Also possible channels that are off air till certain times to re-create past station lineups, like TGIF. This script will make XBMC that much more perfect for me. And once PVR is finished I'll be in heaven.

Few hiccups now are worth what's coming down the road.

I agree, something like this would be great but IMO having images, with text, at that size would be a headache to read from 10 feet away. Having said that, getting thumbnail images, logos, etc, is something to look forward to and opens even more ideas.

Also, channels that are available at certain times of the day, or having the ability to have a channel that changes playlists depending on the time of day would be great.


- TheDoughboy - 2011-02-10

Quote:ISOs are a tricky bunch. XBMC cannot grab the stream details automatically while it's being scanned into the database. For those, and DVD Video_TS files I believe, they are only extracted during the first play of the file. So for every ISO you have, you'll have to go through and play each one for a minute or two in order for XBMC to populate the database with the necessary information.

Also, as you said you're trying to add durations yourself, this needs to be done in streamdetails table associated with the file and not in the movie / episode table.

I remember when i first got into XBMC and found out about the metadata issue with DVDs I could have sworn someone was working on the issue associated with Ember. I'm going to do some research, and now that Media Companion is open source I grabbed the code. I need to find out what information XBMC really needs, as there is no point to using these tools if XBMC can't use the data they gather properly. Plus I thought we were being kind to the online tv and movie databases by using the tools and creatig nfo and fanart files. I know that XBMC has the export database feature, but I don't feel like I have real control the information for each movie.

As for ISO and metadata I did a quick lookup on the internet for the issue of scanning inside the file and found these -

http://community.mediabrowser.tv/permalinks/2224/tv-episodes-ripped-to-dvd-format---where-to-put-metadata

http://forum.doom9.org/showthread.php?t=90998

I'm also thinking there has to be a way to implement a data bookmark on iso files. I just found out about epbookmark feature for a multiple episode file. There has to be some way of pulling the same feature off for iso files so we can go right to certain parts of the file. I'm 100% certain it can be done it's just a matter of understanding how iso's are read in XBMC.

Quote:I agree, something like this would be great but IMO having images, with text, at that size would be a headache to read from 10 feet away. Having said that, getting thumbnail images, logos, etc, is something to look forward to and opens even more ideas.

I wouldn't mess with text on the guide. My pre-liminary thinking is that PsuedoTV would take the fanart for the stream channel and just display that in the grid. When you move to the stream it displays the information for the stream at the bottom of the screen just like any other program. The real question is where to send the user once they click on a stream. That's the tricky part because WMC then sends you to a new screen dependent on who's content you are using.

To see it in action look at these: http://www.youtube.com/watch?v=znZKrjPn43o

and got to 3:30 of this one to see more of what you can do with the guide (internet radio, netflix) http://www.youtube.com/watch?v=Utsz-66wtLA&feature=related

To me personally if Psuedo TVcould do these kind of things think of how it would redefine how you use XBMC. You now can really pair down the home menu options. It's amazing to think of the possibilities this single script just introduced to my media world Big Grin

Quote:Also, channels that are available at certain times of the day, or having the ability to have a channel that changes playlists depending on the time of day would be great.

My very first thought was when the issue of playlists with no items came up why not just display an off-air message on screen. Instead of script just stoping on a channel and saying "no durations found" now it has an option to still run, especially if just one channel is a hang up on a list of 50. I'll look into what can be done.


- Sranshaft - 2011-02-10

I whipped this up real quick to determine if the duration of the streamdetails is being populated in the database. This is where you'll need to check the duration - not in the movie / episode table.

Download XBMC SQL Test from here.

Instructions to use:

1. extract the zip file
2. drop a copy of your MyVideos34.db into the XBMC SQL Test folder
3. rename MyVideos34.db to MyVideos34.db3
4. run the executable.

This will populate the top gridview with a list of 100 episodes. This is the 'episode' table found in the database. Select a row and the bottom gridview will be populated with the 'streamdetails' table of the selected episode. Check the last column (iDuration) and it should have a number in it.


- jtucker1972 - 2011-02-10

Sranshaft, I think you missed my point. I already know that streamdetails is not getting populated. I can use sqlite browser to view the data in the database and execute sql queries against it. Here is the link to it for anyone that wants to look at how XBMC stores the data. http://sqlitebrowser.sourceforge.net/.

1. What we need is to query the movie and episode tables and get all the idFiles.
2. Next check if each idFile in 1 has a corresponding record in streamdetails, we need to get a list of all idFiles not in streamdetails but are in movie and episode tables.
3. Loop through this idFile list and execute some code to grab the video information using ffmpeg
4. insert video information into streamdetails for the idFile

Just to rule out that this is an issue with my XBMC install, I am going to completely blow away my current installation and start with a fresh install of Dharma. I will then verify the Extract thumbnail and video information is enabled. Then add my video sources and have XBMC scan the content. After the scan is completed in a day or two, I will copy the database and look at the data in the tables and report. I will also work on the sql code to gather the data to determine which movie and episode idFiles are not in streamdetails table.

I'll report my findings as soon as I have completed the test.


- Sranshaft - 2011-02-10

Fair enough. I was mistakenly under the impression you were looking for the duration under the movie / episode tables as you hadn't mentioned before about looking at the streamdetails tables specifically.

If your streamdetails table isn't getting populated then there definitely is something wrong with your install of XBMC. I see you're going to do a completely fresh re-install so hopefully it fixes this issue for you. I'd also suggest deleting any nfo files, if you have any as this could effect your database if you happen to have created them using some 3rd party application. This will help narrow things down even more.

After the clean install, if your database is indeed not getting populated, whether it be because your files are on a network or what have you, it is a bug in the core of XBMC and would benefit from being brought to the attention of the devs.

One suggestion that I would like to make is that if it's decided that populating the streamdetails manually is something Jason would like to pursue further, that it be separated into another addon. If nothing else than to keep PseudoTV from getting too complicated with what IMO is unnecessary code that should be dealt with directly by XBMC. Also, taking into account the amount of read/writes PseudoTV would have to make of the database and a larger amount of channels / files per smart playlist and you're looking at an even longer channel creation time. Of course this is only my opinion.


- jtucker1972 - 2011-02-10

Completed doing the fresh install and importing a movie and tv directory. Here is what is actually happening.

If XBMC does not find a <movie>.nfo file, it will scrape for the data, but WILL NOT update the streamdetails table with the video stream details.

If XBMC finds a <movie>.nfo file, it will use the data in the <fileinfo><streamdetails> section to update the streamdetails table. However, it will only update the iDuration if the <durationinseconds> is in the <streamdetails>. It DOES NOT use <duration> tag. However, XBMC will not scrape for any missing data in the .nfo file.

<fileinfo>
<streamdetails>
<audio>
<channels>2</channels>
<codec>mp3</codec>
</audio>
<video>
<aspect>1.500</aspect>
<codec>xvid</codec>
<duration>74</duration>
<height>480</height>
<scantype>Progressive</scantype>
<width>720</width>
</video>
</streamdetails>
</fileinfo>

So, in order to make this work,

1. Get a third-party tool to scrape your movie and tv data, but make sure it is setup to output the streamdetails with <durationinseconds> tag.
2. XBMC gets enhanced to pull the streamdetails during scan if no nfo is found. I will submit a request for this as I believe it should be part of the XBMC functionality.
3. Create a playlist which returns all the movies and one which returns all episodes. Open each and let XBMC update the streamdetails.

This is not an issue just with my install. This is the way XBMC works. Here is another thread which discusses this.

http://forum.xbmc.org/showthread.php?tid=92225&highlight=durationinseconds

Hope this helps.