20 Nov 2019 - TVDB Scraper v3.2.0 is now available which reinstates scraping. TVDB are still in the process of fixing a number of bugs so there may still be further breakages. See this post. 2901570 (post)

The FINAL answer on PTV Live, video duration, and NFO files
#1
I just wanted to post this thread real quick to help anyone with the issues I have faced with PTVL in the past.  As many are aware, there are some users that have issues with tv shows not starting at the right times, durations being incorrect, and the question of what role NFO files play within PTVL and how this information is used to generate channel lineups and accurate guide data.

I have seen many conversations where people have argued as to whether or not the information in your NFO files will affect the way PTVL operates.  I can tell you without a shadow of a doubt that it does.  If your NFO data is incorrect, Kodi will use this incorrect data within it's own media library.  Remember that PTVL can only use the information that it is given.  Just like any computer program if you put in garbage, you will get garbage back.

I initially tackled this issue when trying to incorporate music videos into my channel lineup, using a custom playlist and only local content.  One thing I noticed is every time I switched to a music video channel, it was almost completely random as to where it would land.  Many times I would change channels and see a video that played hours ago, playing again.  The same thing went for tv shows, although the music videos were more of a problem.

Some background:  I imported my music videos using a plugin called justusethefilename, which meant that the videos were being imported with next to no data whatsoever. 

Digging into the NFO file structure there are two sections that carry runtime for a video.  The first is runtime, which is recorded using minutes.  So a movie that is one hour long will show 60 under this tag.  The second tag is durationinseconds.  The question is, which one does Kodi pay attention to?  The answer is both, sort of.  

To experiment I modified all of my NFO files on my music videos and added an approximate runtime tag in minutes, at this point I did not add the durationinseconds.  I already knew this would not be the best option since music videos are typically only a few minutes long, and since the runtime tag uses minutes, I had to approximate and basically round up or down.  This improved my music video channels, but I still noticed issues where the timing was off.

I then went through again and added the durationinseconds tag, entering in the exact duration of each music video in seconds.  After rebuilding the music video channels they played absolutely perfectly.

After some time, I did notice that all of a sudden, one of my music video channels started acting up.  Every time I would exit the plugin and go back in, it would start on the same exact video, from the beginning every time.  I even went into the settings2.xml file and modified the channel time, at times increasing it substantially, only to have the exact same thing take place.

So I inspected the NFO file of the music video that played just before the current one and noticed that I made a mistake and entered a really long duration for this video.  Is what this means is, PTVL thought that this video was hours long instead of only a few minutes.  So starting up when PTVL would calculate where in the schedule it needed to be, it always landed on the very next video due to the excessive duration.

Keep in mind, I never cleared out the runtime tag from my music videos, yet adding the durationinseconds tag fixed my music video channels.  It was at this point that I realized that Kodi uses the runtime tag initially, but if the durationinseconds tag has a value, it will use that instead.  This means that in my opinion, we should all be focused on durationinseconds, seeing that it is more accurate.  

In PTVL more accurate = better channel experience.

Now before anyone starts arguing, I literally confirmed my findings by actually going into the PTVL code and inspecting the values as it was processing a channel, and I was able to literally see the EXACT duration in PTVL matched my durationinseconds listed in my NFO files.  So although I have seen people argue about this, you can go ahead and bury that argument.

So here is what I suggest that anyone who has had any issues do.  Download an amazing app called TinyMediaManager.  This great tool is Java based and runs on pretty much anything.  I have never seen a tool that is so flexible and powerful in my life.  It uses several services for scraping including Imdb, tvdb, moviedb, etc.  It has the ability to scrape your library automatically or to give you the ability to confirm results on searches that don't find an accurate result (instead of it just being scraped in as the wrong show).

Now just a note!  Initially when you import your library and scrape, TinyMediaManager is going to download all of the metadata and images and place all of this data into nicely formatted NFO files automatically.  Initially, these NFO files will be populated with the regular "runtime" tag, which is derived from the scraped data.  

At some point when you are importing your library, it will say at the bottom of the window "Getting MediaInfo".  Now I will admit that at first I didn't know what this was doing, and I was constantly clicking the cancel button because it seemed to take such a long time.  At first I thought it was something I didn't really need, seeing that I had already imported and scraped my library. 

Then I dug around and realized what TMM was really doing.  The "Getting MediaInfo" process is a very lengthy process, but one you want to wait for.  This is the process when TMM is actually analyzing every video file and inserting the video stream data into your NFO files.  This stream data includes the durationinseconds tag.  It takes forever though, but you only have to do it once.

After the whole process was completed, every single movie and tv show in my library all carry the durationinseconds tag.  PTVL could not be any closer to actual real tv.  Channel changing and timing is so accurate I was even able to verify it with a stopwatch, making sure programs were resuming right where they should.  

Sadly they do not have the option to add music videos to TinyMediaManager, so I had to write up a quick VB.NET app to basically scan my music video folder, analyze each file, and create dummy NFO files.  

