Opened 4 years ago

Closed 3 years ago

Last modified 3 years ago

#11584 closed Bugs (Fixed)

Youtube plugin starting with -1 "handle instead of -0

Reported by: Beretta92 Owned by:
Priority: 4 - Normal Milestone: 11.0 "Eden"
Component: Python Code and/or Scripts Version: GIT
Severity: Normal Keywords:
Cc: elupus, jfcarroll, Blocked By:
Blocking: Platform: All
Revision: 5f9ca3fffafb0a1a8eef

Description

Youtube plugin starting with -1 "handle instead of -0 which doesn't allow for file listings makes youtube plugin not work. Everytimes I go on search nothing happens because of this, I'm using default confluence theme. Here is my log file: http://pastebin.com/YJFtRrLK

This is not a new bug since it happened to me since version 2.2.3 of the youtube plugin

Attachments (1)

xbmcplugin_int_format.patch (659 bytes) - added by simon_e 3 years ago.
patch for parsing a integer instead of a long int

Download all attachments as: .zip

Change History (24)

comment:1 follow-up: Changed 4 years ago by vdrfan

  • Milestone Future / Pending deleted
  • Resolution set to Not part of XBMC (third-party)
  • Status changed from new to closed

Please contact the add-on author via the official add-ons mailings list or our forums.

comment:2 in reply to: ↑ 1 Changed 4 years ago by Beretta92

Replying to vdrfan:

Please contact the add-on author via the official add-ons mailings list or our forums.

I did, they tell me it comes from XBMC: http://forum.xbmc.org/showthread.php?t=79487&page=95

comment:3 Changed 4 years ago by sho

  • Cc elupus jfcarroll added
  • Component changed from Other (un-categorized) to Python Code and/or Scripts
  • Milestone set to Future / Pending
  • Resolution Not part of XBMC (third-party) deleted
  • Status changed from closed to reopened

From plugin author:
That line is the most interesting for some reason xbmc is starting the plugin with the -1 "handle" (the value should've been 0) which doesn't allow for file listings. Since you're using the confluence skin this seems strange. In any case it's not something we can control, but a problem with the latest nightly (as suspected), try escalating this issue with Team XBMC by creating a trac ticket here: http://trac.xbmc.org/

I wonder who would be responsible for that?

comment:4 Changed 4 years ago by vdrfan

Hmz, searching works just fine for me with todays GIT and YouTube-2.2.4. There's no invalid handle logged.

comment:5 Changed 4 years ago by HenrikDK

Hi, I've tested the same thing on osx x86, but i belive that the problem is somehow bound to differences with the 64 bit build on arch linux. I don't have access to an arch linux machine so can't confirm myself. Any devs run arch?

comment:6 Changed 4 years ago by vdrfan

I am running Ubuntu x64. Not sure if someone is running Arch Linux.

comment:7 Changed 4 years ago by Beretta92

I'm trying to get other people's logs on archlinux... If you need more details please ask

comment:8 Changed 4 years ago by HenrikDK

Im Not really sure what to do about this, python is supposed to be "portable" so why it's suddenly failing on Arch is a mystery to me. My best guess is still that it's xbmc related (we never thouch the plugin handle, we only pass it on). But im not sure what to do from here :|

comment:9 Changed 4 years ago by Angelscry

Just to confirm that it is not related to the plugin; Advanced Launcher has the exact same problem with XBMC under ArchLinux x64. If it is running under Ubuntu x64... problem is the ArchLinux x64 version.

comment:10 Changed 4 years ago by Topper

I confirm this bug on my Archlinux64 setup.

Youtube and many other plugins stopped working (no file listing). Installed xbmc version is 10.1-3 from the community repo. My xbmc.log shows indeed

11:19:23 T:140155785262848 M:1649238016  NOTICE: -->Python Interpreter Initialized<--
11:19:23 T:140155785262848 M:1649238016  NOTICE: YouTube-2.0.4 ARGV: ['plugin://plugin.video.youtube/', '0', '']
11:19:26 T:140155785262848 M:1643110400  NOTICE: YouTube-2.0.4 view mode: 2
11:19:26 T:140156433197120 M:1643110400 WARNING: GetLabel - Unknown nodetype requested 6
11:19:37 T:140155785262848 M:1642688512  NOTICE: -->Python Interpreter Initialized<--
11:19:37 T:140155785262848 M:1642688512  NOTICE: YouTube-2.0.4 ARGV: ['plugin://plugin.video.youtube/', '-1', '?path=/root/search&login=false&store=searches&']
11:19:40 T:140155785262848 M:1636945920   ERROR:  AddItem - called with an invalid handle.
11:19:40 T:140155747157760 M:1636945920   ERROR: Previous line repeats 1 times.
11:19:40 T:140155747157760 M:1636945920  NOTICE: -->Python Interpreter Initialized<--
11:19:40 T:140155747157760 M:1636945920  NOTICE: YouTube-2.0.4 ARGV: ['plugin://plugin.video.youtube/', '-1', '?path=/root/search&login=false&store=searches&']
11:19:41 T:140155785262848 M:1636810752   ERROR:  AddItem - called with an invalid handle.
11:19:43 T:140155785262848 M:1634279424   ERROR: Previous line repeats 14 times.
11:19:43 T:140155785262848 M:1634279424  NOTICE: YouTube-2.0.4 view mode: 2
11:19:43 T:140155785262848 M:1634279424   ERROR:  EndOfDirectory - called with an invalid handle.

Python interpreter version installed is 2.7.2-1 from the official repos.

Is this ok or is there a more appropriate place to report this bug ?

comment:11 follow-up: Changed 4 years ago by lartza_

if you take a look at https://github.com/xbmc/xbmc/blob/master/xbmc/filesystem/PluginDirectory.cpp#L402 it seems that handle is set to -1 on purpose in the RunScriptWithParams method, right? so it should be -1.

I noticed that the Chaos Computer Club CCCTV addon works like a charm in archlinux, so after comparing .xbmc/addons/plugin.video.ccctv/default.py and .xbmc/addons/plugin.video.youtube/YouTubeNavigation.py I noticed that ccctv doesn't set the totalItems optional param at all.

Youtube addon uses xbmcplugin like this: xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=listitem, isFolder=True, totalItems=size) as you can see from http://code.google.com/p/youtubexbmc/source/browse/trunk/YouTubeNavigation.py#320

