Mark as Watched - MyVideos60.db and Files Table

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
bengalih Offline
Senior Member
Posts: 117
Joined: Oct 2004
Reputation: 1
Post: #1
I'm hoping that a knowledgeable dev can help me out here. I have been trying my best to support the XBMCFlicks add-on community since Fekker (the dev) has been MIA. There was never a fully posted add-on for Eden, but he did leave a link back in January for a version that works pretty well for most intents and purposes.

The issue however is that the "togglewatched" and check marks for watched episodes don't seem to be properly working. I have done some research and poking around and to the best of my knowledge the watched flag for an episode is triggered by placing and entry into the MyVideos60.db file into the Files table. The files table has the following format:

idFile,idPath,strFilename,playCount,lastPlayed

So, if i watched a video called mymovie.avi there would be an entry added something along the following:

1,1,mymovie.avi,1,2012-04-28

Pressing the "W" key in XBMC would also toggle that playCount between 0 and 1. If the playCount > 0 then the mark as watched checkbox is placed on that video.

The way that the XBMCFlicks plugin works is by creating .html files for every enumerated episode retrieved from a user's Netflix queue. It places these in the userdata\addon_data\plugin.video.xbmcflicks\links directory.

The behavior in both Dharma and Eden appears to be the same in how and where these link files get created. Also, it appears that when watching a movie (or pressing "W") the proper entry is placed into the MyVideos60.db. It would look like the following for a file called 81327919.html:

1,1,81327919.html,1,2012-04-28

If a movie is watched, it seems that the checkbox gets placed next to the movie, but only as long as that window is open. If the window is closed (or XBMC restarted) the checkbox goes away. It is as if the entry is not being read out of the database.

I assume this problem is being caused by one of two things:
1) XBMC is not honoring the "html" extension for reading files out of the table.
2) The XBMCFlicks add-on is not properly reading the files out of the table.

I am hoping someone can point me in the right direction of what needs to happen here from a coding perspective. If it is a problem with the plugin I hope to be able to track it down...but I can see no direct references in the python as to how this information is enumerated out of the database...it seems as if this is normally something that XBMC takes care of and not the add-on.

Does anyone know if Eden introduced any behavioral changes here that might shed some light?

thanks very much

.peace out.
(This post was last modified: 2012-04-29 05:20 by bengalih.)
find quote
jmarshall Offline
Team-XBMC Developer
Posts: 26,229
Joined: Oct 2003
Reputation: 177
Post: #2
I believe you'll find the problem is:

3) The bit that loads the watched details (GUIWindowVideoNav::LoadVideoInfo) doesn't retrieve the info for these items, as the items at that point are plugin:// URLs that *may* not correspond to the ones you're seeing in the listing?

Check the path table so that you know the full path for the files, then check what the XBMCflicks add-on is sending back with it's listing and compare the two.

Cheers,
Jonathan

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]
find quote
Bstrdsmkr Offline
Posting Freak
Posts: 803
Joined: Oct 2010
Reputation: 17
Post: #3
XBMC tracks the watched information based on the played url, not the file, which is causing your problem. There is currently no work around for file-based addons. Addons that use web urls directly can use script.module.metahandlers to "fake" it by keeping track of activity and setting the appropriate flags when the associated list items are displayed
find quote
bengalih Offline
Senior Member
Posts: 117
Joined: Oct 2004
Reputation: 1
Post: #4
Thanks for the responses guys...I have looked at the paths table in the database and it does fill-in some more of the process.

There is an entry in paths table as follows:

idPath,strPath
1,C:\Users\username\AppData\Roaming\XBMC\userdata\addon_data\plugin.video.xbmcfl​icks\links

This gets created both in Dharma and Eden and appears to look the same.

And since the files table seems to reference this idPath above it would seem to me to be linking all the correct DB tables together.

So now I'm a little stuck on the statement "check what the XBMCflicks add-on is sending back with it's listing and compare the two."

If i didn't mention...I'm just a bit of a hacker trying to help out while the developer is MIA...I'm not sure what methods or calls would be used by an add-on to query the database in this fashion. Something has obviously changed in the way this is queried between Dharma and Eden, since it all worked fine in Dharma. I'm not sure at what point XBMC does the work vs what gets passed to the add-on. Can you provide maybe some details on the type of data structures I should be looking for in the code that would help me track down what the add-on is sending/retrieving? If the files/path table in the database is all that is used for this, then I think we are sending the right info...but perhaps not pulling it back out properly?

thanks!

UPDATE: I did a bit more digging and it seems to me the only possible place that this add-on is interacting with the gui is simply through the
xbmcplugin.addDirectoryItem method. For instance:

xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=url, listitem=li, isFolder=isFolder)

I dumped out the url that is getting passed there and it looks like this:
plugin://plugin.video.xbmcflicks/?mode=tvExpandshId70136140seIdFalse

So I guess this is what you are saying re the plugin://.

I'm still not sure how to piece this together...as it worked pre-Eden, I'm still hoping for an explanation of what is it that is changed from Dharma to Eden in this regard to maybe help me focus on what might need to be fixed.

.peace out.
(This post was last modified: 2012-04-29 19:07 by bengalih.)
find quote
jmarshall Offline
Team-XBMC Developer
Posts: 26,229
Joined: Oct 2003
Reputation: 177
Post: #5
Exactly, so what needs to happen is XBMC needs to store the watched status for the plugin:// URL.

My guess is because XBMC is not actually playing the "file" it's not running through the normal resolve stages, which thus is making the original URL be stored rather than the new one. I'm not sure how the plugin is hooking up the watched state anyway, as XBMC won't be doing it as the file isn't being played with it.

Cheers,
Jonathan

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]
find quote
Bstrdsmkr Offline
Posting Freak
Posts: 803
Joined: Oct 2010
Reputation: 17
Post: #6
Sort of a stab in the dark, but the name of the video database did change from Dharma->Eden so see if maybe the name of the database file is hard coded somewhere. I think the file name for Pre-Eden was MyVideos58.db
find quote
bengalih Offline
Senior Member
Posts: 117
Joined: Oct 2004
Reputation: 1
Post: #7
(2012-04-30 01:28)Bstrdsmkr Wrote:  Sort of a stab in the dark, but the name of the video database did change from Dharma->Eden so see if maybe the name of the database file is hard coded somewhere. I think the file name for Pre-Eden was MyVideos58.db

You are correct...the DB name did change from 34 to 60...but there is no hard-coding in the plugin, I checked for that already :/

(2012-04-30 01:12)jmarshall Wrote:  Exactly, so what needs to happen is XBMC needs to store the watched status for the plugin:// URL.

My guess is because XBMC is not actually playing the "file" it's not running through the normal resolve stages, which thus is making the original URL be stored rather than the new one. I'm not sure how the plugin is hooking up the watched state anyway, as XBMC won't be doing it as the file isn't being played with it.

Cheers,
Jonathan

Johnathan - Would you be so kind as to just hold my hand a bid more as to what exactly needs to be stored? To re-iterate, there is an entry in Path table that looks like the following:

idPath,strPath
1,C:\Users\username\AppData\Roaming\XBMC\userdata\addon_data\plugin.video.xbmcfl​​icks\links

and an entry in Files that looks like:

idFile,idPath,strFilename,playCount,lastPlayed
1,1,87273842.html,1,2012-04-28


This format gets stored the same way in both Dharma and Eden - but it seems to only be read back out in Dharma. I don't know if the plugin isn't reading it, or the type of call the plugin is making is no longer valid. I cant find anything in the code which indicates a read from the database. No one has really been clear on what has changed in Eden and why this would be broken in the move to Eden.

thanks again (for my ignorance)!

.peace out.
find quote
fekker Offline
Posting Freak
Posts: 1,545
Joined: Oct 2008
Reputation: 30
Post: #8
Good info, wish i could add more to the topic, bengalih has already covered most things.

To display the items, I add them using
Code:
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=url, listitem=li, isFolder=isFolder)
or

Code:
liz=xbmcgui.ListItem(name, iconImage="DefaultVideo.png", thumbnailImage=curX.Poster)
    liz.setInfo( type="Video", infoLabels={ "Mpaa": str(curX.Mpaa), "TrackNumber": int(str(curX.Position)), "Year": int(str(curX.Year)), "OriginalTitle": str(curX.Title), "Title": str(curX.TitleShort), "Rating": float(curX.Rating)*2, "Duration": str(int(curX.Runtime)/60), "Director": str(curX.Directors), "Genre": str(curX.Genres), "CastAndRole": str(curX.Cast), "Plot": str(curX.Synop) })
    liz.addContextMenuItems( commands )
    ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=url,listitem=liz, isFolder=False)
(This post was last modified: 2012-05-05 04:56 by fekker.)
find quote
jmarshall Offline
Team-XBMC Developer
Posts: 26,229
Joined: Oct 2003
Reputation: 177
Post: #9
The watched status will be stored using the URL that is present in the listing given back by the plugin.

Are you setting content on the folder when you return the listing? If not, that might be the problem. By the looks you want to set content to movies.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]
find quote
bengalih Offline
Senior Member
Posts: 117
Joined: Oct 2004
Reputation: 1
Post: #10
jmarshall -

