v18 Mark as watched broken in YouTube plugin and maybe others
#1
Bug 
I can't mark videos as watched while using Mysql in the YouTube plugin. I've narrowed it down to the actual insert statement which uses a wrong idPath. The record gets created but with the wrong id and it is not marked as watched in the video list.

This is under Leia:
21:20:19.830 T:163752928496   DEBUG: Mysql execute: insert into files (idFile, idPath, strFileName) values(NULL, 524, 'plugin://plugin.video.youtube/play/?video_id=CJSg3IjXa0s')

This is under Krypton
21:47:52.691 T:123145327734784   DEBUG: Mysql execute: insert into files (idFile, idPath, strFileName) values(NULL, 135, 'plugin://plugin.video.youtube/play/?video_id=CJSg3IjXa0s')

These are the two path records in the Leia database which was migrated from the Krypton database, the record with idPath 524 does not exist in the Krypton database and was created as I marked the first item as watched in Leia.

idPath    strPath    strContent    strScraper    strHash    scanRecursive    useFolderNames    strSettings    noUpdate    exclude    dateAdded    idParentPath
135    plugin://plugin.video.youtube/    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
524    plugin://plugin.video.youtube/play/    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    135

idPath 524 has 135 as parent path but nothing gets a watched symbol in the video list with this path id. When I manually change the field idPath in the files table from 524 to 135 it's marked as watched in the video list.

I've further investigated when this broke. The last nightly where everything worked was kodi-20180325-03d453ae-master. The first nightly where it's broken and which creates the additional path is kodi-20180327-7e5d384c-master.
Reply
#2
The Official YouTube Support Thread is in my signature.
If I have helped you or increased your knowledge please click the 'Thumb Up - Like' button to show me your appreciation :)
For YouTube questions see the official thread here.
Reply
#3
As I didn't suspected the YouTube add-on as the culprit. I've whipped together a Kodi build environment and debugged it a little more.

I suspect the following commit causing it:
Code:
Support plugin sources for media library with metadata.local scraper
AkariDN committed on 19 Feb
1 parent f5e7d8c commit 9db99f19e80df6a15bfc2996b1c96a9af774df1d
In the method void CVideoDatabase::SplitPath(const std::string& strFileNameAndPath, std::string& strPath, std::string& strFileName) from xbmc/video/VideoDatabase.cpp the following change broke it:
cpp:
@@ -9572,7 +9576,9 @@ void CVideoDatabase::SplitPath(const std::string& strFileNameAndPath, std::strin
else if (URIUtils::IsPlugin(strFileNameAndPath))
{
CURL url(strFileNameAndPath);
- strPath = url.GetWithoutFilename();
+ strPath = url.GetWithoutOptions();
+ if (strPath == strFileNameAndPath)
+ strPath = url.GetWithoutFilename();
strFileName = strFileNameAndPath;
}

I did a quick 'n dirty "rollback" to:
cpp:
  else if (URIUtils::IsPlugin(strFileNameAndPath))
  {
    CURL url(strFileNameAndPath);
    //strPath = url.GetWithoutOptions();
    //if (strPath == strFileNameAndPath)
      strPath = url.GetWithoutFilename();
    strFileName = strFileNameAndPath;
  }

built it and voila all is working as it should be. Videos get marked as watched in the video list again and not only in the database.

strPath before the "rollback": plugin://plugin.video.youtube/play/
strPath after the "rollback": plugin://plugin.video.youtube/

If someone from the Kodi team could shed some light on why this was changed and if the issues caused by it where intentionally or accidentally and if something could by done on the add-on side would be really great.

@jmh2002 I'm not sure if this issue belongs in the "The Official YouTube Support Thread". I don't have any issues with YouTube.
Reply
#4
@infodroid  Thanks for looking further into this, just added the thread to the trac ticket I have open for this issue.
Debug Log (wiki) | Troubleshooting (wiki)Add-ons
Reply
#5
I just upgraded to the latest nightly build of Kodi Leia today and I note that this still has not been fixed.  I would VERY much appreciate it if this issue could be addressed sometime in the near future!

I am not well enough versed in Linux to compile stuff but short of that is there any easy way to patch or temporarily fix this problem until a proper fix is available?
Reply
#6
(2018-09-16, 10:01)xbmclinuxuser Wrote: I just upgraded to the latest nightly build of Kodi Leia today and I note that this still has not been fixed.  I would VERY much appreciate it if this issue could be addressed sometime in the near future!

I am not well enough versed in Linux to compile stuff but short of that is there any easy way to patch or temporarily fix this problem until a proper fix is available?
 Sadly, unless the team make the change on github, your only other alternative is to clone the source code, make the alteration yourself and compile it.  You don't need to be "well versed" in linux to compile it.  There are clear and well written instructions on github that explain everything that you need to install for Kodi to compile and how to do it.

Besides, you will also have the satisfaction of fixing your issue and knowing that you did it yourself and learning something along the way.  If you follow the instructions, everything should go smoothly, but in the event that it doesn't, you can always come back here and ask for help.
Learning Linux the hard way !!
Reply
#7
(2018-09-16, 10:47)black_eagle Wrote:
(2018-09-16, 10:01)xbmclinuxuser Wrote: I just upgraded to the latest nightly build of Kodi Leia today and I note that this still has not been fixed.  I would VERY much appreciate it if this issue could be addressed sometime in the near future!

I am not well enough versed in Linux to compile stuff but short of that is there any easy way to patch or temporarily fix this problem until a proper fix is available?
 Sadly, unless the team make the change on github, your only other alternative is to clone the source code, make the alteration yourself and compile it.  You don't need to be "well versed" in linux to compile it.  There are clear and well written instructions on github that explain everything that you need to install for Kodi to compile and how to do it.

Besides, you will also have the satisfaction of fixing your issue and knowing that you did it yourself and learning something along the way.  If you follow the instructions, everything should go smoothly, but in the event that it doesn't, you can always come back here and ask for help.   
It's responses like this that sometimes make me wish that there was some viable alternative to Kodi.  I am a USER, not a LINUX GEEK.  If I were running Windows or MacOS or Android, you would not even think to suggest that I should compile software, let alone that I would get any "satisfaction" from doing so (I guarantee you that I would NOT).  But because I happened to have installed Kodi on Ubuntu, you ASSuME that I am a wannabe Linux geek, which isn't even remotely true.  Half the time I loathe Linux, but not quite as much as I loathe Windows.

As a user I should not have to fix Kodi bugs, especially ones that have already been identified and for which a solution is probably known (reverse whatever change introduced this undesired behavior).  I know, free software, nobody owes me anything and all that, but still in most software forums if you report a bug the developers at least pretend to care, and don't act as if the users of their software should have to go to extraordinary lengths to get a properly functioning system.

I REALLY hope you are not a Kodi developer!!!
Reply
#8
Once again, if anyone anyone knows of an easy way to patch or temporarily fix this problem until a proper fix is available, I'd be very appreciative if you'd share it.  In other words, some kind of simple workaround until the Kodi developers get around to fixing the code (which I hope they will do soon, but I am not holding my breath).  I don't really understand what caused this issue in the first place other than that someone made a bad change to the code, which if so you'd think would be easy enough for them to back out, but for some reason getting an issue fixed never seems to be easy in Kodi.  But since Kodi Leia is still in beta, I'm at least somewhat hopeful this might get addressed soon, but would still like to have some sort of band-aid fix in the meantime if such a thing exists.
Reply
#9
No, I'm not a Kodi developer, just a user like yourself.  And no, I aren't assuming anything ( I have read your signature! ) but yeah, if you were running Windows or MacOS I would still have suggested that you compile it yourself if that is the only (current) way to get your issue fixed.  You don't have to be some sort of techno-geek to do it (if you did, it's most unlikely that I would be able to do it!!), you just have to be able to follow some instructions, which I'm sure you are more than capable of doing.