Now the size is set to 0 with search and explore. Changing the default to 1 didn't help, so I removed totalItems=size from xbmcplugin.addDirectoryItem call completely.

Now I can search and explore youtube, hooray! '%s/, totalItems=sizeg' is the quick and dirty fix for this. And it should work with the other broken plugins too.

The real bug may be somewhere in the https://github.com/xbmc/xbmc/blob/master/xbmc/interfaces/python/xbmcmodule/xbmcplugin.cpp#L59 maybe the new gcc brings it up, I'm not really a c++ wizard so...

comment:12 Changed 4 years ago by lartza_

without using totalItems parameter in the xbmcplugin.addDirectoryItem call the items added will invoke StartScript (with a new handle) in the future instead of RunScriptWithParams (which has always the handle -1).

comment:13 in reply to: ↑ 11 ; follow-up: Changed 4 years ago by sraue

Replying to lartza_:

maybe the new gcc brings it up, I'm not really a c++ wizard so...

hmmm which gcc uses Arch actually?

i have updated OpenELEC with gcc-4.6.1 recently and now we have this bug too (only with x64 builds). from the time it can be related to the upgrade with gcc-4.6.1 from 4.5.3. makes this sense?

comment:14 in reply to: ↑ 13 Changed 4 years ago by lartza_

Replying to sraue:

Replying to lartza_:

maybe the new gcc brings it up, I'm not really a c++ wizard so...

hmmm which gcc uses Arch actually?

i have updated OpenELEC with gcc-4.6.1 recently and now we have this bug too (only with x64 builds). from the time it can be related to the upgrade with gcc-4.6.1 from 4.5.3. makes this sense?

Yes arch has gcc-4.6.1 too, so it most likely is something related to c++ integer handling on 32bit vs 64bit

comment:15 Changed 4 years ago by sraue

downgraded OpenELEC to gcc-4.5.3 and it works again. so its gcc-4.6.x/64bit related

comment:16 Changed 4 years ago by javum

Workaround for Arch Linux x86_64 - build xbmc using gcc45 package from AUR, or just install xbmc-pvr-git http://aur.archlinux.org/packages.php?ID=50894 (it uses gcc45 as makedepends).

comment:17 Changed 3 years ago by manio

I can confirm that I also have this issue on my 64bit debian box. It worked before, now I also have this problem. I have g++ 4.6.1-2, xbmc from git (opdenkamp's fork) and youtube plugin from plugin repository (version 2.6.1 for now). Vimeo plugin also doesn't work (worked before), but ie. TechCrunch TV plugin is working fine (now and before). I've made a quick-n-dirty fix inside YouTubeNavigation.py (like lartza_ said) and it works. If you need some debug info/test any patches please let me know, I'll try to do my best to help you solve this bug.

comment:18 Changed 3 years ago by simon_e

Hi all,

I did some digging in the code and found that changing the format argument of PyArg_ParseTupleAndKeywords in the function AddDirectoryItem https://github.com/xbmc/xbmc/blob/master/xbmc/interfaces/python/xbmcmodule/xbmcplugin.cpp#L59 fixed the issue for me.

I changed (char*)"iOO|bl", to (char*)"iOO|bi", as iTotalItems is a integer instead of a long int. Maybe someone can take a look at this and check what the correct value should be?

The function XBMCPLUGIN_AddDirectoryItems has the same integer / long mismatch.

Changed 3 years ago by simon_e

patch for parsing a integer instead of a long int

comment:19 Changed 3 years ago by jfcarroll

Thanks simon. Checking now. Sorry for the delay.

comment:20 Changed 3 years ago by jfcarroll

Your patch is exactly right. Thanks. I'll make sure it gets in shortly.

comment:21 Changed 3 years ago by Github Janitor

  • Resolution set to Fixed
  • Status changed from reopened to closed

[fixed] closes #11584. Patch submitted by simon_e. Python parse had wrong native type.

This fixes an issue where the PyArg_ParseTupleAndKeywords command used in two places had the incorrect type. It only had been working correctly on platforms where 'long' and an 'int' are the same.

Changeset: ce5668d79352c7705d0aa0ab08b96cb6f24a8e4a By: Jim Carroll

comment:22 Changed 3 years ago by vdrfan

  • Milestone changed from Future / Pending to 11.0

comment:23 Changed 3 years ago by fiveisalive

Looking into backporting patch for RPM Fusion package for 10.1: https://bugzilla.rpmfusion.org/show_bug.cgi?id=1905

Note: See TracTickets for help on using tickets.