I'm surprised that there is not an app that already does this.  I know there are scrapers for music videos, but I have never seen any of them properly fill in durationinseconds.

Maybe I should make one.
Reply
#2
MediaElch supports music videos in its concert section. Sadly you will need to enter the data manually for artist, album, etc but if you have the proper libraries installed it can pick up codec, duration, etc from the files. Getting music video scrapping to work is a herculean, thankless task so I understand the lack of support for it.
Reply
#3
(2019-09-20, 00:07)bornagainpengui Wrote: MediaElch supports music videos in its concert section. Sadly you will need to enter the data manually for artist, album, etc but if you have the proper libraries installed it can pick up codec, duration, etc from the files. Getting music video scrapping to work is a herculean, thankless task so I understand the lack of support for it.

Seems that music videos just never really took off when it comes to Kodi, not enough demand I suppose.  Although just about every person I know loves to come over and having the experience of actual music video channels, unlike the MTV of today which has little to do with music at all anymore.

Such an app would not be that hard, so I think I will start playing around with it on my spare time.  The app I use right now doesn't do any scraping at all, it basically just figures out the duration and uses the filename for the title, but I would like to expand it to actually scrape all of the data AND put the proper duration in for a more seamless experience. There are services like the audiodb that are already used for scraping, we just need an app that puts it together AND generates that coveted durationinseconds tag for each video.  Then you could just import your videos using the generated NFO files, and you are virtually guaranteed no issues when using custom playlists consisting of music videos.
Reply
#4
(2019-09-20, 01:02)soundman1611 Wrote:
(2019-09-20, 00:07)bornagainpengui Wrote: MediaElch supports music videos in its concert section. Sadly you will need to enter the data manually for artist, album, etc but if you have the proper libraries installed it can pick up codec, duration, etc from the files. Getting music video scrapping to work is a herculean, thankless task so I understand the lack of support for it.

Seems that music videos just never really took off when it comes to Kodi, not enough demand I suppose.  Although just about every person I know loves to come over and having the experience of actual music video channels, unlike the MTV of today which has little to do with music at all anymore.

Such an app would not be that hard, so I think I will start playing around with it on my spare time.  The app I use right now doesn't do any scraping at all, it basically just figures out the duration and uses the filename for the title, but I would like to expand it to actually scrape all of the data AND put the proper duration in for a more seamless experience. There are services like the audiodb that are already used for scraping, we just need an app that puts it together AND generates that coveted durationinseconds tag for each video.  Then you could just import your videos using the generated NFO files, and you are virtually guaranteed no issues when using custom playlists consisting of music videos. 
This thread might be of interest to you too then. It scrapes according to the file name, so if your video is Artist - Name of Song.mp4 it'll grab the name and format accordingly.  It may be useful as part of something you might put together in addition to trying to scrape a database for an obscure song.
Reply
#5
(2019-09-19, 23:03)soundman1611 Wrote: Then I dug around and realized what TMM was really doing.  The "Getting MediaInfo" process is a very lengthy process, but one you want to wait for.  This is the process when TMM is actually analyzing every video file and inserting the video stream data into your NFO files.  This stream data includes the durationinseconds tag.  It takes forever though, but you only have to do it once.

After the whole process was completed, every single movie and tv show in my library all carry the durationinseconds tag.

Exporting the video library to separate files adds the runtime and durationinseconds to nfo files too - even music videos. There's no need to use an external program.
Reply
#6
(2019-09-21, 13:40)stubk Wrote:
(2019-09-19, 23:03)soundman1611 Wrote: Then I dug around and realized what TMM was really doing.  The "Getting MediaInfo" process is a very lengthy process, but one you want to wait for.  This is the process when TMM is actually analyzing every video file and inserting the video stream data into your NFO files.  This stream data includes the durationinseconds tag.  It takes forever though, but you only have to do it once.

After the whole process was completed, every single movie and tv show in my library all carry the durationinseconds tag.

Exporting the video library to separate files adds the runtime and durationinseconds to nfo files too - even music videos. There's no need to use an external program. 

I tried exactly what you are talking about and it did not work 100%.  I did a file search on my library folders searching for durationinseconds tags with a zero and literally hundreds if not thousands of episodes all had zero, after exporting my library to separate files, aka individual NFO files.  Yes, by what I have gathered Kodi does update these tags, but it seems that it only updates the tags after the video has actually been played.  I don't think Kodi is pulling media info of each video as it initially scans your library.  For the reason that doing so would probably make library scanning very slow if you are importing a lot of content, so it makes sense that it obtains this data when you play a file.  So yes, eventually Kodi would have updated all of these tags, but not before you have played every video in your library.
Reply
#7
Do you have the Mediainfo libraries installed?
Reply
 
Thread Rating:
  • 0 Vote(s) - 0 Average



Logout Mark Read Team Forum Stats Members Help
The FINAL answer on PTV Live, video duration, and NFO files00