I'd build it for you, but I'm still on 16.04 so I doubt it would be compatible.

Anyway, I'm not going to try to persuade you.  If you're happy enough to wait until a dev fixes it (assuming one of them does) and it appears in a later build then that's absolutely fine.  I merely suggested a method whereby you could have it fixed by this afternoon.
Learning Linux the hard way !!
Reply
#10
Well I appreciate that offer but it really isn't helpful for two reasons, aside from the possible version incompatibility.  First, even if I could somehow compile it and get it working - and that assumes I know exactly what needs to be changed, which I really don't - then it really only helps me and not all the others who may be experiencing this issue (which would be everyone using one of the affected addons), and second, every time a new version of Kodi is released I'd need to do it again until they fix the problem.  The real problem I have with compiling is that it always seems to turn into an exercise in puzzle solving, and I hate puzzles, especially ones that I know in the end may not be solvable (by me, anyway).  I have foolishly tried to compile things in the past and invariably the process ends prematurely with some kind of error.  Then you spend the next six hours trying to figure out what the hell that error means and how to resolve it (because, you know, in Linux they can never just tell you what you need to do as part of the error message) only to find that that's only the first of a long list of errors.  And then at some point you find out that something you did broke your entire system and now you have to reinstall Ubuntu from scratch, and you have lost all your configurations so now you have to try to do those all over again.  I went down that rabbit hole once and I have no desire to repeat that anytime soon.  Linux is a great platform for people who enjoy puzzle solving but for people who just want to use their computer it can be awful sometimes.

To me it's like shadetree car mechanics vs. people who just want to drive their cars and couldn't care lees about what's going on under the hood.  The first group just doesn't understand why the second gets no joy out of spending weekends peering under the hood or getting under the car to make it work better.  The second group says that as long as the damn thing gets them where they need to go in relative comfort, they're happy, and if it doesn't do that they take it to someone who can fix the problem.  But they don't have the problem of using the car for months or years, then having to get an upgrade for security reasons, only to find that after the upgrade the sound system doesn't work right and the A/C only has two settings, off and suitable for Antarctic penguins.  If I understand this correctly, this is a case where someone screwed up some of the coding in Kodi and all they need to do is back that change out, and it would fix the problem for everyone.

From your signature I get the distinct impression that you really get into Linux and all its intricacies and that's great, but please don't fall into the trap of thinking that all Linux users have those same aspirations.  That may have been the case for a few years after Linux was initially released, but now that there are distros like Ubuntu and Linux Mint, a large segment of Linux users just want to use their computer and they would no more think about compiling software than they would consider taking a socket wrench to their car.
Reply
#11
For anyone else reading this, information and a link to a temporary fix for the YouTube addon only is here: https://forum.kodi.tv/showthread.php?tid...pid2768036
Reply

Logout Mark Read Team Forum Stats Members Help
Mark as watched broken in YouTube plugin and maybe others0