As far as setting the content to movies - is that something that must be done in the code, or can it also be done via the GUI? Can you point me to the applicable resources?

I hate to keep asking this, but since we can't seem to get this resolved, I would like to understand exactly what changed here between Eden and Dharma. It seems for the most part that the feedback we are getting is not version specific. Since everything worked fine in Dharma, I would like to know what mechanisms here changed in Eden that would have broken this.

Thanks again for your help

.peace out.
find quote
jmarshall Offline
Team-XBMC Developer
Posts: 26,229
Joined: Oct 2003
Reputation: 177
Post: #11
list.setContent("movies") from the plugin.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]
find quote
bengalih Offline
Senior Member
Posts: 117
Joined: Oct 2004
Reputation: 1
Post: #12
Thanks again for the response jmarshall.

I am unable to find any information at all about the list.setContent command.

I have verified that throughout the script the following command is used:

Code:
xbmcplugin.setContent(int(sys.argv[1]),'Movies')

For example here is the routine to enumerate the user's netflix instant queue:

Code:
def getInstantQueue(displayWhat=None):
    initApp()
    getUserInstantQueue(netflixClient,user, displayWhat)
    if(not user):
        exit
    time.sleep(1)
    xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_LABEL )
    xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_DATE )
    xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_VIDEO_RUNTIME )
    xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_VIDEO_YEAR )
    xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_GENRE )
    xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_MPAA_RATING )
    xbmcplugin.setContent(int(sys.argv[1]),;'Movies')
    xbmcplugin.endOfDirectory(int(sys.argv[1]))

This def calls upon the getUserInstantQueue def which in turn calls upon def getMovieDataFromFeed which will eventually add each item to the plugin menu with commands similar to:

Code:
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=url, listitem=li, isFolder=isFolder)

I can only assume the setContent method of the xbmcplugin is the same as the list.setcontent you provided? The addDirectoryItem method is the only place in the code that I can see any interface being done directly with the library.

Once again, please excuse my ignorance on the subject...this is a much desired feature that has ceased to function since the upgrade to Eden, and many of the users of this plugin are itching to get it working again.

Perhaps there is more to the setcontent that I don't yet understand (that would have changed since Dharma) and that this is still the reason. Or perhaps there is another aspect that is causing this.

Is there any other guidance you can offer?

thanks.

.peace out.
(This post was last modified: 2012-05-22 02:08 by bengalih.)
find quote
bengalih Offline
Senior Member
Posts: 117
Joined: Oct 2004
Reputation: 1
Post: #13
Looking at some other plugins (like funny or die) I see a completely different set of syntax being used.

Whereas in XBMCFlicks the strPath looks like this:

C:\Users\username\AppData\Roaming\XBMC\userdata\addon_data\plugin.video.xbmcflic​ks\links\

and the strFilename looks like:

70196252.html

In other plugins they are more similar to:

strPath:
plugin://plugin.video.funny.or.die/

strFilename:
plugin://plugin.video.funny.or.die/?url=11565f67bc&mode=2&name=The+King+Kaiser+Show+from+jeffhin

Now I realize that these other plugins don't write out external file links like XBMCFlicks does (or at least I don't believe them to), but I can't find any documentation that discussed the proper methods of adding and what any of this means.

I know that a lot of this code is beyond me, but I find it hard to believe that a plugin which worked fine in this regard in dharma now has the functionality completely broken in Eden with absolutely no documentation to describe what changes occurred and how to properly code for them.

Perhaps I am missing some important info, but after hours of scouring the web using the most common to most obscure terms I am still left with virtually no information about how all of this fits together.

I am hoping someone can at least craft me what the proper entry in the database should be. If I can hand edit a db entry which will properly reflect in the GUI for a watched episode, then I can go back to the code and look to having it write it there properly - but at this point I can't find any info on the proper syntactical entries.

once again, thanks for any assitance....

.peace out.
find quote
Bstrdsmkr Offline
Posting Freak
Posts: 803
Joined: Oct 2010
Reputation: 17
Post: #14
Urls like
Quote:plugin://plugin.video.funny.or.die/?url=11565f67bc&mode=2&name=The+King+Kaiser+Show+from+jeffhin
are used to launch plugins which find the content again (based) on the parameters sent to them and then play the content.

Since xbmcflix plays through a browser, I would imagine that it's just saving the webpage to a file, then opening that file in a browser when called. If that's the case, and the url for a particular piece of content never changes, you just need to look that file up in the database and set the playcount higher than 1
find quote